:root {
  color-scheme: light;
  --color-bg: #f8f9fa;
  --color-surface: #ffffff;
  --color-surface-alt: #f1f3f4;
  --color-text-primary: #202124;
  --color-text-secondary: #5f6368;
  --color-text-tertiary: #80868b;
  --color-primary: #1a73e8;
  --color-primary-rgb: 26, 115, 232;
  --color-primary-hover: #185abc;
  --color-primary-text: #ffffff;
  --color-success: #1e8e3e;
  --color-success-rgb: 30, 142, 62;
  --color-success-hover: #1a7f37;
  --color-success-text: white;
  --color-warning: #f59e0b;
  --color-border: #dadce0;
  --color-error: #d93025;
  --color-card-bg: #e8f0fe;
  --color-disabled-bg: #e0e0e0;
  --color-disabled-text: #a0a0a0;
  --color-shadow-1: rgba(60, 64, 67, 0.15);
  --color-shadow-2: rgba(60, 64, 67, 0.1);
  --color-focus-shadow: rgba(26, 115, 232, 0.2);
  --color-button-focus-shadow: rgba(26, 115, 232, 0.3);
  --color-code-bg: var(--color-bg);
  --ankigen-topbar-height: 64px;
}

body[data-theme="dark"] {
  color-scheme: dark;
  --color-bg: #202124;
  --color-surface: #2d2e30;
  --color-surface-alt: #23262d;
  --color-text-primary: #E5E7EB;
  --color-text-secondary: #D1D5DB;
  --color-text-tertiary: #9CA3AF;
  --color-primary: #8ab4f8;
  --color-primary-rgb: 138, 180, 248;
  --color-primary-hover: #aecbfa;
  --color-primary-text: #202124;
  --color-success: #81c995;
  --color-success-rgb: 129, 201, 149;
  --color-success-hover: #a8dab5;
  --color-success-text: #202124;
  --color-warning: #f2c94c;
  --color-border: #5f6368;
  --color-error: #f28b82;
  --color-card-bg: #3c4043;
  --color-disabled-bg: #3c4043;
  --color-disabled-text: #7f8184;
  --color-shadow-1: rgba(0, 0, 0, 0.3);
  --color-shadow-2: rgba(0, 0, 0, 0.2);
  --color-focus-shadow: rgba(138, 180, 248, 0.3);
  --color-button-focus-shadow: rgba(138, 180, 248, 0.4);
  --color-code-bg: #1e1e1e;
}

body {
  font-family: 'Google Sans', Roboto, Arial, sans-serif;
  margin: 0;
  background-color: var(--color-bg);
  color: var(--color-text-primary);
  min-height: 100vh;
  transition: background-color 0.3s, color 0.3s;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

.app-shell {
  min-height: 100vh;
}

.app-content {
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

.message-stack {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}

.message {
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
}

.message.success {
  background: #e8f0fe;
  border-color: var(--color-primary);
}

.message.error {
  background: #fdecea;
  border-color: var(--color-error);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--color-card-bg);
  color: var(--color-text-primary);
  border: 1px solid var(--color-border);
  font-size: 0.85rem;
  font-weight: 600;
}

.container {
  background-color: var(--color-surface);
  padding: 40px;
  border-radius: 12px;
  box-shadow: 0 1px 3px var(--color-shadow-1), 0 4px 8px var(--color-shadow-2);
  width: 90%;
  max-width: 800px;
  text-align: center;
  margin: 0 auto;
  position: relative;
  transition: background-color 0.3s, box-shadow 0.3s;
}

body[data-layout="index"] .container {
  width: 100%;
  max-width: 1200px;
}

.public-stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin: 0 0 18px;
  position: relative;
  z-index: 1;
}

.stat-card {
  position: relative;
  z-index: 1;
  overflow: hidden;
  background: #1e2228;
  border: 1px solid #2a2f36;
  padding: 16px 18px 14px;
  border-radius: 12px;
  box-shadow: none;
}

