/* ===========================
   ANKI FLOW - MINIMAL PREMIUM DARK MODE
   Inspired by Linear.app, Vercel, Raycast
   =========================== */

:root {
  /* Core Colors (Proper Dark Grays, not pure black) */
  --bg-base: #0a0a0c;
  --bg-surface: #111113;
  --bg-elevated: #19191c;
  --bg-hover: #232326;
  --bg-surface-2: #1a1a1e;
  --bg-main: #0f0f11;
  --border-color: rgba(255, 255, 255, 0.08);

  /* Borders (Very subtle) */
  --border-subtle: rgba(255, 255, 255, 0.06);
  --border-default: rgba(255, 255, 255, 0.1);
  --border-focus: rgba(255, 255, 255, 0.2);

  /* Text */
  --text-primary: #ededef;
  --text-secondary: #a8a8aa;
  --text-tertiary: #8a8a8c;

  /* Accent */
  --accent: #818cf8; /* Indigo - AA accessible on dark bg */
  --accent-hover: #a5b4fc;
  --accent-glow: rgba(99, 102, 241, 0.3);

  /* Status */
  --danger: #ef4444;
  --warning: #fbbf24;
  --success: #22c55e;

  /* Layout */
  --sidebar-width: 240px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --card-font-size: 32px;

  /* Transitions (Micro-animations) */
  --transition-fast: 0.1s ease;
  --transition-normal: 0.2s ease;
  --transition-slow: 0.3s ease;
}

/* LIGHT MODE */
[data-theme="light"] {
  --bg-base: #ffffff;
  --bg-surface: #f9fafb;
  --bg-elevated: #ffffff;
  --bg-hover: #f3f4f6;
  --bg-surface-2: #f5f5f7;
  --bg-main: #fafafa;
  --border-color: rgba(0, 0, 0, 0.08);
  --border-subtle: rgba(0, 0, 0, 0.06);
  --border-default: rgba(0, 0, 0, 0.1);
  --border-focus: rgba(0, 0, 0, 0.2);
  --text-primary: #111827;
  --text-secondary: #6b7280;
  --text-tertiary: #9ca3af;
  --accent: #6366f1;
  --accent-hover: #818cf8;
  --accent-glow: rgba(99, 102, 241, 0.2);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ===========================
   ACCESSIBILITY
   =========================== */

/* Skip to main content link */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--accent);
  color: white;
  padding: 8px 16px;
  text-decoration: none;
  border-radius: var(--radius-sm);
  z-index: 9999;
  font-weight: 500;
}

.skip-link:focus {
  top: 8px;
  left: 8px;
}

/* Screen reader only text */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* Focus visible - show focus ring only for keyboard navigation */
*:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

*:focus:not(:focus-visible) {
  outline: none;
}

/* Enhanced focus for interactive elements */
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
.nav-tab:focus-visible,
.deck-item:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px var(--accent-glow);
}

/* Prevent ion-icon from intercepting touch/click events inside interactive elements */
button ion-icon,
a ion-icon,
.deck-item ion-icon,
.nav-tab ion-icon,
.icon-btn ion-icon,
.action-btn ion-icon,
.hamburger-btn ion-icon,
.sidebar-close-btn ion-icon,
.sidebar-trash-btn ion-icon,
.rating-btn ion-icon,
.md-btn ion-icon {
  pointer-events: none;
}

/* Eliminate 300ms tap delay on all interactive elements for mobile */
button,
a,
input,
select,
textarea,
.nav-tab,
.deck-item,
.action-btn,
.icon-btn,
.hamburger-btn,
.sidebar-close-btn {
  touch-action: manipulation;
}

/* Typography */
body {
  font-family:
    "Inter",
    -apple-system,
    BlinkMacSystemFont,
    sans-serif;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.5;
  background-color: var(--bg-base);
  color: var(--text-primary);
  height: 100vh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Minimal Background (Subtle gradient, no blobs) */
.app-background {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  background:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(99, 102, 241, 0.15), transparent),
    var(--bg-base);
}

/* ===========================
   LAYOUT
   =========================== */
.app-container {
  display: flex;
  height: 100vh;
}

/* ===========================
   SIDEBAR
   =========================== */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-surface);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  padding: 16px 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  margin-bottom: 20px;
  font-weight: 600;
  font-size: 15px;
  color: var(--text-primary);
}

.brand ion-icon {
  font-size: 20px;
  color: var(--accent);
}

/* Sidebar Sections */
.sidebar-section {
  flex: 1;
  overflow-y: auto;
}

.sidebar-section h3 {
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-tertiary);
  padding: 8px 12px 6px;
  margin-bottom: 4px;
}

/* Deck List */
.deck-list {
  list-style: none;
}

.deck-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition:
    background var(--transition-fast),
    transform var(--transition-fast);
  color: var(--text-secondary);
  font-size: 13px;
}

.deck-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.deck-item:active {
  transform: scale(0.98);
}

.deck-item.active {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

.deck-item ion-icon {
  font-size: 16px;
  opacity: 0.7;
}

/* Delete/Restore Buttons in Deck Items */
.delete-btn,
.restore-btn {
  opacity: 0;
  transition: opacity var(--transition-fast);
  color: var(--text-tertiary);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
}

.deck-item:hover .delete-btn,
.deck-item:hover .restore-btn {
  opacity: 1;
}

/* Due Cards Badge */
.due-badge {
  margin-left: auto;
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: white;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 12px;
  min-width: 20px;
  text-align: center;
  box-shadow: 0 2px 4px rgba(239, 68, 68, 0.3);
  animation: pulse-badge 2s ease-in-out infinite;
}

@keyframes pulse-badge {
  0%,
  100% {
    transform: scale(1);
    box-shadow: 0 2px 4px rgba(239, 68, 68, 0.3);
  }
  50% {
    transform: scale(1.05);
    box-shadow: 0 3px 8px rgba(239, 68, 68, 0.5);
  }
}

.delete-btn:hover {
  color: var(--danger);
}
.restore-btn:hover {
  color: var(--success);
}

/* New Deck Button */
.new-deck-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 12px;
  margin-top: 8px;
  background: transparent;
  border: 1px dashed var(--border-default);
  border-radius: var(--radius-sm);
  color: var(--text-tertiary);
  font-size: 13px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.new-deck-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(99, 102, 241, 0.05);
}

/* Sidebar Footer */
.sidebar-footer {
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
  margin-top: auto;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-tertiary);
  padding: 4px 12px;
}

.status-indicator .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
}

.status-indicator.online .dot {
  background: var(--success);
  box-shadow: 0 0 6px var(--success);
}

.sidebar-trash-btn,
.sidebar-theme-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 8px;
  background: transparent;
  border: none;
  color: var(--text-tertiary);
  font-size: 12px;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.sidebar-trash-btn:hover,
.sidebar-theme-btn:hover {
  background: var(--bg-hover);
  color: var(--text-secondary);
}

/* ===========================
   MAIN CONTENT
   =========================== */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Top Bar (Omnibar) */
.top-bar {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border-subtle);
}

/* Tab Navigation */
.tab-navigation {
  display: flex;
  gap: 4px;
  padding: 12px 24px 0;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border-subtle);
}

.nav-tab {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.nav-tab ion-icon {
  font-size: 18px;
}

.nav-tab:hover {
  color: var(--text-primary);
  background: var(--bg-surface);
  border-radius: 8px 8px 0 0;
}

.nav-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.nav-tab.active ion-icon {
  color: var(--accent);
}

/* View Containers */
.view-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: auto;
}

.view-container.hidden {
  display: none !important;
}

.omnibar-container {
  position: relative; /* CRITICAL: For command-dropdown positioning */
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 10px 16px;
  transition:
    border-color var(--transition-fast),
    box-shadow var(--transition-fast);
}

.omnibar-container:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.omnibar-container.modal-active {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.omnibar-icon {
  color: var(--text-tertiary);
  font-size: 18px;
  cursor: pointer;
  transition: color var(--transition-fast);
}

.omnibar-icon:hover {
  color: var(--accent);
}

.omnibar-icon.clickable {
  cursor: pointer;
  border-radius: var(--radius-sm);
  padding: 4px;
  transition: all var(--transition-fast);
}

.omnibar-icon.clickable:hover {
  background: var(--bg-hover);
  color: var(--accent);
}

#omnibarInput {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
}

#omnibarInput::placeholder {
  color: var(--text-tertiary);
}

.omnibar-actions {
  display: flex;
  gap: 8px;
}

.key-hint {
  font-size: 10px;
  font-weight: 500;
  color: var(--text-tertiary);
  background: var(--bg-elevated);
  padding: 3px 6px;
  border-radius: 4px;
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: all var(--transition-fast);
  user-select: none;
}

.key-hint:hover {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
  transform: scale(1.05);
}

/* Command Dropdown */
.command-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 8px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  max-height: 300px;
  overflow-y: auto;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  z-index: 100;
}

.command-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  cursor: pointer;
  transition: background var(--transition-fast);
  color: var(--text-secondary);
}

.command-item:hover,
.command-item.active {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.command-item ion-icon {
  font-size: 18px;
  color: var(--accent);
}

/* Omnibar Overlay (for modal mode) */
.omnibar-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  z-index: 50;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-normal);
}

.omnibar-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

/* ===========================
   WORKSPACE
   =========================== */
.workspace {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
}

.deck-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.deck-header h1 {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
}

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

.deck-stats {
  display: flex;
  gap: 8px;
}

.stat-badge {
  font-size: 12px;
  padding: 4px 10px;
  background: var(--bg-elevated);
  border-radius: 20px;
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
}

.stat-badge.warning {
  color: var(--warning);
  border-color: rgba(245, 158, 11, 0.3);
  background: rgba(245, 158, 11, 0.1);
}

/* Search Container */
.search-container {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  max-width: 300px;
  transition:
    border-color var(--transition-fast),
    box-shadow var(--transition-fast);
}

.search-container:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

.search-icon {
  font-size: 16px;
  color: var(--text-tertiary);
}

#searchInput {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 13px;
  font-family: inherit;
}

#searchInput::placeholder {
  color: var(--text-tertiary);
}

.search-clear {
  padding: 2px;
  background: transparent;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  border-radius: 4px;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
}

.search-clear:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.search-clear ion-icon {
  font-size: 16px;
}

/* Table */
.table-container {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow-y: auto;
  max-height: calc(100vh - 180px); /* Enable internal scrolling */
  position: relative;
}

.live-table {
  width: 100%;
  border-collapse: collapse;
}

.live-table th {
  text-align: left;
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-tertiary);
  padding: 12px 16px;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border-subtle);
}

.live-table td {
  padding: 8px 16px;
  border-bottom: 1px solid var(--border-subtle);
}

.live-table tr:last-child td {
  border-bottom: none;
}

.live-table tr:hover {
  background: var(--bg-hover);
}

.live-table tr.row-error {
  background: rgba(239, 68, 68, 0.1);
}

.live-table tr.row-warning {
  background: rgba(245, 158, 11, 0.1);
}

.live-table tr.row-issue {
  background: rgba(245, 158, 11, 0.08);
  border-left: 3px solid #f59e0b;
}

.live-table tr.row-issue:hover {
  background: rgba(245, 158, 11, 0.15);
}

/* Editable Cells */
.editable-cell {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  transition: background var(--transition-fast);
}

.editable-cell:hover {
  background: var(--bg-elevated);
}

.editable-cell:focus {
  background: var(--bg-elevated);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-tertiary);
}

.empty-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.empty-content ion-icon {
  font-size: 48px;
  opacity: 0.3;
}

.empty-content p {
  font-size: 14px;
}

/* ===========================
   ACTION BAR
   =========================== */
.action-bar {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px 24px;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-surface);
}

/* Buttons */
.action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  border: none;
}

.action-btn:active {
  transform: scale(0.97);
}

.action-btn.primary {
  background: #6366f1;
  color: white;
}

.action-btn.primary:hover {
  background: var(--accent-hover);
}

.action-btn.secondary {
  background: var(--bg-elevated);
  color: var(--text-secondary);
  border: 1px solid var(--border-default);
}

.action-btn.secondary:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border-focus);
}

/* ===========================
   MODALS
   =========================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.4);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 1;
  transition: opacity var(--transition-normal);
}

.modal-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.modal-glass {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: 24px;
  min-width: 400px;
  max-width: 90vw;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.15);
  animation: modalEnter 0.2s ease-out;
}

@keyframes modalEnter {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(-10px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.modal-glass h2 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 20px;
  color: var(--text-primary);
}

.modal-content {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 16px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

/* Form Groups */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-tertiary);
  margin-bottom: 6px;
}

.form-group input[type="text"],
.modal-input {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  transition:
    border-color var(--transition-fast),
    box-shadow var(--transition-fast);
}

.form-group input[type="text"]:focus,
.modal-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

/* Radio Groups */
.radio-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.radio-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.radio-option:hover {
  border-color: var(--border-default);
  background: var(--bg-hover);
}

.radio-option input[type="radio"] {
  accent-color: var(--accent);
  width: 16px;
  height: 16px;
}

.radio-option span {
  font-size: 13px;
  color: var(--text-secondary);
}

.radio-option:has(input:checked) {
  border-color: var(--accent);
  background: rgba(99, 102, 241, 0.08);
}

.radio-option:has(input:checked) span {
  color: var(--text-primary);
}

/* Loader */
.loader-line {
  height: 2px;
  background: var(--accent);
  margin-top: 12px;
  border-radius: 2px;
  animation: loading 1s ease-in-out infinite;
}

@keyframes loading {
  0%,
  100% {
    width: 0;
    margin-left: 0;
  }
  50% {
    width: 100%;
    margin-left: 0;
  }
  100% {
    width: 0;
    margin-left: 100%;
  }
}

/* ===========================
   KEYBOARD SHORTCUTS MODAL
   =========================== */
.shortcuts-table {
  display: flex;
  flex-direction: column;
  gap: 24px;
  max-height: 500px;
  overflow-y: auto;
  padding: 4px;
}

.shortcuts-section h3 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}

.shortcut-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-subtle);
}

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

.shortcut-keys {
  display: flex;
  gap: 6px;
  align-items: center;
  font-size: 12px;
  color: var(--text-tertiary);
}

.shortcut-desc {
  font-size: 13px;
  color: var(--text-secondary);
}

kbd {
  display: inline-block;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 500;
  font-family:
    "Inter",
    -apple-system,
    system-ui,
    sans-serif;
  line-height: 1;
  color: var(--text-primary);
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: 4px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* ===========================
   TOAST NOTIFICATIONS
   =========================== */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 12px 20px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 13px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  z-index: 10000;
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.3s ease-out;
  pointer-events: none;
}

.toast:not(.hidden) {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.toast.hidden {
  display: none;
}

@keyframes toastEnter {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===========================
   UTILITIES
   =========================== */
.hidden {
  display: none !important;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border-default);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--border-focus);
}

/* ===========================
   LIGHT THEME
   =========================== */
[data-theme="light"] {
  --bg-base: #fafafa;
  --bg-surface: #ffffff;
  --bg-elevated: #ffffff;
  --bg-hover: #f5f5f5;
  --bg-surface-2: #f5f5f5;

  --border-subtle: rgba(0, 0, 0, 0.06);
  --border-default: rgba(0, 0, 0, 0.1);
  --border-focus: rgba(0, 0, 0, 0.2);
  --border-color: rgba(0, 0, 0, 0.1);

  --text-primary: #171717;
  --text-secondary: #525252;
  --text-tertiary: #737373;

  --accent: #6366f1;
  --accent-hover: #4f46e5;
  --accent-glow: rgba(99, 102, 241, 0.15);

  --danger: #dc2626;
  --warning: #d97706;
  --success: #059669;
}

/* ===========================
   TAGS SYSTEM
   =========================== */
.tags-cell {
  padding: 8px !important;
  min-width: 200px;
}

.tags-container {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.tag-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  background: var(--accent);
  color: white;
  font-size: 11px;
  font-weight: 500;
  border-radius: 12px;
  white-space: nowrap;
}

.tag-remove {
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  padding: 0;
  margin-left: 2px;
  font-size: 14px;
  line-height: 1;
  opacity: 0.7;
  transition: opacity var(--transition-fast);
}

.tag-remove:hover {
  opacity: 1;
}

.tag-input {
  flex: 1;
  min-width: 80px;
  background: transparent;
  border: 1px dashed var(--border-default);
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 11px;
  color: var(--text-secondary);
  outline: none;
  transition: all var(--transition-fast);
}

.tag-input:focus {
  border-color: var(--accent);
  border-style: solid;
  color: var(--text-primary);
}

.tag-input::placeholder {
  color: var(--text-tertiary);
  font-style: italic;
}

/* ===========================
   DECK COLOR PICKER
   =========================== */
.color-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  padding: 16px 0;
}

.color-option {
  width: 60px;
  height: 60px;
  border-radius: var(--radius-md);
  border: 2px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
}