.stat-card h4 {
  margin: 0 0 8px;
  color: #e5e7eb;
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.stat-hours-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.airport-counter-shell {
  display: inline-flex;
  padding: 8px;
  border: 2px solid #1a1a1a;
  border-radius: 8px;
  background: #000000;
  box-shadow:
    inset 0 1px 3px rgba(255, 255, 255, 0.06),
    inset 0 -2px 4px rgba(0, 0, 0, 0.6);
  position: relative;
  z-index: 1;
}

.airport-counter {
  display: flex;
  align-items: center;
  gap: 4px;
  min-height: 64px;
}

.airport-digit {
  width: 52px;
  height: 64px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  border-radius: 4px;
  color: #ffffff;
  border: 1px solid #1a1a1a;
  background: linear-gradient(to bottom, #2a2a2a 0%, #1f1f1f 100%);
  text-shadow: none;
  font-size: 2.1rem;
  font-weight: 600;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  box-shadow:
    inset 0 2px 4px rgba(255, 255, 255, 0.05),
    inset 0 -2px 6px rgba(0, 0, 0, 0.6);
  overflow: visible;
  isolation: isolate;
}

.airport-digit::before {
  content: "";
  position: absolute;
  top: 0;
  right: -6px;
  bottom: 0;
  left: -6px;
  border-radius: 4px;
  background:
    linear-gradient(to bottom, rgba(255, 255, 255, 0.04) 0%, rgba(255, 255, 255, 0) 48%, rgba(0, 0, 0, 0.22) 52%, rgba(0, 0, 0, 0.35) 100%),
    linear-gradient(to right, #2b2b2b 0%, #444444 50%, #1c1c1c 100%),
    linear-gradient(to right, #2b2b2b 0%, #444444 50%, #1c1c1c 100%);
  background-size:
    100% 100%,
    10px 22px,
    10px 22px;
  background-position:
    center,
    left center,
    right center;
  background-repeat: no-repeat;
  pointer-events: none;
}

.airport-digit::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 3px;
  transform: translateY(-0.5px);
  background: #000000;
  box-shadow:
    0 -1px 0 rgba(255, 255, 255, 0.1),
    0 1px 0 rgba(0, 0, 0, 0.6);
  pointer-events: none;
}

.airport-separator {
  color: #ffffff;
  font-size: 1.2rem;
  font-weight: 600;
  width: 10px;
  text-align: center;
}

.stat-metric {
  margin: 0 0 6px;
  color: #cbd5e1;
  font-size: 0.95rem;
  line-height: 1.4;
}

.stat-metric strong {
  color: #94a3b8;
  font-weight: 600;
}

.stat-period-description {
  margin: 0;
  color: #94a3b8;
  font-size: 0.9rem;
  line-height: 1.45;
  min-height: 2.6em;
}

.period-selector {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding-top: 0;
}

.period-selector button {
  min-width: 32px;
  height: 26px;
  border-radius: 6px;
  border: 1px solid #3a4048;
  background: #2a2f36;
  color: #94a3b8;
  padding: 0 6px;
  font-size: 0.8rem;
  font-weight: 600;
  box-shadow: none;
}

.period-selector button:hover {
  background: #313742;
  color: #cbd5e1;
}

.period-selector button.is-active {
  border-color: #475569;
  background: #3a4048;
  color: #e2e8f0;
}

body[data-theme="light"] .stat-card {
  background: linear-gradient(145deg, #f6f7f9, #eef1f6);
  border-color: #e3e7ee;
}

body[data-theme="light"] .stat-card h4 {
  color: #1e293b;
}

body[data-theme="light"] .stat-metric {
  color: #475569;
}

body[data-theme="light"] .stat-metric strong {
  color: #1f2937;
}

body[data-theme="light"] .stat-period-description {
  color: #64748b;
}

body[data-theme="light"] .airport-digit {
  color: #111111;
  border: 1px solid #d0d0d0;
  background: linear-gradient(to bottom, #d9d9d9 0%, #c4c4c4 100%);
  box-shadow:
    inset 0 2px 4px rgba(255, 255, 255, 0.6),
    inset 0 -2px 6px rgba(0, 0, 0, 0.15);
}

body[data-theme="light"] .airport-digit::before {
  background:
    linear-gradient(to bottom, rgba(255, 255, 255, 0.5) 0%, rgba(255, 255, 255, 0) 48%, rgba(0, 0, 0, 0.1) 52%, rgba(0, 0, 0, 0.16) 100%),
    linear-gradient(to right, #cfcfcf 0%, #e4e4e4 50%, #b5b5b5 100%),
    linear-gradient(to right, #cfcfcf 0%, #e4e4e4 50%, #b5b5b5 100%);
  background-size:
    100% 100%,
    10px 22px,
    10px 22px;
  background-position:
    center,
    left center,
    right center;
  background-repeat: no-repeat;
}

body[data-theme="light"] .airport-digit::after {
  background: #000000;
}

body[data-theme="light"] .period-selector button {
  background: #ffffff;
  border-color: #dde2ea;
  color: #64748b;
}

body[data-theme="light"] .period-selector button:hover {
  background: #f3f5f8;
  color: #334155;
}

body[data-theme="light"] .period-selector button.is-active {
  background: #e7ecf3;
  border-color: #cbd5e1;
  color: #1e293b;
}

@media (max-width: 1080px) {
  .stat-card h4 {
    font-size: 1.2rem;
  }

  .airport-digit {
    width: 46px;
    height: 58px;
    font-size: 1.9rem;
  }

  .stat-metric {
    font-size: 0.9rem;
  }

  .stat-period-description {
    font-size: 0.85rem;
  }
}

@media (max-width: 768px) {
  .public-stats-grid {
    grid-template-columns: 1fr;
  }

  .stat-hours-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .stat-card-hours .stat-hours-header {
    align-items: center;
  }

  .airport-digit {
    width: 44px;
    height: 56px;
    font-size: 1.8rem;
  }

  .stat-card h4 {
    font-size: 1.1rem;
  }
}

.content-wrapper {
  text-align: left;
}

.content-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 1px 3px var(--color-shadow-1), 0 4px 8px var(--color-shadow-2);
}

.form-control,
.form-select,
textarea.form-control {
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  color: var(--color-text-primary);
}

.form-control:focus,
.form-select:focus,
textarea.form-control:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-focus-shadow);
}

.form-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.form-grid label {
  font-weight: 600;
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--color-text-primary);
}

.form-grid input,
.form-grid select,
.form-grid textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-surface);
  color: var(--color-text-primary);
}

.form-grid input:focus,
.form-grid select:focus,
.form-grid textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-focus-shadow);
}

.form-grid .full-row {
  grid-column: 1 / -1;
}

/* Topbar Styles (New) */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  height: var(--ankigen-topbar-height);
  padding: 10px 20px;
  background-color: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  box-shadow: 0 1px 2px var(--color-shadow-2);
  z-index: 1000;
}

.topbar-brand {
  font-size: 1.2rem;
  font-weight: bold;
  color: var(--color-primary);
}

.topbar-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.topbar-auth {
  display: flex;
  gap: 10px;
  align-items: center;
}

body[data-authenticated="false"] .topbar-auth-only {
  display: none;
}

.topbar-btn {
  text-decoration: none;
  font-weight: 500;
  color: var(--color-text-secondary);
  padding: 8px 16px;
  border-radius: 4px;
  transition: background-color 0.2s, color 0.2s;
}

.topbar-btn:hover {
  background-color: var(--color-card-bg);
  color: var(--color-text-primary);
}

.topbar-btn-primary {
  background-color: var(--color-primary);
  color: var(--color-primary-text);
  border: 1px solid var(--color-primary);
}

.topbar-btn-primary:hover {
  background-color: var(--color-primary-hover);
  color: var(--color-primary-text);
  border-color: var(--color-primary-hover);
}


h1 {
  color: var(--color-primary);
  margin-bottom: 15px;
  font-size: 2em;
  font-weight: 500;
}

p {
  margin-bottom: 25px;
  color: var(--color-text-secondary);
  line-height: 1.6;
}

/* Theme Toggle Button */
.theme-toggle-button {
  background-color: transparent;
  border: 1px solid transparent;
  border-radius: 50%;
  width: 44px;
  height: 44px;
  padding: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  color: var(--color-text-secondary);
  box-shadow: none;
  transition: background-color 0.2s, color 0.2s;
  flex-shrink: 0;
  /* Prevent shrinking in flex container */
}

.theme-toggle-button:hover {
  background-color: var(--color-card-bg);
  color: var(--color-text-primary);
}

.theme-toggle-button:focus {
  outline: none;
  box-shadow: 0 0 0 3px var(--color-button-focus-shadow);
}

.theme-toggle-button svg {
  width: 22px;
  height: 22px;
}

.theme-toggle-button .moon {
  display: none;
}

.theme-toggle-button .sun {
  display: block;
}