.color-option:hover {
  transform: scale(1.1);
  border-color: var(--border-focus);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.color-option:active {
  transform: scale(0.95);
}

.color-picker-btn {
  background: transparent !important;
  border: none !important;
  color: var(--text-tertiary) !important;
  cursor: pointer;
  padding: 4px !important;
  opacity: 0;
  transition: opacity var(--transition-fast);
  font-size: 16px !important;
}

.deck-item:hover .color-picker-btn {
  opacity: 1;
}

.color-picker-btn:hover {
  color: var(--accent) !important;
}

.icon-btn {
  background: none;
  border: none;
  padding: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: background var(--transition-fast);
}

.icon-btn:hover {
  background: var(--bg-hover);
}

/* ===========================
   EXPORT PREVIEW
   =========================== */
.preview-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin: 20px 0;
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: var(--bg-elevated);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.stat-item ion-icon {
  font-size: 28px;
  color: var(--accent);
}

.stat-item.warning ion-icon {
  color: var(--warning);
}

.stat-item div strong {
  display: block;
  font-size: 24px;
  color: var(--text-primary);
  line-height: 1;
  margin-bottom: 4px;
}

.stat-item div span {
  font-size: 12px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.preview-cards {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 400px;
  overflow-y: auto;
  padding: 4px;
}

.preview-card {
  display: flex;
  gap: 12px;
  padding: 12px;
  background: var(--bg-surface);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  position: relative;
}

.preview-card.invalid {
  border-color: var(--danger);
  background: rgba(220, 38, 38, 0.05);
}

.preview-card-number {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: white;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 600;
}

.preview-card.invalid .preview-card-number {
  background: var(--danger);
}

.preview-card-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
}

.preview-card-content strong {
  color: var(--text-secondary);
  font-weight: 500;
  margin-right: 8px;
}

.preview-card-content em {
  color: var(--text-tertiary);
  opacity: 0.7;
}

.preview-tags {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.preview-tags .tag-badge {
  font-size: 10px;
  padding: 2px 6px;
}

.preview-warning {
  position: absolute;
  top: 12px;
  right: 12px;
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--danger);
  font-size: 11px;
  font-weight: 600;
}

.preview-warning ion-icon {
  font-size: 16px;
}

.preview-more {
  text-align: center;
  padding: 12px;
  color: var(--text-tertiary);
  font-size: 13px;
  font-style: italic;
}

/* ===========================
   DRAG & DROP
   =========================== */
.drag-handle {
  cursor: grab;
  text-align: center;
  color: var(--text-tertiary);
  opacity: 0.4;
  transition: opacity var(--transition-fast);
  user-select: none;
}

.drag-handle:active {
  cursor: grabbing;
}

tr:hover .drag-handle {
  opacity: 1;
  color: var(--accent);
}

tr[draggable="true"] {
  transition: background var(--transition-fast);
}

tr.drag-over {
  background: var(--bg-hover) !important;
  border-top: 2px solid var(--accent);
}

tr[draggable="true"]:active {
  cursor: grabbing;
}

/* ===========================
   MARKDOWN RENDERING
   =========================== */
.markdown-content {
  display: inline;
}

.markdown-content p {
  display: inline;
  margin: 0;
}

.markdown-content strong {
  font-weight: 700;
  color: var(--text-primary);
}

.markdown-content em {
  font-style: italic;
  color: var(--text-primary);
}

.markdown-content code {
  font-family: "Courier New", Courier, monospace;
  background: var(--bg-hover);
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 0.9em;
  color: var(--accent);
}

.markdown-content pre {
  background: var(--bg-surface);
  padding: 12px;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  margin: 8px 0;
}

.markdown-content pre code {
  background: none;
  padding: 0;
  color: var(--text-primary);
}

.markdown-content a {
  color: var(--accent);
  text-decoration: underline;
}

.markdown-content a:hover {
  opacity: 0.8;
}

/* ===========================
   IMPORT PREVIEW
   =========================== */
.import-stats {
  padding: 14px 18px;
  background: var(--bg-surface);
  border-radius: var(--radius-sm);
  margin-bottom: 20px;
  border-left: 3px solid var(--accent);
  font-size: 15px;
}

.import-stats strong {
  color: var(--accent);
  font-size: 18px;
}

.mapping-controls {
  background: var(--bg-surface);
  padding: 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 20px;
}

.mapping-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.mapping-row:last-child {
  margin-bottom: 0;
}

.mapping-row label {
  flex: 0 0 140px;
  font-weight: 500;
  color: var(--text-secondary);
}

.mapping-row select {
  flex: 1;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  color: var(--text-primary);
  font-size: 14px;
  cursor: pointer;
  transition: border-color var(--transition-fast);
}

.mapping-row select:hover {
  border-color: var(--accent);
}

.mapping-row select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.1);
}

.import-preview-section h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.import-preview-list {
  max-height: 400px;
  overflow-y: auto;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  padding: 12px;
  background: var(--bg-base);
}

.import-card-preview {
  padding: 12px 16px;
  background: var(--bg-surface);
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
  border-left: 3px solid var(--border-default);
  transition: all var(--transition-fast);
}

.import-card-preview:hover {
  background: var(--bg-hover);
  border-left-color: var(--accent);
}

.import-card-preview:last-child {
  margin-bottom: 0;
}

.import-card-number {
  font-size: 12px;
  color: var(--text-tertiary);
  font-weight: 600;
  margin-bottom: 6px;
}

.import-card-content {
  font-size: 14px;
}

.import-card-content > div {
  margin-bottom: 4px;
}

.import-card-content > div:last-child {
  margin-bottom: 0;
}

.import-card-content strong {
  color: var(--text-tertiary);
  font-weight: 500;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-right: 8px;
}

.import-card-content .value {
  color: var(--text-primary);
}

.import-card-preview.invalid {
  border-left-color: #ef4444;
  background: rgba(239, 68, 68, 0.05);
}

.import-card-preview.invalid .import-card-number {
  color: #ef4444;
}

/* ===========================
   IMPORT PREVIEW MODAL
   =========================== */
.modal {
  position: fixed !important;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

.modal.hidden {
  display: none !important;
}

.preview-modal-content {
  background: var(--bg-surface);
  border-radius: var(--radius-md);
  padding: 24px;
  width: 100%;
  max-width: 800px;
  min-width: 500px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
}

.modal-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-default);
}

.modal-header ion-icon {
  font-size: 24px;
  color: var(--accent);
}

.modal-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

.modal-body {
  margin: 16px 0;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border-default);
}

#importPreviewList {
  max-height: 400px;
  overflow-y: auto;
  margin: 16px 0;
  padding: 12px;
  background: var(--bg-main);
  border-radius: var(--radius-sm);
}

.preview-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  padding: 12px;
  margin-bottom: 8px;
  font-size: 13px;
}

.preview-card-number {
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 4px;
}

.preview-card-content {
  margin-left: 8px;
}

.preview-card.invalid {
  border-color: var(--error);
  background: rgba(239, 68, 68, 0.05);
}

.preview-warning {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--error);
  font-size: 12px;
  margin-top: 6px;
}

.preview-warning ion-icon {
  font-size: 16px;
}

/* Markdown Cell Styling */
.markdown-cell {
  position: relative;
  cursor: text;
}

.cell-view {
  min-height: 24px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.5;
}

.cell-view:hover {
  background: var(--bg-hover);
}

.cell-view p {
  margin: 0;
}

.cell-view strong {
  color: var(--accent);
  font-weight: 600;
}

.cell-view em {
  font-style: italic;
  color: var(--text-secondary);
}

.cell-view code {
  background: rgba(99, 102, 241, 0.1);
  color: var(--accent);
  padding: 2px 4px;
  border-radius: 4px;
  font-family: monospace;
  font-size: 13px;
}

.cell-view pre {
  background: var(--bg-elevated);
  padding: 8px;
  border-radius: 4px;
  overflow-x: auto;
  margin: 4px 0;
}

/* Markdown Toolbar */
.md-toolbar {
  display: flex;
  gap: 4px;
  margin-right: 8px;
  padding-right: 8px;
  border-right: 1px solid var(--border-subtle);
}

.md-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  background: transparent;
  border: none;
  border-radius: 4px;
  color: var(--text-tertiary);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  font-family: monospace;
  transition: all var(--transition-fast);
}

.md-btn:hover {
  background: var(--bg-hover);
  color: var(--accent);
}

.md-btn i {
  font-style: italic;
  font-family: serif;
}

.md-btn b {
  font-weight: 800;
}

/* Duplicate Warning */
.preview-card.duplicate {
  border-left: 3px solid var(--warning);
  background: rgba(245, 158, 11, 0.05);
}

.duplicate-warning {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--warning);
  font-size: 12px;
  margin-top: 4px;
  font-weight: 500;
}

/* --- Study Mode --- */
.study-container {
  background: var(--bg-surface);
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.study-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 32px;
  font-size: 18px;
  font-weight: 500;
  color: var(--text-secondary);
}

.study-progress-pill {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-elevated);
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid var(--border-subtle);
}

.flashcard-area {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  perspective: 1000px; /* For 3D Flip */
  cursor: pointer;
}

.flashcard-inner {
  position: relative;
  width: 100%;
  max-width: 600px;
  height: 400px;
  text-align: center;
  transition: transform 0.6s;
  transform-style: preserve-3d;
  background: var(--bg-elevated);
  border-radius: 24px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.1);
  border: 1px solid var(--border-subtle);
}

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

.flashcard-front,
.flashcard-back {
  position: absolute;
  width: 100%;
  height: 100%;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 48px;
  border-radius: 24px;
}

.flashcard-back {
  transform: rotateY(180deg);
  background: var(--bg-elevated); /* Same bg, just rotated */
}

.card-label {
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 1px;
  color: var(--text-tertiary);
  margin-bottom: 16px;
}

.card-content {
  font-size: var(--card-font-size, 32px);
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.4;
}

/* Markdown in Flashcard */
.card-content p {
  margin: 0;
}
.card-content strong {
  color: var(--accent);
}
.card-content code {
  background: rgba(99, 102, 241, 0.1);
  color: var(--accent);
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 0.9em;
}

.hint-text {
  margin-top: 32px;
  font-size: 14px;
  color: var(--text-tertiary);
  opacity: 0.7;
}

.study-controls {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 16px;
  margin-top: 32px;
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
  width: 100%;
}

.study-controls .spacer {
  flex: 1;
}

.action-btn.large {
  padding: 12px 32px;
  font-size: 16px;
}

/* SRS Rating Buttons */
.study-rating-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
  width: 100%;
  flex-wrap: wrap;
}