body[data-theme="dark"] .theme-toggle-button .moon {
  display: block;
}

body[data-theme="dark"] .theme-toggle-button .sun {
  display: none;
}


.input-method-container {
  width: 100%;
  margin-bottom: 25px;
}

.tabs {
  display: flex;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 20px;
}

.tab-button {
  padding: 10px 20px;
  cursor: pointer;
  border: none;
  background-color: transparent;
  color: var(--color-text-secondary);
  font-size: 16px;
  font-weight: 500;
  border-bottom: 3px solid transparent;
  margin-bottom: -1px;
  /* Overlap with container border */
  transition: color 0.3s ease, border-color 0.3s ease;
}

.tab-button.active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
}

.tab-button:hover:not(.active) {
  background-color: var(--color-card-bg);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

#pdfInputContainer {
  padding: 0;
  border: none;
  border-radius: 0;
  background-color: transparent;
}

.pdf-upload-box {
  text-align: center;
  padding: 20px;
  border: 2px dashed var(--color-border);
  border-radius: 8px;
  background-color: var(--color-card-bg);
}

.file-upload-button {
  background-color: var(--color-surface);
  color: var(--color-primary);
  padding: 12px 20px;
  border-radius: 8px;
  border: 1px solid var(--color-primary);
  cursor: pointer;
  display: inline-block;
  font-weight: 500;
  transition: background-color 0.3s ease;
}

.file-upload-button:hover {
  background-color: var(--color-card-bg);
}

.file-name {
  margin-left: 15px;
  color: var(--color-text-secondary);
  font-style: italic;
}

.text-input-field {
  box-sizing: border-box;
  width: 100%;
  padding: 15px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  font-size: 16px;
  font-family: inherit;
  background-color: var(--color-card-bg);
  color: var(--color-text-primary);
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.text-input-field:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px var(--color-focus-shadow);
}

textarea.text-input-field {
  min-height: 120px;
  resize: vertical;
}

button {
  background-color: var(--color-primary);
  color: var(--color-primary-text);
  padding: 14px 24px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 16px;
  font-weight: 500;
  transition: background-color 0.3s ease, box-shadow 0.2s ease;
  box-shadow: 0 1px 2px var(--color-shadow-2);
}

button:hover {
  background-color: var(--color-primary-hover);
  box-shadow: 0 1px 3px var(--color-shadow-1);
}

button:focus {
  outline: none;
  box-shadow: 0 0 0 3px var(--color-button-focus-shadow);
}

button:disabled {
  background-color: var(--color-disabled-bg);
  color: var(--color-disabled-text);
  cursor: not-allowed;
  box-shadow: none;
}

.error-message {
  color: var(--color-error);
  margin-top: 20px;
  font-weight: 500;
  min-height: 1.5em;
}

footer {
  margin-top: 50px;
  padding-top: 25px;
  border-top: 1px solid var(--color-border);
  color: var(--color-text-secondary);
  font-size: 0.9em;
}

/* Download Area Styles */
#downloadArea {
  margin-top: 25px;
  padding-top: 25px;
  border-top: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
  width: 100%;
}

#downloadArea[hidden] {
  display: none;
}

.download-buttons-container {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 15px;
}

#downloadArea button {
  background-color: var(--color-success);
  color: var(--color-success-text);
}

#downloadArea button:hover {
  background-color: var(--color-success-hover);
}

/* Modal Styles */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.6);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  padding: 20px;
  box-sizing: border-box;
}

.modal-overlay[hidden] {
  display: none !important;
}

#globalLoadingOverlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease;
}

#globalLoadingOverlay.active {
  opacity: 1;
  visibility: visible;
}

.loading-content {
  text-align: center;
  color: #fff;
}

.loading-content img {
  width: 180px;
  height: auto;
  margin-bottom: 25px;
}

#loadingDynamicText {
  font-size: 1.05rem;
  opacity: 0.85;
  transition: opacity 0.6s ease;
}

.modal-content {
  background: var(--color-surface);
  padding: 30px;
  border-radius: 12px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
  width: 90%;
  max-width: 500px;
  /* Adjusted max-width for auth modal */
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  text-align: left;
}

.modal-content h2 {
  margin-top: 0;
  color: var(--color-text-primary);
  display: flex;
  align-items: center;
  gap: 10px;
}

#corsErrorModal .modal-content h2 {
  color: var(--color-error);
}

.close-button {
  position: absolute;
  top: 15px;
  right: 15px;
  background: transparent;
  border: none;
  font-size: 2.5rem;
  line-height: 1;
  color: var(--color-text-secondary);
  cursor: pointer;
  padding: 0;
  box-shadow: none;
}



.pdf-upload-box {
  text-align: center;
  padding: 20px;
  border: 2px dashed var(--color-border);
  border-radius: 8px;
  background-color: var(--color-card-bg);
}

.file-upload-button {
  background-color: var(--color-surface);
  color: var(--color-primary);
  padding: 12px 20px;
  border-radius: 8px;
  border: 1px solid var(--color-primary);
  cursor: pointer;
  display: inline-block;
  font-weight: 500;
  transition: background-color 0.3s ease;
}

.file-upload-button:hover {
  background-color: var(--color-card-bg);
}

.file-name {
  margin-left: 15px;
  color: var(--color-text-secondary);
  font-style: italic;
}

.text-input-field {
  box-sizing: border-box;
  width: 100%;
  padding: 15px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  font-size: 16px;
  font-family: inherit;
  background-color: var(--color-card-bg);
  color: var(--color-text-primary);
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.text-input-field:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px var(--color-focus-shadow);
}

textarea.text-input-field {
  min-height: 120px;
  resize: vertical;
}

button {
  background-color: var(--color-primary);
  color: var(--color-primary-text);
  padding: 14px 24px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 16px;
  font-weight: 500;
  transition: background-color 0.3s ease, box-shadow 0.2s ease;
  box-shadow: 0 1px 2px var(--color-shadow-2);
}

button:hover {
  background-color: var(--color-primary-hover);
  box-shadow: 0 1px 3px var(--color-shadow-1);
}

button:focus {
  outline: none;
  box-shadow: 0 0 0 3px var(--color-button-focus-shadow);
}

button:disabled {
  background-color: var(--color-disabled-bg);
  color: var(--color-disabled-text);
  cursor: not-allowed;
  box-shadow: none;
}

.error-message {
  color: var(--color-error);
  margin-top: 20px;
  font-weight: 500;
  min-height: 1.5em;
}

footer {
  margin-top: 50px;
  padding-top: 25px;
  border-top: 1px solid var(--color-border);
  color: var(--color-text-secondary);
  font-size: 0.9em;
}

/* Download Area Styles */
#downloadArea {
  margin-top: 25px;
  padding-top: 25px;
  border-top: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
  width: 100%;
}

#downloadArea[hidden] {
  display: none;
}

.download-buttons-container {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 15px;
}

#downloadArea button {
  background-color: var(--color-success);
  color: var(--color-success-text);
}

#downloadArea button:hover {
  background-color: var(--color-success-hover);
}

/* Modal Styles */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.6);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  padding: 20px;
  box-sizing: border-box;
}

.modal-overlay[hidden] {
  display: none !important;
}

.modal-content {
  background: var(--color-surface);
  padding: 30px;
  border-radius: 12px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
  width: 90%;
  max-width: 500px;
  /* Adjusted max-width for auth modal */
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  text-align: left;
}

.modal-content h2 {
  margin-top: 0;
  color: var(--color-text-primary);
  display: flex;
  align-items: center;
  gap: 10px;
}

#corsErrorModal .modal-content h2 {
  color: var(--color-error);
}

.close-button {
  position: absolute;
  top: 15px;
  right: 15px;
  background: transparent;
  border: none;
  font-size: 2.5rem;
  line-height: 1;
  color: var(--color-text-secondary);
  cursor: pointer;
  padding: 0;
  box-shadow: none;
}

.close-button:hover {
  color: var(--color-text-primary);
  background: transparent;
}

/* Share Modal Redesign */
.share-modal {
  width: 95%;
  max-width: 1000px;
  /* Wider to accommodate side-by-side on desktop */
  max-height: 95vh;
  padding: 0;
  /* Remove default padding, use inner containers */
  display: flex;
  flex-direction: column;
  overflow: hidden;
  /* Manage scroll internally */
}

.share-header {
  padding: 24px 32px 16px;
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
  background-color: var(--color-surface);
}

.share-header h2 {
  margin: 0;
  font-size: 1.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 12px;
}

.share-modal-subtitle {
  margin: 6px 0 0;
  color: var(--color-text-secondary);
  font-size: 0.95rem;
}

.share-body {
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  /* Scrollable content */
  flex: 1;
}

@media (min-width: 768px) {
  .share-body {
    flex-direction: row;
    height: 100%;
    overflow: hidden;
    /* Body doesn't scroll, individual sections do if needed */
  }
}

/* LEFT: Preview Section */
.share-preview-section {
  flex: 1;
  background-color: var(--color-surface-alt);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  min-height: 400px;
  overflow-y: auto;
}

.share-preview-wrapper {
  position: relative;
  width: 100%;
  max-width: 360px;
  /* Max width for phone-like preview */
  aspect-ratio: 9 / 16;
  background: var(--color-card-bg);
  border-radius: 20px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 1px solid var(--color-border);
}

.share-preview-wrapper.is-transparent {
  background-image: linear-gradient(45deg, #e2e8f0 25%, transparent 25%),
    linear-gradient(-45deg, #e2e8f0 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #e2e8f0 75%),
    linear-gradient(-45deg, transparent 75%, #e2e8f0 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0px;
}

.share-preview-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  /* Ensure the generated image fits perfectly */
  display: block;
}

.share-preview-placeholder {
  color: var(--color-text-tertiary);
  font-weight: 500;
  text-align: center;
  padding: 20px;
}

/* RIGHT: Controls Section */
.share-controls-section {
  flex: 1;
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  overflow-y: auto;
  /* Allow scrolling for controls */
  background-color: var(--color-surface);
  max-width: 500px;
  /* Limit width on wide screens */
}

.share-control-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.share-control-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
  color: var(--color-text-tertiary);
}

.share-background-list {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.share-background-option {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid transparent;
  /* Default border */
  padding: 0;
  background-color: transparent;
  background-size: cover;
  background-position: center;
  cursor: pointer;
  box-shadow: 0 2px 5px var(--color-shadow-2);
  transition: transform 0.2s, box-shadow 0.2s;
  position: relative;
  /* For icons */
  display: flex;
  align-items: center;
  justify-content: center;
}

.share-background-option:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 8px var(--color-shadow-1);
}

.share-background-option.is-active {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-focus-shadow);
  transform: scale(1.1);
}

.share-background-option.is-transparent {
  background-image: linear-gradient(45deg, #e2e8f0 25%, transparent 25%),
    linear-gradient(-45deg, #e2e8f0 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #e2e8f0 75%),
    linear-gradient(-45deg, transparent 75%, #e2e8f0 75%);
  background-size: 8px 8px;
  border: 1px solid var(--color-border);
  /* Add visibility for transparent */
}

.share-background-option.is-special {
  background-color: var(--color-surface-alt);
  border: 1px dashed var(--color-border);
  color: var(--color-text-secondary);
}

.share-background-option.is-special svg {
  width: 20px;
  height: 20px;
}

.share-background-option.is-special:hover {
  color: var(--color-primary);
  border-color: var(--color-primary);
}


.share-phrases-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.share-option {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px;
  border-radius: 12px;
  border: 1px solid var(--color-border);
  background: var(--color-surface-alt);
  color: var(--color-text-secondary);
  font-size: 0.9rem;
  cursor: pointer;
  transition: background-color 0.2s, border-color 0.2s;
}

.share-option:hover {
  background-color: var(--color-card-bg);
  border-color: var(--color-text-tertiary);
}

.share-option input {
  margin-top: 3px;
  accent-color: var(--color-primary);
}

.share-option span {
  line-height: 1.4;
}

/* When checked, highlight the box slightly */
.share-option:has(input:checked) {
  border-color: var(--color-primary);
  background-color: var(--color-surface);
  /* Or a very light tint */
  color: var(--color-text-primary);
  box-shadow: 0 0 0 1px var(--color-primary) inset;
}


.share-caption-input {
  width: 100%;
  padding: 14px;
  border-radius: 12px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-primary);
  font-family: inherit;
  font-size: 0.95rem;
  resize: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.share-caption-input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-focus-shadow);
}

.share-modal-submit {
  width: 100%;
  margin-top: 10px;
  /* Space above button */
  border-radius: 12px;
  padding: 16px;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background-color: var(--color-primary);
  color: #fff;
}

.share-modal-submit svg {
  width: 20px;
}

/* Mobile Adjustments */
@media (max-width: 767.98px) {
  .share-modal {
    height: 100%;
    max-height: 100%;
    width: 100%;
    max-width: 100%;
    border-radius: 0;
  }

  .share-header {
    padding: 16px;
  }

  .share-preview-section {
    padding: 24px 16px;
    min-height: auto;
    /* Let it shrink if needed */
    flex: 0 0 auto;
    /* Don't grow too much on mobile */
  }

  .share-preview-wrapper {
    max-width: 220px;
    /* Smaller preview on mobile */
  }

  .share-controls-section {
    padding: 24px 16px;
    flex: 1;
    /* Take remaining space */
  }
}

.auth-error {
  min-height: 18px;
  color: var(--color-error);
  font-size: 0.85rem;
  margin: 4px 0 12px;
}

.email-login-container .auth-label,
#passwordResetModal .auth-label {
  display: block;
  margin: 10px 0 6px;
}