.rating-btn {
  flex: 1;
  min-width: 120px;
  padding: 12px 16px;
  border-radius: 8px;
  border: 2px solid;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.rating-again {
  background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
  border-color: #ff5252;
  color: white;
}

.rating-again:hover {
  background: #ee5a6f;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(255, 82, 82, 0.3);
}

.rating-hard {
  background: linear-gradient(135deg, #ffd93d 0%, #ffb700 100%);
  border-color: #ffb700;
  color: #333;
}

.rating-hard:hover {
  background: #ffb700;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(255, 183, 0, 0.3);
}

.rating-good {
  background: linear-gradient(135deg, #51cf66 0%, #37b24d 100%);
  border-color: #37b24d;
  color: white;
}

.rating-good:hover {
  background: #37b24d;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(55, 178, 77, 0.3);
}

.rating-easy {
  background: linear-gradient(135deg, #4dabf7 0%, #339af0 100%);
  border-color: #339af0;
  color: white;
}

.rating-easy:hover {
  background: #339af0;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(51, 154, 240, 0.3);
}

.rating-btn ion-icon {
  font-size: 18px;
}

/* Bulk Action Bar */
.bulk-bar {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: 100px;
  padding: 8px 16px;
  display: flex;
  align-items: center;
  gap: 24px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  z-index: 100;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.bulk-bar.hidden {
  transform: translate(-50%, 20px);
  opacity: 0;
  pointer-events: none;
}

.bulk-info {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 14px;
}

.bulk-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.action-btn.small {
  padding: 6px 12px;
  font-size: 13px;
  height: 32px;
}

.action-btn.danger {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
}

.action-btn.danger:hover {
  background: rgba(239, 68, 68, 0.2);
}

/* --- Statistics Modal --- */
.stats-overview {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}

.stat-box {
  background: var(--bg-surface-2);
  padding: 16px;
  border-radius: 12px;
  text-align: center;
  border: 1px solid var(--border-subtle);
}

.stat-value {
  font-size: 32px;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
  margin-bottom: 4px;
}

.stat-label {
  font-size: 13px;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stats-section {
  margin-bottom: 24px;
}

.stats-section h3 {
  font-size: 15px;
  color: var(--text-secondary);
  margin-bottom: 12px;
  font-weight: 600;
}

.chart-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chart-row {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
}

.chart-label {
  width: 120px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-secondary);
}

.chart-bar-container {
  flex: 1;
  background: var(--bg-surface-2);
  height: 8px;
  border-radius: 4px;
  overflow: hidden;
}

.chart-bar {
  height: 100%;
  border-radius: 4px;
  transition: width 0.6s ease;
}

.chart-value {
  width: 60px;
  text-align: right;
  color: var(--text-tertiary);
}

/* Enhanced Stats Grid */
.enhanced-stats {
  margin: 24px 0;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 16px;
}

.stat-card {
  background: linear-gradient(135deg, var(--bg-surface-2), var(--bg-elevated));
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 16px;
  text-align: center;
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.stat-icon {
  font-size: 32px;
  margin-bottom: 8px;
}

.stat-label {
  font-size: 12px;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
  margin-bottom: 4px;
}

.stat-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.stat-sublabel {
  font-size: 11px;
  color: var(--text-tertiary);
}

.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.stat-tag {
  background: var(--bg-surface-2);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 13px;
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: 6px;
}

.stat-tag .count {
  background: var(--accent);
  color: white;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 10px;
  font-weight: 600;
}

.empty-chart {
  text-align: center;
  color: var(--text-tertiary);
  font-style: italic;
  padding: 12px;
}

/* ===========================
   STUDY MODE ANIMATIONS 
   =========================== */

@keyframes slideOutLeft {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(-50px);
  }
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(50px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideOutRight {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(50px);
  }
}

@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-50px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.anim-slide-out-left {
  animation: slideOutLeft 0.2s ease-in forwards;
}

.anim-slide-in-right {
  animation: slideInRight 0.2s ease-out forwards;
}

.anim-slide-out-right {
  animation: slideOutRight 0.2s ease-in forwards;
}

.anim-slide-in-left {
  animation: slideInLeft 0.2s ease-out forwards;
}

/* ===========================
   VIEW CONTENT (Statistics, Settings, Study)
   =========================== */
.view-content {
  padding: 24px;
}

/* --- Statistics View --- */
.stats-grid {
  display: flex;
  gap: 20px;
  margin-bottom: 24px;
}

.overview-card {
  flex: 1;
  padding: 20px;
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
}

.overview-label {
  color: var(--text-tertiary);
  font-size: 13px;
  margin-bottom: 4px;
}

.overview-value {
  font-size: 32px;
  font-weight: 600;
  color: var(--text-primary);
}

.stats-enhanced {
  margin-bottom: 24px;
}

.stats-section-block {
  margin-bottom: 24px;
}

.section-title {
  margin-bottom: 12px;
  color: var(--text-primary);
}

.stats-card {
  padding: 20px;
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
}

.tag-cloud-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* --- Settings View --- */
.settings-container {
  max-width: 600px;
}

.settings-card {
  padding: 20px;
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
}

.settings-desc {
  color: var(--text-secondary);
  margin-bottom: 16px;
  font-size: 14px;
}

.theme-options-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* --- Devices Section --- */
.devices-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.device-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--bg-elevated);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  transition: border-color var(--transition-fast);
}

.device-item.current-device {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, var(--bg-elevated));
}

.device-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.device-icon {
  font-size: 22px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
}

.device-item.current-device .device-icon {
  color: var(--accent);
}

.device-details {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.device-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.device-current-badge {
  font-size: 10px;
  font-weight: 600;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 15%, transparent);
  padding: 1px 6px;
  border-radius: 99px;
  letter-spacing: 0.3px;
}

.device-meta {
  font-size: 12px;
  color: var(--text-tertiary);
}

.device-remove-btn {
  background: none;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
  font-size: 16px;
  display: flex;
  align-items: center;
  transition: all var(--transition-fast);
}

.device-remove-btn:hover {
  color: var(--danger);
  background: color-mix(in srgb, var(--danger) 10%, transparent);
}

.devices-loading {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px;
  color: var(--text-tertiary);
  font-size: 13px;
}

.devices-loading ion-icon {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  100% {
    transform: rotate(360deg);
  }
}

.devices-empty {
  padding: 16px;
  color: var(--text-tertiary);
  font-size: 13px;
  text-align: center;
}

.devices-actions {
  display: flex;
  gap: 8px;
}

/* --- Study View --- */
.study-workspace {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

.study-view-container {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.study-placeholder {
  text-align: center;
  color: var(--text-secondary);
}

.placeholder-icon {
  font-size: 64px;
  margin-bottom: 20px;
  opacity: 0.5;
}

.study-interface {
  width: 100%;
  max-width: 800px;
}

/* --- Sidebar Stats Button --- */
.sidebar-stats-btn {
  margin-top: 12px;
  width: 100%;
  text-align: left;
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
  padding: 8px 12px;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: none; /* Hidden - removed from UI */
  align-items: center;
  gap: 8px;
  font-size: 13px;
  transition: all var(--transition-fast);
}

.sidebar-stats-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border-default);
}

/* ===========================
   LOADING SKELETON
   =========================== */
.app-skeleton {
  display: flex;
  height: 100vh;
  background: var(--bg-base);
  animation: skeletonFadeIn 0.3s ease;
}

.app-skeleton.hidden {
  display: none !important;
}

.skeleton-sidebar {
  width: 240px;
  background: var(--bg-surface);
  border-right: 1px solid var(--border-subtle);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.skeleton-main {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.skeleton-topbar {
  height: 60px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
}

.skeleton-content {
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.skeleton-line {
  height: 14px;
  border-radius: 6px;
  background: linear-gradient(
    90deg,
    var(--bg-elevated) 25%,
    var(--bg-hover) 50%,
    var(--bg-elevated) 75%
  );
  background-size: 200% 100%;
  animation: skeletonShimmer 1.5s infinite;
}

.skeleton-rect {
  height: 200px;
  border-radius: 12px;
  background: linear-gradient(
    90deg,
    var(--bg-elevated) 25%,
    var(--bg-hover) 50%,
    var(--bg-elevated) 75%
  );
  background-size: 200% 100%;
  animation: skeletonShimmer 1.5s infinite;
}

.w40 {
  width: 40%;
}
.w50 {
  width: 50%;
}
.w60 {
  width: 60%;
}
.w70 {
  width: 70%;
}
.w80 {
  width: 80%;
}

@keyframes skeletonShimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

@keyframes skeletonFadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* ===========================
   HAMBURGER MENU (Mobile)
   =========================== */
.hamburger-btn {
  display: none;
  position: fixed;
  top: 14px;
  left: 10px;
  z-index: 1100;
  width: 40px;
  height: 40px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-size: 22px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  transition: all var(--transition-fast);
}

.hamburger-btn:hover {
  background: var(--bg-hover);
}

.sidebar-close-btn {
  display: none;
  margin-left: auto;
  background: transparent;
  border: none;
  color: var(--text-tertiary);
  font-size: 22px;
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  align-items: center;
  justify-content: center;
}

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

.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  z-index: 900;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-normal);
}

.sidebar-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

/* ===========================
   DAILY GOAL & STREAK WIDGET
   =========================== */
.daily-goal-widget {
  padding: 12px;
  margin-bottom: 8px;
  background: var(--bg-elevated);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.goal-progress {
  width: 100%;
  height: 6px;
  background: var(--bg-hover);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 8px;
}

.goal-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #22c55e);
  border-radius: 3px;
  transition: width 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.goal-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.goal-text {
  font-size: 11px;
  color: var(--text-tertiary);
}

.streak-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  color: var(--warning);
  background: rgba(245, 158, 11, 0.1);
  padding: 3px 8px;
  border-radius: 12px;
  border: 1px solid rgba(245, 158, 11, 0.2);
}

.streak-badge ion-icon {
  font-size: 14px;
  animation: pulse-fire 2s ease-in-out infinite;
}

@keyframes pulse-fire {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.8; transform: scale(1.1); }
}

/* ===========================
   STUDY PROGRESS BAR
   =========================== */
.study-progress-container {
  padding: 0 24px;
  margin-bottom: 8px;
}

.study-progress-bar-outer {
  width: 100%;
  height: 8px;
  background: var(--bg-hover);
  border-radius: 4px;
  overflow: hidden;
}

.study-progress-bar-inner {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #818cf8, #22c55e);
  border-radius: 4px;
  transition: width 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  width: 0%;
}

.study-progress-info {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  font-size: 12px;
  color: var(--text-tertiary);
}

/* ===========================
   SESSION SUMMARY
   =========================== */
.session-summary {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 40px 24px;
  max-width: 500px;
  margin: 0 auto;
  animation: summaryIn 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes summaryIn {
  from {
    opacity: 0;
    transform: scale(0.9) translateY(20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.summary-icon {
  font-size: 64px;
  margin-bottom: 16px;
}

.session-summary h2 {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.summary-subtitle {
  color: var(--text-secondary);
  font-size: 16px;
  margin-bottom: 32px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  width: 100%;
  margin-bottom: 32px;
}

.summary-stat {
  padding: 16px 12px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
}

.summary-stat.again {
  border-top: 3px solid #ff5252;
}
.summary-stat.hard {
  border-top: 3px solid #ffb700;
}
.summary-stat.good {
  border-top: 3px solid #37b24d;
}
.summary-stat.easy {
  border-top: 3px solid #339af0;
}

.summary-stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.summary-stat-label {
  font-size: 12px;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Accuracy Ring */
.summary-accuracy {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 32px;
}

.accuracy-ring {
  width: 100px;
  height: 100px;
  position: relative;
}

.accuracy-ring svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.ring-bg {
  fill: none;
  stroke: var(--bg-hover);
  stroke-width: 3;
}

.ring-fg {
  fill: none;
  stroke: var(--accent);
  stroke-width: 3;
  stroke-linecap: round;
  transition: stroke-dasharray 1s ease;
}

.accuracy-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
}

.accuracy-label {
  font-size: 13px;
  color: var(--text-tertiary);
  margin-top: 8px;
}

.summary-actions {
  display: flex;
  gap: 12px;
}

/* ===========================
   SETTINGS STYLES
   =========================== */
.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
  border-bottom: 1px solid var(--border-subtle);
}

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

.settings-row-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.settings-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
}

.settings-sublabel {
  font-size: 12px;
  color: var(--text-tertiary);
}

.settings-input {
  width: 80px;
  padding: 8px 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  text-align: center;
  transition: border-color var(--transition-fast);
}

.settings-input.wide {
  width: 140px;
  text-align: left;
}

.settings-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.settings-range-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.settings-range {
  width: 120px;
  accent-color: var(--accent);
}

.settings-range-value {
  font-size: 13px;
  color: var(--text-secondary);
  min-width: 40px;
  text-align: right;
}

/* Toggle Switch */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  cursor: pointer;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg-hover);
  border-radius: 24px;
  border: 1px solid var(--border-default);
  transition: all var(--transition-fast);
}

.toggle-slider::before {
  content: "";
  position: absolute;
  height: 18px;
  width: 18px;
  left: 2px;
  bottom: 2px;
  background: var(--text-tertiary);
  border-radius: 50%;
  transition: all var(--transition-fast);
}

.toggle-switch input:checked + .toggle-slider {
  background: var(--accent);
  border-color: var(--accent);
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(20px);
  background: white;
}

/* Rating kbd badge */
.rating-kbd {
  font-size: 10px;
  padding: 1px 5px;
  margin-left: 4px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
  opacity: 0.7;
}

/* ===========================
   COUNT-UP ANIMATION
   =========================== */
.count-up {
  transition: all 0.3s ease;
}

@keyframes countPulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
  100% {
    transform: scale(1);
  }
}

.count-animate {
  animation: countPulse 0.3s ease;
}

/* ===========================
   MOBILE RESPONSIVE
   =========================== */
@media (max-width: 768px) {
  .hamburger-btn {
    display: flex;
  }

  .sidebar-close-btn {
    display: flex;
  }

  .sidebar-overlay {
    display: block;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: -260px;
    height: 100vh;
    z-index: 1000;
    width: 260px;
    transition: left 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: none;
  }

  .sidebar.open {
    left: 0;
    box-shadow: 8px 0 30px rgba(0, 0, 0, 0.3);
  }

  .main-content {
    width: 100%;
  }

  .top-bar {
    padding: 16px 16px 16px 64px;
  }

  .tab-navigation {
    padding: 8px 16px 0;
    overflow-x: auto;
    gap: 2px;
    justify-content: center;
  }

  .nav-tab span {
    display: none;
  }

  .nav-tab {
    padding: 8px 14px;
    min-width: auto;
  }

  .workspace {
    padding: 16px;
  }

  .deck-header {
    flex-wrap: wrap;
    gap: 12px;
  }

  .deck-header h1 {
    font-size: 16px;
    width: 100%;
  }

  .deck-actions-header {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
  }

  .btn-text {
    display: none;
  }

  .action-btn {
    padding: 8px 10px;
    font-size: 12px;
  }

  .search-container {
    max-width: 100%;
    flex: 1;
  }

  .deck-stats {
    display: none;
  }

  .table-container {
    overflow-x: auto;
  }

  .live-table {
    min-width: 500px;
  }

  .omnibar-container {
    padding: 8px 12px;
  }

  .md-toolbar {
    display: none;
  }

  .flashcard-inner {
    max-width: 100%;
    height: 300px;
  }

  .flashcard-front,
  .flashcard-back {
    padding: 24px;
  }

  .card-content {
    font-size: 22px;
  }

  .study-rating-buttons {
    flex-wrap: wrap;
  }

  .rating-btn {
    min-width: 80px;
    padding: 10px 12px;
    font-size: 12px;
  }

  .rating-kbd {
    display: none;
  }

  .summary-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .stats-grid {
    flex-direction: column;
  }

  .stat-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .modal-glass {
    min-width: auto;
    width: 95vw;
    padding: 20px;
  }

  .preview-stats {
    grid-template-columns: 1fr;
  }

  .bulk-bar {
    width: calc(100% - 32px);
    left: 16px;
    transform: none;
    border-radius: 12px;
  }

  .bulk-bar.hidden {
    transform: translateY(20px);
  }

  .settings-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .settings-range-group {
    width: 100%;
  }

  .settings-range {
    flex: 1;
  }

  .skeleton-sidebar {
    display: none;
  }
}

@media (max-width: 480px) {
  .top-bar {
    padding: 12px 12px 12px 56px;
  }

  .workspace {
    padding: 12px;
  }

  .nav-tab {
    padding: 8px 10px;
  }

  .nav-tab ion-icon {
    font-size: 16px;
  }

  .flashcard-inner {
    height: 250px;
    border-radius: 16px;
  }

  .card-content {
    font-size: 18px;
  }

  .summary-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .session-summary h2 {
    font-size: 22px;
  }

  .study-progress-container {
    padding: 0 16px;
  }

  .study-controls {
    margin-top: 16px;
  }
}

/* ===========================
   TAG FILTER BAR
   =========================== */
.tag-filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  flex-wrap: wrap;
}

.tag-filter-bar.hidden {
  display: none;
}

.tag-filter-label {
  font-size: 12px;
  color: var(--text-tertiary);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.tag-filter-pill {
  padding: 4px 12px;
  border-radius: 20px;
  border: 1px solid var(--border-default);
  background: transparent;
  color: var(--text-secondary);
  font-size: 12px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.tag-filter-pill:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.tag-filter-pill.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

/* ===========================
   CONTEXT MENU (Move/Copy)
   =========================== */
.context-menu {
  position: fixed;
  z-index: 9999;
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  min-width: 220px;
  max-height: 400px;
  overflow-y: auto;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  padding: 4px;
}

.context-menu-header {
  padding: 8px 12px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.context-menu-item {
  padding: 8px 12px;
  font-size: 13px;
  color: var(--text-primary);
  cursor: pointer;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background var(--transition-fast);
}

.context-menu-item:hover {
  background: var(--bg-hover);
}

.context-menu-divider {
  height: 1px;
  background: var(--border-subtle);
  margin: 4px 8px;
}

/* ===========================
   CARD ACTIONS CELL
   =========================== */
.card-actions-cell {
  display: flex;
  gap: 2px;
  align-items: center;
}

/* ===========================
   OMNIBAR MARKDOWN PREVIEW
   =========================== */
.omnibar-preview {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  right: 0;
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  font-size: 14px;
  color: var(--text-primary);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 100;
}

.omnibar-preview.hidden {
  display: none;
}

.omnibar-preview .preview-term {
  flex: 1;
}

.omnibar-preview .preview-sep {
  color: var(--accent);
  font-weight: 600;
}

.omnibar-preview .preview-def {
  flex: 1;
  color: var(--text-secondary);
}

.omnibar-preview p {
  margin: 0;
}

/* ===========================
   AUTO-SAVE INDICATOR
   =========================== */
.status-indicator.saving .dot {
  background: var(--warning);
  animation: pulse-dot 0.6s infinite alternate;
}

.status-indicator.saved .dot {
  background: var(--success);
}

@keyframes pulse-dot {
  from {
    opacity: 0.4;
  }
  to {
    opacity: 1;
  }
}

/* ===========================
   MATURITY CHART
   =========================== */
.maturity-bar {
  display: flex;
  height: 24px;
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 16px;
}

.maturity-segment {
  transition: width 0.5s ease;
  min-width: 2px;
}

.maturity-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.maturity-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-secondary);
}

.maturity-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.maturity-pct {
  color: var(--text-tertiary);
  font-size: 12px;
}

/* ===========================
   FIND & REPLACE MODAL
   =========================== */
#findReplaceModal .form-group {
  margin-bottom: 16px;
}

#findReplaceModal label {
  display: block;
  margin-bottom: 6px;
  font-weight: 500;
  color: var(--text-secondary);
  font-size: 13px;
}

#findReplaceModal input[type="text"] {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-size: 14px;
  transition: border-color var(--transition-fast);
}