.email-login-container .auth-input,
#passwordResetModal .auth-input {
  display: block;
  width: 100%;
}

.auth-input.is-invalid {
  border-color: var(--color-error);
  box-shadow: 0 0 0 2px rgba(217, 48, 37, 0.18);
}

.auth-input.is-invalid:focus {
  border-color: var(--color-error);
  box-shadow: 0 0 0 2px rgba(217, 48, 37, 0.28);
}

.auth-submit-button {
  width: 100%;
  padding: 12px 16px;
  border-radius: 10px;
  border: 1px solid var(--color-primary);
  background: var(--color-primary);
  color: var(--color-primary-text);
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s, box-shadow 0.2s, border-color 0.2s;
}

.auth-submit-button:hover {
  background: var(--color-primary-hover);
  border-color: var(--color-primary-hover);
  box-shadow: 0 2px 6px var(--color-shadow-1);
}

.mode-selector {
  margin: 20px 0 24px;
  text-align: left;
  padding: 16px;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  background: var(--color-card-bg);
}

.mode-selector h3 {
  margin: 0 0 8px;
  font-size: 1.1rem;
  color: var(--color-text-primary);
}

.mode-hint {
  margin: 0 0 16px;
  font-size: 0.9rem;
  color: var(--color-text-secondary);
}

.mode-checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  color: var(--color-text-primary);
}

.mode-note {
  font-size: 0.85rem;
  color: var(--color-text-secondary);
}

.mode-total {
  margin-top: 12px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  font-weight: 600;
  color: var(--color-text-primary);
}


.mode-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px dashed var(--color-border);
}

.mode-row:last-child {
  border-bottom: none;
}

.mode-label {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.mode-input {
  width: 72px;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-primary);
  text-align: right;
}

.mode-input:disabled {
  background: var(--color-disabled-bg);
  color: var(--color-disabled-text);
}


.flashcards-container {
  margin-top: 32px;
}

.flashcard-carousel {
  --card-width: min(85vw, 320px);
  --card-height: min(420px, calc(var(--card-width) * 1.4));
  --side-offset: calc(var(--card-width) * 0.5);
  --side-scale: 0.7;
  --side-opacity: 0.6;
  --side-blur: 3px;
  --depth: 220px;
  --flashcard-bg: var(--color-surface);
  --flashcard-border: var(--color-border);
  --flashcard-text: var(--color-text-primary);
  --flashcard-muted: var(--color-text-secondary);
  --flashcard-accent: var(--color-primary);
  --flashcard-button-text: var(--color-primary-text);
  --flashcard-surface: var(--color-card-bg);
  --flashcard-shadow: 0 14px 24px rgba(15, 23, 42, 0.18);
  background: var(--color-surface);
  border-radius: 18px;
  padding: 18px 0 28px;
  position: relative;
  overflow: hidden;
}

body[data-theme="dark"] .flashcard-carousel {
  --flashcard-bg: #1f242a;
  --flashcard-border: rgba(255, 255, 255, 0.08);
  --flashcard-text: #e5e7eb;
  --flashcard-muted: #a1a1aa;
  --flashcard-accent: #6ea8ff;
  --flashcard-button-text: #0b1220;
  --flashcard-surface: #1b1f24;
}

@media (max-width: 720px) {
  .flashcard-carousel {
    --side-offset: calc(var(--card-width) * 0.7);
    --side-scale: 0.78;
  }
}

@media (min-width: 768px) {
  .flashcard-carousel {
    --card-width: clamp(280px, 30vw, 320px);
  }
}

@media (min-width: 992px) {
  .col-lg-20 {
    flex: 0 0 auto;
    width: 100%;
    max-width: 100%;
  }
}

.flashcard-stage {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 16px 0;
  overflow: hidden;
  touch-action: pan-y;
  width: 100%;
  max-width: 100%;
  padding-left: 24px;
  padding-right: 24px;
  margin: 0 auto;
}

.flashcard-selector {
  position: relative;
  width: 100%;
  max-width: 100%;
  height: var(--card-height);
  margin: 0 auto;
  perspective: 1400px;
}

.flashcard-card {
  position: absolute;
  left: 50%;
  top: 50%;
  width: var(--card-width);
  height: var(--card-height);
  transform-style: preserve-3d;
  transform: translate(-50%, -50%) translateZ(-240px) scale(0.6);
  opacity: 0;
  transition: transform 0.7s cubic-bezier(0.22, 0.61, 0.36, 1), opacity 0.5s ease, filter 0.5s ease;
  pointer-events: none;
  will-change: transform, opacity, filter;
}

.flashcard-card.is-active {
  transform: translate(-50%, -50%) translateZ(0) scale(1);
  opacity: 1;
  filter: blur(0);
  z-index: 3;
  pointer-events: auto;
}

.flashcard-card.is-prev {
  transform: translate(-50%, -50%) translateX(calc(-1 * var(--side-offset))) rotateY(14deg) translateZ(calc(-1 * var(--depth))) scale(var(--side-scale));
  opacity: var(--side-opacity);
  transform-origin: 80% 50%;
  z-index: 2;
}

.flashcard-card.is-next {
  transform: translate(-50%, -50%) translateX(var(--side-offset)) rotateY(-14deg) translateZ(calc(-1 * var(--depth))) scale(var(--side-scale));
  opacity: var(--side-opacity);
  transform-origin: 20% 50%;
  z-index: 2;
}

.flashcard-card.is-hidden {
  opacity: 0;
  pointer-events: none;
}

.flashcard-card.is-prev .flashcard-face,
.flashcard-card.is-next .flashcard-face {
  filter: blur(var(--side-blur));
}

.flashcard-3d {
  position: relative;
  height: 100%;
  perspective: 1200px;
  z-index: 1;
}

.flashcard-inner {
  position: relative;
  height: 100%;
  width: 100%;
  transform-style: preserve-3d;
  transition: transform 0.6s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.flashcard-card.is-flipped .flashcard-inner {
  transform: rotateY(180deg);
}

.flashcard-face {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px 18px 64px;
  border-radius: 18px;
  background: var(--flashcard-bg);
  border: 1px solid var(--flashcard-border);
  color: var(--flashcard-text);
  box-shadow: var(--flashcard-shadow);
  backface-visibility: hidden;
}

.flashcard-card.is-active .flashcard-face {
  box-shadow: 0 18px 32px rgba(15, 23, 42, 0.24);
}

.flashcard-back {
  transform: rotateY(180deg);
  background: var(--flashcard-surface);
}

.flashcard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.flashcard-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--flashcard-muted);
}

.flashcard-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  padding-right: 4px;
  flex: 1;
}

.flashcard-badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(110, 168, 255, 0.15);
  color: var(--flashcard-accent);
}

.flashcard-badge.badge-certo {
  background: rgba(46, 204, 113, 0.16);
  color: #1a7f37;
}

.flashcard-badge.badge-errado {
  background: rgba(239, 68, 68, 0.18);
  color: #b42318;
}

.flashcard-badge.badge-direta {
  background: rgba(245, 158, 11, 0.16);
  color: #b26a00;
}

.flashcard-badge.badge-omissao {
  background: rgba(148, 163, 184, 0.18);
  color: var(--flashcard-muted);
}

body[data-theme="dark"] .flashcard-badge.badge-certo {
  color: #81c995;
}

body[data-theme="dark"] .flashcard-badge.badge-errado {
  color: #f28b82;
}

.flashcard-question {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--flashcard-text);
  line-height: 1.5;
  word-break: break-word;
}

.flashcard-answer-label {
  display: block;
  margin-top: 8px;
}

.flashcard-answer {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--flashcard-muted);
}

.flashcard-options {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 8px;
}

.flashcard-option {
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid var(--flashcard-border);
  background: rgba(15, 23, 42, 0.06);
  color: var(--flashcard-text);
  font-size: 0.95rem;
}

body[data-theme="dark"] .flashcard-option {
  background: rgba(2, 6, 23, 0.4);
}

.flashcard-option.is-correct {
  border-color: rgba(46, 204, 113, 0.6);
  background: rgba(46, 204, 113, 0.15);
  color: #1a7f37;
  font-weight: 600;
}

body[data-theme="dark"] .flashcard-option.is-correct {
  color: #81c995;
}

.flashcard-controls {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 14px;
  display: flex;
  justify-content: center;
  z-index: 2;
}

.flashcard-toggle {
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: var(--flashcard-accent);
  color: var(--flashcard-button-text);
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
  box-shadow: 0 10px 20px rgba(15, 23, 42, 0.2);
}

.flashcard-toggle:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 18px rgba(110, 168, 255, 0.35);
  filter: brightness(1.05);
}

.flashcard-toggle:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(110, 168, 255, 0.3);
}

.carousel-nav {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 12px;
  pointer-events: none;
  transform: translateY(-50%);
}