#findReplaceModal input[type="text"]:focus {
  border-color: var(--accent);
  outline: none;
}

#findReplaceModal h2 {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ===========================
   SUSPENDED CARD ROW
   =========================== */
.row-suspended {
  opacity: 0.5;
  background: repeating-linear-gradient(
    -45deg,
    transparent,
    transparent 10px,
    rgba(255, 255, 255, 0.02) 10px,
    rgba(255, 255, 255, 0.02) 20px
  );
}

.row-suspended td {
  text-decoration: line-through;
  text-decoration-color: var(--text-tertiary);
}

.row-suspended .card-actions-cell {
  text-decoration: none;
}

.action-btn.active {
  background: var(--accent) !important;
  color: white !important;
}

/* ===========================
   REVIEW HEATMAP
   =========================== */
.heatmap-meta {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--text-tertiary);
  margin-bottom: 12px;
}

.heatmap-months {
  display: grid;
  grid-template-columns: repeat(14, 1fr);
  font-size: 11px;
  color: var(--text-tertiary);
  margin-bottom: 4px;
  padding-left: 0;
}

.heatmap-grid {
  display: grid;
  grid-template-rows: repeat(7, 1fr);
  grid-auto-flow: column;
  gap: 3px;
  margin-bottom: 12px;
}

.heatmap-cell {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  transition: transform 0.15s ease;
}

.heatmap-cell:hover {
  transform: scale(1.5);
}

.heatmap-cell.level-0 {
  background: var(--bg-hover);
}
.heatmap-cell.level-1 {
  background: rgba(99, 102, 241, 0.3);
}
.heatmap-cell.level-2 {
  background: rgba(99, 102, 241, 0.5);
}
.heatmap-cell.level-3 {
  background: rgba(99, 102, 241, 0.7);
}
.heatmap-cell.level-4 {
  background: var(--accent);
}

.heatmap-legend {
  display: flex;
  align-items: center;
  gap: 4px;
  justify-content: flex-end;
  font-size: 11px;
  color: var(--text-tertiary);
}

.heatmap-legend .heatmap-cell {
  width: 12px;
  height: 12px;
}

/* ===========================
   REVIEW FORECAST
   =========================== */
.forecast-chart {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 120px;
  padding: 0 4px;
  margin-bottom: 12px;
}

.forecast-bar-group {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  justify-content: flex-end;
  gap: 4px;
}

.forecast-bar {
  width: 100%;
  max-width: 32px;
  background: var(--accent);
  border-radius: 4px 4px 0 0;
  min-height: 4px;
  transition: height 0.4s ease;
}

.forecast-count {
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 600;
}

.forecast-label {
  font-size: 10px;
  color: var(--text-tertiary);
  min-height: 14px;
}

.forecast-summary {
  display: flex;
  justify-content: space-around;
  padding: 12px 0 0;
  border-top: 1px solid var(--border-subtle);
  font-size: 13px;
  color: var(--text-secondary);
}

.forecast-summary strong {
  color: var(--text-primary);
}

/* ===========================
   NOSCRIPT
   =========================== */
noscript {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  font-size: 18px;
  color: var(--text-secondary);
  text-align: center;
  padding: 20px;
}