.carousel-arrow {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(15, 23, 42, 0.45);
  color: var(--flashcard-text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  cursor: pointer;
  opacity: 0.65;
  transition: transform 0.2s ease, opacity 0.2s ease, box-shadow 0.2s ease;
  pointer-events: auto;
}

body[data-theme="light"] .carousel-arrow {
  background: rgba(255, 255, 255, 0.8);
  border-color: var(--flashcard-border);
  color: var(--flashcard-text);
}

.carousel-arrow:hover {
  opacity: 1;
  transform: scale(1.05);
  box-shadow: 0 0 16px rgba(110, 168, 255, 0.35);
}

.carousel-arrow:disabled {
  opacity: 0;
  pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {

  .flashcard-card,
  .flashcard-inner,
  .flashcard-toggle,
  .carousel-arrow {
    transition: none;
  }
}

.daily-limit-info {
  margin: 16px 0 20px;
  padding: 16px 20px;
  border-radius: 12px;
  text-align: left;
  line-height: 1.5;
  background: var(--color-card-bg);
  color: var(--color-text-secondary);
  border: 1px solid var(--color-border);
}

.daily-limit-title {
  margin: 0 0 6px;
  font-size: 1rem;
  font-weight: 700;
  color: inherit;
}

.daily-limit-subtitle {
  margin: 0 0 12px;
  font-size: 0.95rem;
  color: inherit;
}

body[data-theme="dark"] .daily-limit-info {
  background: #3c4043;
  color: var(--color-text-secondary);
  border-color: var(--color-border);
}

body[data-theme="light"] .daily-limit-info.is-reached {
  background: linear-gradient(135deg, #fde6e6 0%, #fff3f3 100%);
  border: 1px dashed #f3b4b4;
  color: #c13b3b;
}

body[data-theme="dark"] .daily-limit-info.is-reached {
  background: linear-gradient(135deg, #3a2a00 0%, #4a3800 100%);
  border: 1px solid #f3c26b;
  color: #ffe7b0;
}

/* PDF trial alert (match provided light/dark prints) */
.pdf-trial-alert {
  display: block;
  padding: 16px 20px;
  margin-bottom: 16px;
  border-radius: 12px;
  text-align: left;
  line-height: 1.5;
}

.pdf-trial-alert__title {
  margin: 0 0 8px;
  font-size: 1rem;
  font-weight: 700;
  color: inherit;
}

.pdf-trial-alert__description {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.6;
  color: inherit;
}

.pdf-trial-alert__description strong {
  font-weight: 700;
}

/* Light mode: red/pink warning */
body[data-theme="light"] .pdf-trial-alert {
  background: linear-gradient(135deg, #fde6e6 0%, #fff3f3 100%);
  border: 1px dashed #f3b4b4;
  color: #c13b3b;
}

body[data-theme="light"] .pdf-trial-alert__title {
  color: #d04444;
}

body[data-theme="light"] .pdf-trial-alert__description {
  color: #c13b3b;
}

body[data-theme="light"] .pdf-trial-alert__description strong {
  color: #a52a2a;
}

/* Dark mode: yellow/orange warning */
body[data-theme="dark"] .pdf-trial-alert {
  background: linear-gradient(135deg, #3a2a00 0%, #4a3800 100%);
  border: 1px solid #f3c26b;
  color: #ffe7b0;
}

body[data-theme="dark"] .pdf-trial-alert__title {
  color: #ffe08a;
}

body[data-theme="dark"] .pdf-trial-alert__description {
  color: #ffe7b0;
}

body[data-theme="dark"] .pdf-trial-alert__description strong {
  color: #fff4c7;
  font-weight: 700;
}

.ankigen-menu-shell {
  --ankigen-menu-width: 240px;
  --ankigen-menu-offset: 18px;
  --ankigen-menu-bg: #f7f8fb;
  --ankigen-menu-border: #e3e7f0;
  --ankigen-menu-text: #1f2937;
  --ankigen-menu-muted: #6b7280;
  --ankigen-menu-text-strong: #111827;
  --ankigen-menu-hover: #e9ecef;
  --ankigen-menu-active: #dee2e6;
  --ankigen-menu-control-bg: #ffffff;
  --ankigen-menu-shadow: 0 12px 28px rgba(15, 23, 42, 0.12);
  --ankigen-menu-radius: 18px;
  position: relative;
}

body[data-theme="dark"] .ankigen-menu-shell {
  --ankigen-menu-bg: #1e1f23;
  --ankigen-menu-border: #2a2b30;
  --ankigen-menu-text: #cfd3dc;
  --ankigen-menu-muted: #9aa0ac;
  --ankigen-menu-text-strong: #ffffff;
  --ankigen-menu-hover: #2a2d33;
  --ankigen-menu-active: #31343b;
  --ankigen-menu-control-bg: #23262d;
  --ankigen-menu-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
}

.ankigen-menu {
  position: fixed;
  top: 0;
  left: var(--ankigen-menu-offset);
  height: 100vh;
  width: var(--ankigen-menu-width);
  background: var(--ankigen-menu-bg);
  border: 1px solid var(--ankigen-menu-border);
  border-radius: var(--ankigen-menu-radius);
  box-shadow: var(--ankigen-menu-shadow);
  color: var(--ankigen-menu-text);
  overflow: hidden;
  z-index: 1035;
  transition: transform 0.28s ease, opacity 0.2s ease;
}

.ankigen-menu-panel {
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 20px 16px 18px;
  gap: 16px;
  overflow: hidden;
}

.ankigen-menu-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.ankigen-menu-brand {
  font-weight: 600;
  letter-spacing: 0.2px;
}

.ankigen-menu-collapse {
  border: 1px solid var(--ankigen-menu-border);
  background: var(--ankigen-menu-control-bg);
  color: var(--ankigen-menu-muted);
  border-radius: 10px;
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.ankigen-menu-collapse-icon {
  width: 18px;
  height: 18px;
}

.ankigen-menu-user {
  font-size: 0.82rem;
  color: var(--ankigen-menu-muted);
  word-break: break-word;
}

.ankigen-saved-time-widget {
  display: grid;
  gap: 10px;
  padding: 12px;
  border-radius: 14px;
  background: var(--ankigen-menu-control-bg);
  border: 1px solid var(--ankigen-menu-border);
}

.saved-time-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ankigen-menu-muted);
}

.saved-time-periods {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.saved-time-period {
  border: 1px solid var(--ankigen-menu-border);
  background: transparent;
  color: var(--ankigen-menu-muted);
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: none;
}

.saved-time-period.is-active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: var(--color-primary-text);
}

.saved-time-period:focus {
  outline: none;
  box-shadow: 0 0 0 3px var(--color-focus-shadow);
}

.saved-time-value {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--ankigen-menu-text-strong);
}

.saved-time-delta {
  font-size: 0.85rem;
  color: var(--ankigen-menu-muted);
  min-height: 1.2em;
  display: flex;
  align-items: center;
  gap: 6px;
}

.saved-time-delta .delta-arrow {
  font-weight: 900;
  font-size: 1rem;
}

.saved-time-delta .delta-value {
  font-weight: 700;
}

.saved-time-delta.is-positive {
  color: var(--color-success);
}

.saved-time-delta.is-positive .delta-arrow,
.saved-time-delta.is-positive .delta-value {
  color: var(--color-success);
}

.saved-time-delta.is-negative {
  color: var(--color-error);
}

.saved-time-delta.is-negative .delta-arrow,
.saved-time-delta.is-negative .delta-value {
  color: var(--color-error);
}

.saved-time-share {
  border: 1px solid var(--color-primary);
  background: var(--color-primary);
  color: var(--color-primary-text);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: none;
}

.saved-time-share:hover {
  background: var(--color-primary-hover);
  border-color: var(--color-primary-hover);
}

.ankigen-menu-links {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 14px;
  min-height: 0;
  overflow-y: auto;
  padding-right: 2px;
}

.ankigen-menu-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ankigen-menu-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ankigen-menu-muted);
  margin: 0;
}

.ankigen-menu-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  border-radius: 12px;
  color: var(--ankigen-menu-text);
  text-decoration: none;
  font-size: 0.9rem;
  line-height: 1.2;
}

.ankigen-menu-link:hover,
.ankigen-menu-link:focus {
  background: var(--ankigen-menu-hover);
  color: var(--ankigen-menu-text-strong);
}

.ankigen-menu-link.active,
.ankigen-menu-link.is-active,
.ankigen-menu-link[aria-current="page"] {
  background: var(--ankigen-menu-active);
  color: var(--ankigen-menu-text-strong);
}

.ankigen-menu-link:hover .ankigen-menu-icon,
.ankigen-menu-link:focus .ankigen-menu-icon,
.ankigen-menu-link.active .ankigen-menu-icon,
.ankigen-menu-link.is-active .ankigen-menu-icon,
.ankigen-menu-link[aria-current="page"] .ankigen-menu-icon {
  color: var(--ankigen-menu-text-strong);
}

.ankigen-menu-icon {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ankigen-menu-muted);
}

.ankigen-menu-icon svg {
  width: 18px;
  height: 18px;
}

.ankigen-menu-logout {
  margin-top: auto;
  border: 1px solid #f1b3b3;
  background: #ffffff;
  color: #b42318;
  font-weight: 600;
  border-radius: 12px;
  padding: 10px 12px;
  cursor: pointer;
}