/* ===========================
   USER ACCOUNT (Sidebar)
   =========================== */
.user-account {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  margin-bottom: 8px;
  background: var(--bg-elevated);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
}

.user-avatar .avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.user-avatar .avatar-initial {
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
}

.user-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.user-info .user-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-info .user-email {
  font-size: 10px;
  color: var(--text-tertiary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-logout-btn {
  background: none;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.user-logout-btn:hover {
  color: var(--danger);
  background: rgba(239, 68, 68, 0.1);
}

.user-logout-btn ion-icon {
  font-size: 16px;
}

/* ===========================
   SYNC INDICATOR
   =========================== */
.sync-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  margin-bottom: 8px;
  font-size: 11px;
  color: var(--text-tertiary);
}

.sync-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-tertiary);
  transition: background 0.3s ease;
}

.sync-dot.syncing {
  background: var(--warning);
  animation: syncPulse 1s ease-in-out infinite;
}

.sync-dot.synced {
  background: var(--success);
}

.sync-dot.sync-error {
  background: var(--danger);
}

@keyframes syncPulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.3;
  }
}

.sync-text {
  font-size: 11px;
  color: var(--text-tertiary);
  white-space: nowrap;
}

/* ===========================
   LOGIN PAGE
   =========================== */
/* ===========================
   LOGIN PAGE — Modern Split Layout
   =========================== */

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0a0a0f;
  position: relative;
  overflow: hidden;
}

.login-back-home {
  position: absolute;
  top: 24px;
  left: 24px;
  z-index: 10;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.6);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.2s ease;
  backdrop-filter: blur(10px);
}

.login-back-home:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateX(-2px);
}

[data-theme="light"] .login-back-home {
  background: rgba(0, 0, 0, 0.04);
  border-color: rgba(0, 0, 0, 0.1);
  color: #6b7280;
}

[data-theme="light"] .login-back-home:hover {
  background: rgba(0, 0, 0, 0.08);
  color: #111827;
  border-color: rgba(0, 0, 0, 0.2);
}

/* Animated floating orbs */
.login-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.4;
  pointer-events: none;
  animation: loginOrbFloat 20s ease-in-out infinite;
}

@media (prefers-reduced-motion: reduce) {
  .login-orb {
    animation: none;
  }
}

.login-orb-1 {
  width: 500px;
  height: 500px;
  background: rgba(99, 102, 241, 0.15);
  top: -10%;
  left: -5%;
  animation-delay: 0s;
}

.login-orb-2 {
  width: 400px;
  height: 400px;
  background: rgba(139, 92, 246, 0.12);
  bottom: -10%;
  right: -5%;
  animation-delay: -7s;
}

.login-orb-3 {
  width: 300px;
  height: 300px;
  background: rgba(59, 130, 246, 0.1);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation-delay: -14s;
}

@keyframes loginOrbFloat {
  0%,
  100% {
    transform: translate(0, 0) scale(1);
  }
  25% {
    transform: translate(30px, -40px) scale(1.05);
  }
  50% {
    transform: translate(-20px, 20px) scale(0.95);
  }
  75% {
    transform: translate(40px, 30px) scale(1.02);
  }
}

/* Loading state */
.login-loader {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

.login-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(99, 102, 241, 0.2);
  border-top-color: #6366f1;
  border-radius: 50%;
  animation: loginSpin 0.7s linear infinite;
}

@keyframes loginSpin {
  to {
    transform: rotate(360deg);
  }
}

/* Main wrapper — split layout */
.login-wrapper {
  display: flex;
  width: 100%;
  max-width: 960px;
  min-height: 580px;
  margin: 20px;
  border-radius: 20px;
  overflow: hidden;
  background: rgba(15, 15, 25, 0.8);
  -webkit-backdrop-filter: blur(40px);
  backdrop-filter: blur(40px);
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.5);
  position: relative;
  z-index: 1;
}

/* Left — Hero side */
.login-hero {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.08), rgba(139, 92, 246, 0.05));
  border-right: 1px solid rgba(255, 255, 255, 0.04);
  position: relative;
}

.login-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 30% 40%, rgba(99, 102, 241, 0.1) 0%, transparent 60%);
  pointer-events: none;
}

.login-hero-content {
  position: relative;
  z-index: 1;
}

.login-brand-mark {
  font-size: 48px;
  margin-bottom: 16px;
  filter: drop-shadow(0 0 20px rgba(99, 102, 241, 0.5));
}

.login-hero-content h1 {
  font-size: 36px;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.5px;
  margin-bottom: 8px;
}

.login-hero-tagline {
  font-size: 15px;
  color: rgba(255, 255, 255, 0.5);
  margin-bottom: 40px;
}

.login-hero-features {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.login-hero-feature {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.login-hero-feature-icon {
  font-size: 22px;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.login-hero-feature div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.login-hero-feature strong {
  font-size: 14px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.9);
}

.login-hero-feature span {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.4);
  line-height: 1.4;
}

/* Right — Form side */
.login-form-side {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px;
}

.login-card {
  width: 100%;
  max-width: 360px;
}

.login-card-header {
  margin-bottom: 28px;
}

.login-card-header h2 {
  font-size: 22px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 6px;
}

.login-card-header p {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.4);
}

/* OAuth buttons — horizontal */
.login-oauth {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}

.login-oauth-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  color: rgba(255, 255, 255, 0.8);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.login-oauth-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.15);
  transform: translateY(-1px);
}

.login-oauth-btn:active {
  transform: translateY(0);
}

.login-oauth-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.login-oauth-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.login-oauth-btn svg {
  flex-shrink: 0;
}

/* Divider */
.login-divider {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 20px 0;
}

.login-divider::before,
.login-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: rgba(255, 255, 255, 0.06);
}

.login-divider span {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.25);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 500;
}

/* Signup role selector */
.login-role-selector {
  margin-bottom: 16px;
}

.login-role-label {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.6);
}

.login-role-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.login-role-btn {
  padding: 14px 12px;
  border-radius: 10px;
  border: 2px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
  color: rgba(255, 255, 255, 0.85);
}

.login-role-btn:hover {
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}

.login-role-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.login-role-btn-student.is-selected {
  border-color: #6366f1;
  background: rgba(99, 102, 241, 0.12);
}

.login-role-btn-teacher.is-selected {
  border-color: #10b981;
  background: rgba(16, 185, 129, 0.12);
}

.login-role-emoji {
  font-size: 24px;
}

.login-role-title {
  font-size: 13px;
  font-weight: 600;
}

.login-role-subtitle {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.45);
}

/* Form */
.login-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.login-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.login-field label {
  font-size: 13px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.5);
}

.login-password-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.login-forgot-link {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.45);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}

.login-forgot-link:hover {
  color: rgba(255, 255, 255, 0.75);
  text-decoration: underline;
}

.login-forgot-link:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
  border-radius: 4px;
}

.login-field input {
  padding: 11px 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  color: #fff;
  font-size: 14px;
  outline: none;
  transition: all 0.2s ease;
}

.login-field input::placeholder {
  color: rgba(255, 255, 255, 0.2);
}

.login-field input:focus {
  border-color: rgba(99, 102, 241, 0.5);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
  background: rgba(255, 255, 255, 0.06);
}

/* Alerts */
.login-alert {
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.5;
}

.login-alert-error {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.15);
  color: #f87171;
}

.login-alert-success {
  background: rgba(34, 197, 94, 0.08);
  border: 1px solid rgba(34, 197, 94, 0.15);
  color: #4ade80;
}

/* Submit button */
.login-submit-btn {
  padding: 12px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-top: 4px;
  position: relative;
  overflow: hidden;
}

.login-submit-btn::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    135deg,
    transparent 30%,
    rgba(255, 255, 255, 0.1) 50%,
    transparent 70%
  );
  opacity: 0;
  transition: opacity 0.2s;
}

.login-submit-btn:hover::before {
  opacity: 1;
}

.login-submit-btn:hover {
  box-shadow: 0 4px 20px rgba(99, 102, 241, 0.35);
  transform: translateY(-1px);
}

.login-submit-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 10px rgba(99, 102, 241, 0.2);
}

.login-submit-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.login-submit-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.18);
}

.login-btn-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.login-spinner-sm {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: loginSpin 0.6s linear infinite;
}

/* Mode toggle */
.login-mode-toggle {
  text-align: center;
  margin-top: 24px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.35);
}

.login-mode-toggle button {
  background: none;
  border: none;
  color: #818cf8;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  padding: 0;
  transition: color 0.2s;
}