body[data-theme="dark"] .ankigen-menu-logout {
  border: 1px solid #dc3545;
  background: transparent;
  color: #dc3545;
}

body[data-theme="dark"] .ankigen-menu-logout:hover,
body[data-theme="dark"] .ankigen-menu-logout:focus {
  background: #dc3545;
  color: #ffffff;
}

.ankigen-menu-toggle {
  position: fixed;
  top: 50%;
  left: calc(var(--ankigen-menu-offset) + var(--ankigen-menu-width) - 14px);
  transform: translateY(-50%);
  width: 46px;
  height: 72px;
  border-radius: 16px;
  border: 1px solid var(--ankigen-menu-border);
  background: var(--ankigen-menu-control-bg);
  box-shadow: var(--ankigen-menu-shadow);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 1040;
}

.ankigen-menu-toggle-icon {
  font-size: 20px;
  color: var(--ankigen-menu-muted);
}

.ankigen-menu-shell.ankigen-menu-expanded .ankigen-menu-toggle-icon {
  transform: rotate(180deg);
}

.ankigen-menu-shell.ankigen-menu-collapsed .ankigen-menu-toggle {
  left: 12px;
}

.ankigen-menu-shell.ankigen-menu-collapsed .ankigen-menu {
  transform: translateX(calc(-100% - var(--ankigen-menu-offset)));
  opacity: 0;
  pointer-events: none;
}

.ankigen-menu-shell.ankigen-menu-expanded .ankigen-menu {
  transform: translateX(0);
  opacity: 1;
  pointer-events: auto;
}

.ankigen-menu-content {
  margin-left: calc(var(--ankigen-menu-width) + var(--ankigen-menu-offset) + 24px);
  padding: calc(var(--ankigen-topbar-height) + 24px) 24px 24px;
  min-height: 100vh;
  transition: margin-left 0.28s ease;
}

body[data-authenticated="false"] .ankigen-menu-content {
  margin-left: 0;
}

.ankigen-menu-shell.ankigen-menu-collapsed .ankigen-menu-content {
  margin-left: 0;
}

body[data-auth-state="pending"] .ankigen-menu,
body[data-auth-state="pending"] .ankigen-menu-toggle {
  visibility: hidden;
}

body[data-auth-state="pending"] #topbar,
body[data-auth-state="pending"] .ankigen-menu-content {
  visibility: hidden;
}

@media (max-width: 767.98px) {
  .ankigen-menu {
    left: 0;
    width: min(var(--ankigen-menu-width), 82vw);
    border-radius: 0 var(--ankigen-menu-radius) var(--ankigen-menu-radius) 0;
  }

  .ankigen-menu-content {
    margin-left: 0;
    padding: calc(var(--ankigen-topbar-height) + 16px) 16px 24px;
  }

  .ankigen-menu-shell.ankigen-menu-expanded .ankigen-menu {
    box-shadow: 0 18px 32px rgba(15, 23, 42, 0.2);
  }
}
/* Dark-mode readability overrides */
body[data-theme="dark"] a {
  color: #93C5FD;
}

body[data-theme="dark"] a:hover,
body[data-theme="dark"] a:focus-visible {
  color: #BFDBFE;
}

body[data-theme="dark"] .text-muted,
body[data-theme="dark"] small,
body[data-theme="dark"] .form-text {
  color: #9CA3AF !important;
}

body[data-theme="dark"] .modal-content {
  color: var(--color-text-primary);
}

/* Navbar button contrast in dark mode */
body[data-theme="dark"] .topbar .topbar-btn-primary,
body[data-theme="dark"] .topbar .topbar-btn-primary.topbar-auth-only,
body[data-theme="dark"] .navbar .btn-primary,
body[data-theme="dark"] .navbar .btn-info,
body[data-theme="dark"] .navbar .btn-action {
  color: var(--color-primary-text);
}

/* ===============================
   DARK MODE — BUTTON TEXT FIX
   =============================== */

body[data-theme="dark"] .btn-primary,
body[data-theme="dark"] .btn-info,
body[data-theme="dark"] .btn-action {
  color: #0F172A;
}

body[data-theme="dark"] .btn-primary:hover,
body[data-theme="dark"] .btn-info:hover,
body[data-theme="dark"] .btn-action:hover {
  color: #0F172A;
}

/* Navbar publico - Botoes modernos */

.nav-public .nav-btn {
  padding: 6px 14px;
  border-radius: 8px;
  border: 1px solid var(--color-border);
  background-color: transparent;
  font-weight: 500;
  transition: all 0.2s ease;
}

.nav-public .nav-btn:hover {
  background-color: var(--color-surface-alt);
}

.nav-public {
  position: relative;
  z-index: 1000;
}

.nav-public .navbar-toggler {
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 6px 10px;
}

.nav-public .navbar-toggler:focus {
  box-shadow: 0 0 0 3px var(--color-focus-shadow);
}

.nav-public .navbar-toggler-icon {
  width: 1.2em;
  height: 1.2em;
}

/* Navbar publico - remover sublinhado do logo */

.nav-public .navbar-brand {
  text-decoration: none !important;
}

.nav-public .navbar-brand:hover {
  text-decoration: none !important;
}

/* === Navbar Mobile - Correcao Icone Hamburger Dark Mode === */

body[data-theme="dark"] .navbar-toggler-icon {
  filter: invert(1) brightness(1.8);
}

/* Estado ativo do hamburger */

.navbar-toggler[aria-expanded="true"] {
  border-color: var(--color-primary);
}

@media (max-width: 991.98px) {
  .nav-public {
    position: relative;
  }

  .nav-public .navbar-collapse {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 10px;
    padding: 8px;
    min-width: 220px;
    z-index: 1100;
  }

  .nav-public #topbarLoggedOut {
    width: 100%;
  }

  .nav-public .nav-btn {
    width: 100%;
    text-align: left;
  }
}

/* === FAQ Accordion Integrado ao Sistema de Tema === */

.accordion-item {
  background-color: var(--color-card-bg);
  border: 1px solid var(--color-border);
}

.accordion-button {
  background-color: var(--color-surface);
  color: var(--color-text-primary);
}

.accordion-button:not(.collapsed) {
  background-color: var(--color-surface-alt);
  color: var(--color-text-primary);
  box-shadow: none;
}

.accordion-body {
  background-color: var(--color-card-bg);
  color: var(--color-text-secondary);
}

.accordion-button::after {
  filter: brightness(0.8);
}