.login-mode-toggle button:hover {
  color: #a5b4fc;
  text-decoration: underline;
}

.login-mode-toggle button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
  border-radius: 4px;
}

/* ===========================
   LOGIN — Responsive
   =========================== */

@media (max-width: 768px) {
  .login-wrapper {
    flex-direction: column;
    max-width: 440px;
    min-height: auto;
    margin: 16px;
  }

  .login-hero {
    padding: 32px 28px 24px;
    border-right: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  }

  .login-brand-mark {
    font-size: 36px;
    margin-bottom: 12px;
  }

  .login-hero-content h1 {
    font-size: 28px;
  }

  .login-hero-tagline {
    margin-bottom: 24px;
  }

  .login-hero-features {
    gap: 14px;
  }

  .login-hero-feature-icon {
    width: 34px;
    height: 34px;
    font-size: 18px;
  }

  .login-form-side {
    padding: 28px;
  }

  .login-role-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 420px) {
  .login-wrapper {
    margin: 8px;
    border-radius: 16px;
  }

  .login-hero {
    padding: 24px 20px 20px;
  }

  .login-hero-features {
    display: none;
  }

  .login-form-side {
    padding: 24px 20px;
  }

  .login-oauth {
    flex-direction: column;
  }
  
  .login-back-home {
    top: 12px;
    left: 12px;
    padding: 6px 12px;
    font-size: 12px;
  }
}

/* ===== LOGIN LIGHT THEME ===== */
[data-theme="light"] .login-page {
  background: #f5f5f7;
}

[data-theme="light"] .login-orb {
  opacity: 0.15;
}

[data-theme="light"] .login-wrapper {
  background: rgba(255, 255, 255, 0.95);
  border-color: rgba(0, 0, 0, 0.08);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .login-hero {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.06), rgba(139, 92, 246, 0.04));
  border-right-color: rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .login-hero-content h1 {
  color: #111827;
}

[data-theme="light"] .login-hero-tagline {
  color: #6b7280;
}

[data-theme="light"] .login-hero-feature-icon {
  background: rgba(0, 0, 0, 0.04);
  border-color: rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .login-hero-feature strong {
  color: #111827;
}

[data-theme="light"] .login-hero-feature span {
  color: #6b7280;
}

[data-theme="light"] .login-card-header h2 {
  color: #111827;
}

[data-theme="light"] .login-card-header p {
  color: #6b7280;
}

[data-theme="light"] .login-oauth-btn {
  background: rgba(0, 0, 0, 0.03);
  border-color: rgba(0, 0, 0, 0.1);
  color: #374151;
}

[data-theme="light"] .login-oauth-btn:hover {
  background: rgba(0, 0, 0, 0.06);
  border-color: rgba(0, 0, 0, 0.15);
}

[data-theme="light"] .login-role-label {
  color: #374151;
}

[data-theme="light"] .login-role-btn {
  color: #111827;
  background: rgba(0, 0, 0, 0.02);
  border-color: rgba(0, 0, 0, 0.12);
}

[data-theme="light"] .login-role-btn:hover {
  border-color: rgba(0, 0, 0, 0.2);
}

[data-theme="light"] .login-role-subtitle {
  color: #6b7280;
}

[data-theme="light"] .login-forgot-link {
  color: #6b7280;
}

[data-theme="light"] .login-forgot-link:hover {
  color: #374151;
}

[data-theme="light"] .login-divider::before,
[data-theme="light"] .login-divider::after {
  background: rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .login-divider span {
  color: #9ca3af;
}

[data-theme="light"] .login-field label {
  color: #374151;
}

[data-theme="light"] .login-field input {
  background: rgba(0, 0, 0, 0.02);
  border-color: rgba(0, 0, 0, 0.12);
  color: #111827;
}

[data-theme="light"] .login-field input::placeholder {
  color: #9ca3af;
}

[data-theme="light"] .login-field input:focus {
  background: #ffffff;
  border-color: rgba(99, 102, 241, 0.5);
}

[data-theme="light"] .login-mode-toggle {
  color: #6b7280;
}

[data-theme="light"] .login-mode-toggle button {
  color: #6366f1;
}

[data-theme="light"] .login-mode-toggle button:hover {
  color: #4f46e5;
}

/* ===== LOADING OVERLAY ===== */
.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(10, 10, 20, 0.85);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  animation: loadingFadeIn 0.2s ease;
}

@keyframes loadingFadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.loading-overlay-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: 40px;
  border-radius: 16px;
  background: rgba(30, 30, 50, 0.9);
  border: 1px solid rgba(99, 102, 241, 0.2);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  min-width: 320px;
}

.loading-spinner-ring {
  width: 48px;
  height: 48px;
  border: 3px solid rgba(99, 102, 241, 0.15);
  border-top-color: #6366f1;
  border-radius: 50%;
  animation: loadingSpin 0.8s linear infinite;
}

@keyframes loadingSpin {
  to {
    transform: rotate(360deg);
  }
}

.loading-overlay-message {
  font-size: 15px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.9);
  text-align: center;
}

.loading-overlay-sub {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.5);
  text-align: center;
}

.loading-progress-bar {
  width: 100%;
  height: 4px;
  background: rgba(99, 102, 241, 0.15);
  border-radius: 4px;
  overflow: hidden;
}

.loading-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #6366f1, #8b5cf6);
  border-radius: 4px;
  transition: width 0.3s ease;
  width: 0%;
}

.loading-progress-indeterminate .loading-progress-fill {
  width: 40%;
  animation: loadingIndeterminate 1.5s ease-in-out infinite;
}

@keyframes loadingIndeterminate {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(350%);
  }
}

/* Card row animations */
@keyframes fadeSlideIn {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Light theme */
[data-theme="light"] .loading-overlay {
  background: rgba(255, 255, 255, 0.85);
}

[data-theme="light"] .loading-overlay-content {
  background: rgba(255, 255, 255, 0.95);
  border-color: rgba(99, 102, 241, 0.15);
}

[data-theme="light"] .loading-overlay-message {
  color: #1e293b;
}

[data-theme="light"] .loading-overlay-sub {
  color: #64748b;
}
/* Back to Home Button */
.login-back-link {
  margin-top: 24px;
}

.login-back-btn {
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.6);
  font-size: 14px;
  cursor: pointer;
  padding: 0;
  transition: color 0.2s ease;
}

.login-back-btn:hover {
  color: white;
  text-decoration: underline;
}
/* Signup Mode Differentiation */
.btn-signup {
  background: #10b981 !important; /* Emerald-500 */
}

.btn-signup:hover {
  background: #059669 !important; /* Emerald-600 */
}

.border-signup {
  border-top-color: #10b981 !important;
}

.text-signup {
  color: #10b981 !important;
}

/* ===========================
   TTS BUTTON (Text-to-Speech)
   =========================== */
.tts-btn {
  position: absolute;
  top: 24px;
  right: 24px;
  width: 44px; /* Minimum touch target size */
  height: 44px;
  border-radius: 50%;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  z-index: 10;
  font-size: 20px;
}

.tts-btn:hover {
  background: var(--bg-hover);
  color: var(--accent);
  border-color: var(--accent);
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.tts-btn:active {
  transform: scale(0.95);
}

.tts-btn.hidden {
  display: none !important;
}

.tts-btn.tts-icon {
  font-size: 18px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ===========================
   OMNIBAR TRANSLATION PREVIEW
   =========================== */
.omnibar-preview {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 8px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  z-index: 100;
  animation: slideDown 0.2s ease-out;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.omnibar-preview.hidden {
  display: none;
}

.preview-translation {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: center;
  font-size: 14px;
  color: var(--text-primary);
}

.preview-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--text-tertiary);
  font-size: 13px;
}

.spin {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  100% {
    transform: rotate(360deg);
  }
}

/* ===========================
   THEME TOGGLE BUTTON
   =========================== */
.theme-toggle {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 1000;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  transition: all var(--transition-fast);
}

.theme-toggle:hover {
  transform: scale(1.1) rotate(15deg);
  background: var(--bg-hover);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  border-color: var(--accent);
}

.theme-toggle:active {
  transform: scale(0.95);
}

.theme-toggle ion-icon {
  font-size: 28px;
  color: var(--accent);
  transition: transform 0.3s ease;
}

.theme-toggle:hover ion-icon {
  transform: rotate(-15deg);
}

@media (max-width: 768px) {
  .theme-toggle {
    bottom: 80px;
    right: 16px;
    width: 48px;
    height: 48px;
  }
  
  .theme-toggle ion-icon {
    font-size: 24px;
  }
}
