/* ==========================================================================
   Feedback Component Stylesheet - Toast Notifications & Confirm Dialogs
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Generic Modal Backdrop & Dialog
   -------------------------------------------------------------------------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 10000; /* Luôn hiển thị trên cùng, cao hơn cả Flashcard Study Overlay */
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.modal-backdrop.active {
  display: flex;
}

.modal-dialog {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 440px;
  max-height: min(88vh, calc(100dvh - 32px));
  margin: auto;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  box-sizing: border-box;
}

[data-theme="light"] .modal-dialog {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  box-shadow: 0 20px 45px rgba(15, 23, 42, 0.16);
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

[data-theme="light"] .modal-header {
  border-bottom: 1px solid #f1f5f9;
  color: #0f172a;
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

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

[data-theme="light"] .modal-footer {
  border-top: 1px solid #f1f5f9;
}

/* --------------------------------------------------------------------------
   2. Custom In-App Confirm Dialog (Optimized for PC & Mobile)
   -------------------------------------------------------------------------- */
.confirm-dialog {
  position: relative;
  text-align: center;
  padding: 32px 28px 24px 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  width: 100%;
  max-width: 440px !important;
  border-radius: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
  animation: modalPopIn 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

[data-theme="light"] .confirm-dialog {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  box-shadow: 0 24px 50px rgba(15, 23, 42, 0.16);
}

@keyframes modalPopIn {
  from {
    opacity: 0;
    transform: scale(0.92) translateY(8px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.confirm-modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
  z-index: 5;
}

[data-theme="light"] .confirm-modal-close {
  background: #f1f5f9;
  border: none;
}

.confirm-modal-close:hover {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

[data-theme="light"] .confirm-modal-close:hover {
  background: rgba(239, 68, 68, 0.12);
  color: #ef4444;
}

.confirm-icon-wrapper {
  width: 62px;
  height: 62px;
  border-radius: var(--radius-full);
  background: rgba(239, 68, 68, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.85rem;
  margin-top: 2px;
  box-shadow: 0 4px 16px rgba(239, 68, 68, 0.15);
}

.confirm-icon-wrapper.danger {
  background: rgba(239, 68, 68, 0.15);
}

.confirm-title {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.015em;
  margin: 0;
}

.confirm-message {
  font-size: 0.94rem;
  color: var(--text-secondary);
  line-height: 1.55;
  padding: 0 8px;
  margin: 0;
}

.confirm-actions {
  display: flex;
  width: 100%;
  margin-top: 10px;
  gap: 12px;
}

.btn-confirm-secondary {
  flex: 1;
  min-height: 48px;
  padding: 12px 18px;
  border-radius: 14px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-weight: 700;
  font-size: 0.96rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.15s ease;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

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

.btn-confirm-primary {
  flex: 1.1;
  min-height: 48px;
  padding: 12px 18px;
  border-radius: 14px;
  background: linear-gradient(135deg, #ef4444, #dc2626);
  border: none;
  color: white;
  font-weight: 700;
  font-size: 0.96rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 16px rgba(239, 68, 68, 0.35);
  transition: all 0.15s;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.btn-confirm-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(239, 68, 68, 0.45);
}

.kbd-pill-sm {
  font-family: var(--font-mono, monospace);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  color: var(--text-muted);
  line-height: 1;
  display: inline-flex;
  align-items: center;
}

[data-theme="light"] .kbd-pill-sm {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: #64748b;
}

@media (max-width: 480px) {
  .confirm-dialog {
    max-width: 90% !important;
    padding: 24px 18px 18px 18px;
  }
  .confirm-title {
    font-size: 1.2rem;
  }
  .confirm-message {
    font-size: 0.88rem;
  }
}

/* --------------------------------------------------------------------------
   3. Upgraded Floating Capsule Toast Notifications System
   -------------------------------------------------------------------------- */
.toast-container {
  position: fixed;
  bottom: calc(var(--nav-height, 60px) + 16px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 100000;
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  gap: 8px;
  width: auto;
  max-width: calc(100vw - 32px);
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  padding: 9px 18px;
  border-radius: var(--radius-full);
  background: rgba(30, 41, 59, 0.94);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
  animation: toastPopUp 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  transition: opacity 0.25s ease, transform 0.25s ease;
  white-space: nowrap;
}

[data-theme="light"] .toast {
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(0, 0, 0, 0.1);
  color: #0f172a;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.12);
}

.toast.success {
  border-left: none;
  border-color: rgba(16, 185, 129, 0.4);
}

.toast.info {
  border-left: none;
  border-color: rgba(99, 102, 241, 0.4);
}

.toast.warning {
  border-left: none;
  border-color: rgba(245, 158, 11, 0.4);
}

.toast.error {
  border-left: none;
  border-color: rgba(239, 68, 68, 0.4);
}

.toast-icon {
  font-size: 0.95rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.toast-content {
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0.01em;
}

@keyframes toastPopUp {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
/* ==========================================================================
   Search Modal Component Stylesheet - Universal Spotlight Vocabulary Search
   ========================================================================== */

.modal-dialog.search-modal-dialog,
.search-modal-dialog {
  max-width: 620px !important;
  width: 95%;
  max-height: 85vh;
  height: 680px;
  display: flex;
  flex-direction: column;
  padding: 0;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  position: relative;
}

[data-theme="light"] .search-modal-dialog {
  background: #ffffff;
  border-color: #e2e8f0;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.15);
}

/* Header with Search Input */
.search-modal-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-tertiary);
  flex-shrink: 0;
}

[data-theme="light"] .search-modal-header {
  background: #f8fafc;
  border-color: #e2e8f0;
}

.search-box-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1;
}

.search-box-wrapper .search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 1.05rem;
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: 12px 38px 12px 42px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.95rem;
  font-weight: 500;
  outline: none;
  transition: all 0.2s ease;
  font-family: var(--font-main);
}

[data-theme="light"] .search-input {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: #0f172a;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

.search-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

[data-theme="light"] .search-input:focus {
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.search-clear-btn {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--bg-tertiary);
  border: none;
  color: var(--text-muted);
  width: 22px;
  height: 22px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  transition: all 0.15s ease;
}

.search-clear-btn:hover {
  background: var(--primary);
  color: #ffffff;
}

/* Quick Filter Chips */
.search-quick-filters {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  overflow-x: auto;
  scrollbar-width: none;
  border-bottom: 1px solid var(--border);
  background: var(--bg-secondary);
  flex-shrink: 0;
}

.search-quick-filters::-webkit-scrollbar {
  display: none;
}

[data-theme="light"] .search-quick-filters {
  background: #ffffff;
  border-color: #f1f5f9;
}

.search-filter-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 11px;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 600;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

[data-theme="light"] .search-filter-tag {
  background: #f1f5f9;
  color: #64748b;
  border-color: #e2e8f0;
}

.search-filter-tag:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.search-filter-tag.active {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 2px 8px var(--primary-glow);
}

[data-theme="light"] .search-filter-tag.active {
  background: #4f46e5;
  color: #ffffff;
  border-color: #4f46e5;
}

/* Empty State & History */
.search-empty-state {
  flex: 1;
  overflow-y: auto;
  padding: 20px 18px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.search-empty-hero {
  text-align: center;
  padding: 24px 12px 10px 12px;
  color: var(--text-muted);
}

.search-empty-hero-icon {
  font-size: 2.2rem;
  margin-bottom: 8px;
  display: inline-block;
  animation: pulse 2s infinite ease-in-out;
}

.search-empty-hero-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.search-empty-hero-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
  max-width: 380px;
  margin: 0 auto;
  line-height: 1.4;
}

.search-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 10px;
}

[data-theme="light"] .search-section-title {
  color: #94a3b8;
}

.btn-clear-all-history,
.btn-clear-history {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.74rem;
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
}

.btn-clear-all-history:hover,
.btn-clear-history:hover {
  color: var(--fsrs-again);
}

.search-history-chips,
.search-hot-chips,
.search-chips-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.search-chip,
.search-history-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius-full);
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  user-select: none;
}

[data-theme="light"] .search-chip,
[data-theme="light"] .search-history-chip {
  background: #f8fafc;
  border-color: #e2e8f0;
  color: #334155;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.search-chip:hover,
.search-history-chip:hover {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.08);
  color: var(--primary);
  transform: translateY(-1px);
}

.search-chip.hot-chip {
  background: var(--bg-card);
  border-color: var(--border);
}

[data-theme="light"] .search-chip.hot-chip {
  background: #ffffff;
  border-color: #e2e8f0;
}

.search-chip.hot-chip:hover {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.08);
  color: var(--primary);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.12);
}

.btn-remove-chip,
.search-history-remove {
  font-size: 0.85rem;
  line-height: 1;
  color: var(--text-muted);
  padding: 2px 4px;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.btn-remove-chip:hover,
.search-history-remove:hover {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.1);
}

/* Results Container */
.search-modal-results {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  -webkit-overflow-scrolling: touch;
}

.search-results-summary {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  padding: 2px 4px;
}

/* Rich Result Card */
.search-result-row,
.search-card-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

[data-theme="light"] .search-result-row,
[data-theme="light"] .search-card-item {
  background: #ffffff;
  border-color: #e2e8f0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}

.search-result-row:hover,
.search-card-item:hover,
.search-card-item.selected {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.06);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

[data-theme="light"] .search-result-row:hover,
[data-theme="light"] .search-card-item:hover,
[data-theme="light"] .search-card-item.selected {
  background: #f8faff;
  border-color: #6366f1;
}

.search-row-main {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 0;
}

.search-word-header,
.search-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.search-word-text,
.search-card-word {
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.search-word-phonetic,
.search-card-phonetic {
  color: var(--primary);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 500;
}

[data-theme="light"] .search-word-phonetic,
[data-theme="light"] .search-card-phonetic {
  color: #4f46e5;
}

.search-word-pos,
.search-badge-pos {
  font-size: 0.68rem;
  font-weight: 700;
  font-style: italic;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--bg-tertiary);
  color: var(--text-muted);
}

[data-theme="light"] .search-word-pos,
[data-theme="light"] .search-badge-pos {
  background: #f1f5f9;
  color: #64748b;
}

.search-word-cefr,
.search-badge-cefr {
  font-size: 0.68rem;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 4px;
  text-transform: uppercase;
}

.search-word-cefr.a1, .search-word-cefr.a2,
.search-badge-cefr.a1, .search-badge-cefr.a2 {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
}

.search-word-cefr.b1, .search-word-cefr.b2,
.search-badge-cefr.b1, .search-badge-cefr.b2 {
  background: rgba(59, 130, 246, 0.15);
  color: #3b82f6;
}

.search-word-cefr.c1, .search-word-cefr.c2,
.search-badge-cefr.c1, .search-badge-cefr.c2 {
  background: rgba(168, 85, 247, 0.15);
  color: #a855f7;
}

.badge-status-new {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(148, 163, 184, 0.14);
  color: var(--text-muted);
}

[data-theme="light"] .badge-status-new {
  background: #f1f5f9;
  color: #64748b;
}

.badge-status-learning {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(99, 102, 241, 0.15);
  color: #818cf8;
}

[data-theme="light"] .badge-status-learning {
  background: #eef2ff;
  color: #4f46e5;
}

.badge-status-mastered {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
}

[data-theme="light"] .badge-status-mastered {
  background: #dcfce7;
  color: #15803d;
}

.search-word-meaning,
.search-card-meaning {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.35;
}

[data-theme="light"] .search-word-meaning,
[data-theme="light"] .search-card-meaning {
  color: #1e293b;
}

.search-word-example,
.search-card-example {
  font-size: 0.78rem;
  color: var(--text-secondary);
  font-style: normal;
  line-height: 1.3;
  margin-top: 1px;
}

[data-theme="light"] .search-word-example,
[data-theme="light"] .search-card-example {
  color: #475569;
}

.search-word-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.search-row-actions,
.search-card-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.btn-search-audio,
.btn-search-action-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.15s ease;
}

[data-theme="light"] .btn-search-audio,
[data-theme="light"] .btn-search-action-icon {
  background: #f8fafc;
  border-color: #e2e8f0;
  color: #475569;
}

.btn-search-audio:hover,
.btn-search-action-icon:hover {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
  transform: scale(1.08);
}

/* Highlight Match */
.search-highlight {
  background: rgba(245, 158, 11, 0.25);
  color: #f59e0b;
  font-weight: 700;
  padding: 0 2px;
  border-radius: 3px;
}

[data-theme="light"] .search-highlight {
  background: #fef3c7;
  color: #b45309;
}

/* No Results State */
.search-no-result {
  text-align: center;
  padding: 44px 20px;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.no-result-icon {
  font-size: 2.2rem;
  margin-bottom: 4px;
  opacity: 0.8;
}

.no-result-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
}

.no-result-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
  max-width: 360px;
  line-height: 1.4;
}

/* Footer with Shortcuts */
.search-modal-footer {
  padding: 10px 16px;
  background: var(--bg-tertiary);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  font-size: 0.76rem;
  color: var(--text-muted);
}

[data-theme="light"] .search-modal-footer {
  background: #f8fafc;
  border-color: #e2e8f0;
}

.search-shortcut-hints {
  display: flex;
  align-items: center;
  gap: 12px;
}

.search-shortcut-hints kbd {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-primary);
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .search-shortcut-hints kbd {
  background: #ffffff;
  border-color: #cbd5e1;
  color: #334155;
}

.search-result-count-label {
  font-weight: 600;
}

/* Mobile Responsiveness */
@media (max-width: 640px) {
  .search-modal-dialog {
    width: 100%;
    height: 90vh;
    max-height: 90vh;
    border-radius: 18px 18px 0 0;
    margin-top: auto;
  }

  .search-modal-header {
    padding: 12px 14px;
  }

  .search-shortcut-hints {
    display: none;
  }
}
/* ==========================================================================
   Sync Modal Stylesheet - Universal 2-Way Smart Sync (1-Touch QR Pairing)
   ========================================================================== */

.sync-modal-dialog {
  max-width: 440px;
  width: 92%;
  border-radius: var(--radius-xl);
  background: var(--bg-card);
  border: 1px solid var(--border);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.45);
  overflow: hidden;
  padding: 0;
  display: flex;
  flex-direction: column;
}

[data-theme="light"] .sync-modal-dialog {
  background: #ffffff;
  border-color: #e2e8f0;
  box-shadow: 0 20px 40px -10px rgba(15, 23, 42, 0.15);
}

.sync-modal-header {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  background: var(--bg-glass);
}

[data-theme="light"] .sync-modal-header {
  background: #f8fafc;
  border-color: #f1f5f9;
}

.sync-modal-title-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sync-modal-icon {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--primary) 0%, #06b6d4 100%);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35);
}

.sync-modal-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.sync-modal-subtitle {
  font-size: 0.76rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.sync-modal-body {
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-height: calc(88vh - 70px);
  overflow-y: auto;
}

/* ================= 1. SCANNER ACTION BOX ================= */
.sync-scanner-action-box {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.camera-scanner-wrapper {
  position: relative;
  width: 100%;
  height: 220px;
  background: #000000;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  display: none;
}

.camera-scanner-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.camera-reticle {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 150px;
  height: 150px;
  border: 2px solid rgba(99, 102, 241, 0.85);
  border-radius: 16px;
  box-shadow: 0 0 0 4000px rgba(0, 0, 0, 0.55);
  pointer-events: none;
}

.camera-reticle:before, .camera-reticle:after {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  border-color: #38bdf8;
  border-style: solid;
}

.camera-reticle:before {
  top: -2px;
  left: -2px;
  border-width: 3px 0 0 3px;
  border-top-left-radius: 14px;
}

.camera-reticle:after {
  bottom: -2px;
  right: -2px;
  border-width: 0 3px 3px 0;
  border-bottom-right-radius: 14px;
}

.camera-laser {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, transparent, #38bdf8, #818cf8, transparent);
  box-shadow: 0 0 10px #38bdf8;
  animation: laserScan 2s ease-in-out infinite alternate;
}

@keyframes laserScan {
  0% { top: 6px; }
  100% { top: calc(100% - 8px); }
}

.btn-stop-camera {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 6px 12px;
  border-radius: var(--radius-full);
  border: none;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(8px);
  color: #ffffff;
  font-family: var(--font-sans);
  font-size: 0.76rem;
  font-weight: 700;
  cursor: pointer;
  z-index: 10;
}

/* ================= DIVIDER ================= */
.sync-divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 2px 0;
}

.sync-divider::before,
.sync-divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px dashed var(--border);
}

.sync-divider span {
  padding: 0 12px;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.08em;
}

/* ================= 2. QR DISPLAY CARD ================= */
.sync-receive-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}

[data-theme="light"] .sync-receive-card {
  background: #f8fafc;
  border-color: #e2e8f0;
}

.sync-radar-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  border-radius: var(--radius-full);
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.25);
  color: #10b981;
  font-size: 0.75rem;
  font-weight: 700;
}

.radar-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  animation: radarPulse 1.8s infinite;
}

@keyframes radarPulse {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.sync-qr-frame {
  width: 190px;
  height: 190px;
  background: #ffffff;
  padding: 8px;
  border-radius: var(--radius-md);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid rgba(99, 102, 241, 0.2);
}

.sync-qr-frame img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.sync-pin-banner {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sync-pin-title {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
}

.sync-pin-number {
  font-family: var(--font-mono);
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: var(--primary);
  background: var(--bg-card);
  padding: 2px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

[data-theme="light"] .sync-pin-number {
  background: #ffffff;
  color: #4338ca;
  border-color: #cbd5e1;
}

.sync-actions-row {
  display: flex;
  gap: 8px;
  width: 100%;
}

.btn-sync-action {
  flex: 1;
  padding: 9px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn-sync-action:hover {
  background: var(--bg-tertiary);
  border-color: var(--primary);
  color: var(--primary);
}

.btn-sync-action.primary {
  background: linear-gradient(135deg, var(--primary) 0%, #06b6d4 100%);
  border: none;
  color: #ffffff;
  font-weight: 700;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.3);
}

.btn-sync-action.primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(99, 102, 241, 0.45);
}

/* ================= 3. MANUAL INPUT BOX ================= */
.sync-input-field-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.sync-input-field {
  width: 100%;
  padding: 11px 14px;
  padding-right: 90px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border);
  background: var(--bg-tertiary);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.92rem;
  font-weight: 700;
  outline: none;
  transition: all var(--transition-fast);
}

.sync-input-field:focus {
  border-color: var(--primary);
  background: var(--bg-card);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

[data-theme="light"] .sync-input-field {
  background: #f8fafc;
  border-color: #cbd5e1;
}

.btn-paste-inside {
  position: absolute;
  right: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  border: none;
  background: var(--primary);
  color: #ffffff;
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-paste-inside:hover {
  background: #4338ca;
}

/* ==========================================================================
   7. BEHAVIORAL OPTIMIZER MODAL & FEATURE CARD STYLES
   ========================================================================== */

.optimizer-feature-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  margin-bottom: 12px;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(168, 85, 247, 0.06) 100%);
  border: 1px solid rgba(99, 102, 241, 0.25);
  border-radius: var(--radius-lg);
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.06);
  flex-wrap: wrap;
}

[data-theme="light"] .optimizer-feature-card {
  background: linear-gradient(135deg, #eef2ff 0%, #f5f3ff 100%);
  border-color: #c7d2fe;
}

.optimizer-feature-left {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  flex: 1 1 180px;
}

.optimizer-feature-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--primary);
  background: rgba(99, 102, 241, 0.15);
  padding: 2px 8px;
  border-radius: 999px;
  width: fit-content;
  margin-bottom: 2px;
}

.optimizer-feature-title {
  font-size: 0.95rem;
  font-weight: 750;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.optimizer-feature-desc {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.btn-run-optimizer {
  white-space: nowrap;
  padding: 9px 15px !important;
  font-size: 0.85rem !important;
  font-weight: 750;
  border-radius: 12px !important;
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  border: none;
  color: #ffffff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex-shrink: 0;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  text-decoration: none;
}

@media (max-width: 480px) {
  .optimizer-feature-card {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 12px 14px;
  }
  .optimizer-feature-left {
    flex: unset;
    width: 100%;
  }
  .btn-run-optimizer {
    width: 100%;
    padding: 10px 14px !important;
  }
  .optimizer-dialog {
    width: 95% !important;
    max-width: 95% !important;
    margin: 10px auto;
  }
  .optimizer-header, .optimizer-body {
    padding: 14px 16px !important;
  }
}

.btn-run-optimizer:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.45);
  filter: brightness(1.08);
}

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

/* Close Icon Button */
.btn-icon-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  cursor: pointer;
  transition: all 0.2s ease;
  padding: 0;
  flex-shrink: 0;
}

.btn-icon-close:hover {
  background: var(--bg-hover, rgba(255, 255, 255, 0.1));
  color: var(--text-primary);
  transform: scale(1.08);
}

[data-theme="light"] .btn-icon-close:hover {
  background: rgba(0, 0, 0, 0.06);
}

/* Optimizer Modal Dialog */
.optimizer-dialog {
  max-width: 540px !important;
  border-radius: 20px;
}

.optimizer-header {
  padding: 18px 22px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.optimizer-title-group {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.optimizer-icon {
  font-size: 1.8rem;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: rgba(99, 102, 241, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.optimizer-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text-primary);
  margin: 0;
}

.optimizer-subtitle {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin: 2px 0 0 0;
}

.optimizer-body {
  padding: 20px 22px;
}

.optimizer-section-label {
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.optimizer-profile-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.profile-stat-box {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

[data-theme="light"] .profile-stat-box {
  background: #f8fafc;
  border-color: #e2e8f0;
}

.stat-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.stat-icon {
  font-size: 1.1rem;
}

.stat-num {
  font-size: 1.25rem;
  font-weight: 800;
  font-family: var(--font-mono);
  color: var(--text-primary);
}

.stat-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-primary);
}

.stat-desc {
  font-size: 0.75rem;
  line-height: 1.3;
}

.optimizer-alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  margin-top: 12px;
  font-size: 0.8rem;
  line-height: 1.45;
}

.optimizer-alert.warning {
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.35);
  color: #fbbf24;
}

[data-theme="light"] .optimizer-alert.warning {
  background: #fffbeb;
  border-color: #fde68a;
  color: #b45309;
}

.recommendations-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.rec-card {
  background: var(--bg-tertiary);
  border: 1.5px solid rgba(99, 102, 241, 0.25);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

[data-theme="light"] .rec-card {
  background: #f8fafc;
  border-color: #c7d2fe;
}

.rec-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.rec-icon {
  font-size: 1.15rem;
}

.rec-label {
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--text-primary);
}

.rec-diff {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  font-family: var(--font-mono);
  font-weight: 700;
}

.rec-val.old {
  color: var(--text-muted);
  text-decoration: line-through;
}

.rec-arrow {
  color: var(--primary);
  font-weight: 800;
}

.rec-val.new {
  color: var(--primary);
  background: rgba(99, 102, 241, 0.12);
  padding: 2px 8px;
  border-radius: 6px;
  border: 1px solid rgba(99, 102, 241, 0.25);
}

.rec-reason {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.45;
}

.optimizer-perfect-state {
  text-align: center;
  padding: 24px 16px;
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: var(--radius-md);
}

.perfect-icon {
  font-size: 2.2rem;
  margin-bottom: 8px;
}

.optimizer-perfect-state h4 {
  margin: 0 0 6px 0;
  font-size: 1rem;
  font-weight: 800;
  color: #10b981;
}

.optimizer-perfect-state p {
  margin: 0;
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.45;
}

.optimizer-footer {
  padding: 14px 22px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

/* ==========================================================================
   10. Smart Goal & Study Planner Modal Styles
   ========================================================================== */
.goal-planner-dialog {
  max-width: 680px !important;
  width: 94%;
  max-height: 90vh;
  border-radius: 22px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.45);
  animation: modalPopIn 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

[data-theme="light"] .goal-planner-dialog {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.08);
  box-shadow: 0 25px 60px rgba(15, 23, 42, 0.16);
}

.goal-planner-header {
  padding: 16px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
}

.goal-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.goal-planner-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, #10b981, #06b6d4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.28);
}

.goal-planner-titles {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.goal-planner-titles .modal-title {
  font-size: 1.05rem;
  font-weight: 850;
  color: var(--text-primary);
  margin: 0;
  letter-spacing: -0.01em;
}

.goal-planner-titles .modal-subtitle {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.goal-planner-body {
  padding: 18px 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
  flex: 1;
}

/* 1. Status Strip */
.planner-status-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  width: 100%;
}

.planner-status-tile {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

[data-theme="light"] .planner-status-tile {
  background: #f8fafc;
  border-color: #e2e8f0;
}

.status-tile-lbl {
  font-size: 0.62rem;
  font-weight: 800;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.status-tile-val {
  font-size: 1rem;
  font-weight: 900;
  font-family: var(--font-mono);
  color: var(--text-primary);
  line-height: 1.2;
}

.status-unit {
  font-size: 0.7rem;
  font-weight: 600;
  font-family: var(--font-sans);
  color: var(--text-muted);
}

/* 2. Planner Sections */
.planner-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.planner-section-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.planner-section-num {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--primary);
  color: #ffffff;
  font-size: 0.68rem;
  font-weight: 850;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.planner-section-title {
  font-size: 0.8rem;
  font-weight: 850;
  color: var(--text-primary);
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.planner-section-hint {
  font-size: 0.68rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* Stages 8 Grid (4x2 on Desktop, 2x4 on Mobile) */
.planner-stages-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  width: 100%;
}

@media (max-width: 620px) {
  .planner-stages-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.planner-stage-card {
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  cursor: pointer;
  transition: all 0.18s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  user-select: none;
  min-height: 66px;
  box-sizing: border-box;
}

[data-theme="light"] .planner-stage-card {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.08);
}

.planner-stage-card:hover {
  transform: translateY(-2px);
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.12);
}

.planner-stage-card.selected {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.08);
  box-shadow: 0 0 0 1.5px var(--primary);
}

[data-theme="light"] .planner-stage-card.selected {
  background: rgba(99, 102, 241, 0.05);
}

.planner-stage-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
}

.planner-stage-icon {
  font-size: 0.95rem;
  line-height: 1;
}

.planner-stage-badge {
  font-size: 0.58rem;
  font-weight: 800;
  color: var(--text-muted);
  text-transform: uppercase;
}

.stage-tag {
  font-size: 0.58rem;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: 99px;
  white-space: nowrap;
}

.stage-tag.tag-done {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
}

.stage-tag.tag-selected {
  background: var(--primary);
  color: #ffffff;
}

.stage-tag.tag-current {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
}

.planner-stage-name {
  font-size: 0.74rem;
  font-weight: 800;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}

.planner-stage-target {
  font-size: 0.68rem;
  font-weight: 800;
  font-family: var(--font-mono);
  color: var(--primary);
}

.planner-stage-pct-row {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 1px;
}

.planner-stage-mini-track {
  flex: 1;
  height: 4px;
  background: var(--bg-tertiary);
  border-radius: 99px;
  overflow: hidden;
}

.planner-stage-mini-fill {
  height: 100%;
  border-radius: 99px;
  background: #10b981;
}

.planner-stage-pct-val {
  font-size: 0.58rem;
  font-weight: 800;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

/* Pace Selection Row */
.planner-pace-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.btn-pace-preset {
  flex: 1;
  min-height: 46px;
  padding: 6px 8px;
  border-radius: 12px;
  background: var(--bg-secondary);
  border: 1.5px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  cursor: pointer;
  transition: all 0.16s ease;
}

[data-theme="light"] .btn-pace-preset {
  background: #f8fafc;
  border-color: #e2e8f0;
}

.btn-pace-preset:hover {
  border-color: var(--primary);
  transform: translateY(-1px);
}

.btn-pace-preset.active {
  background: linear-gradient(135deg, var(--primary), #4f46e5);
  border-color: var(--primary);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.25);
}

.btn-pace-preset .pace-val {
  font-size: 1.1rem;
  font-weight: 900;
  font-family: var(--font-mono);
  line-height: 1;
}

.btn-pace-preset .pace-sub-tag {
  font-size: 0.56rem;
  font-weight: 750;
  color: var(--text-muted);
}

.btn-pace-preset.active .pace-sub-tag {
  color: rgba(255, 255, 255, 0.9);
}

.planner-custom-pace {
  display: flex;
  align-items: center;
  gap: 5px;
  background: var(--bg-secondary);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 6px 10px;
  min-height: 46px;
  box-sizing: border-box;
}

[data-theme="light"] .planner-custom-pace {
  background: #f8fafc;
  border-color: #e2e8f0;
}

.custom-pace-lbl {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text-muted);
  white-space: nowrap;
}

.planner-custom-pace input {
  width: 44px;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 1.05rem;
  font-weight: 900;
  font-family: var(--font-mono);
  outline: none;
  text-align: center;
  padding: 0;
}

.custom-pace-unit {
  font-size: 0.65rem;
  font-weight: 750;
  color: var(--text-muted);
  white-space: nowrap;
}

/* Simulation Box */
.planner-sim-box {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.07), rgba(16, 185, 129, 0.07));
  border: 1.5px solid rgba(99, 102, 241, 0.22);
  border-radius: 16px;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sim-header {
  display: flex;
  align-items: center;
  gap: 6px;
}

.sim-icon {
  font-size: 1rem;
}

.sim-title {
  font-size: 0.68rem;
  font-weight: 850;
  letter-spacing: 0.04em;
  color: var(--primary);
  text-transform: uppercase;
}

.sim-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px 16px;
}

.sim-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.sim-label {
  font-size: 0.68rem;
  color: var(--text-muted);
  font-weight: 700;
}

.sim-val {
  font-size: 0.82rem;
  font-weight: 800;
  font-family: var(--font-mono);
  color: var(--text-primary);
}

.sim-val.highlight {
  color: #10b981;
  font-size: 0.95rem;
  font-weight: 900;
}

.sim-discipline-banner {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

[data-theme="light"] .sim-discipline-banner {
  background: #ffffff;
}

.discipline-tag {
  font-size: 0.65rem;
  font-weight: 850;
  padding: 2px 6px;
  border-radius: 6px;
  display: inline-block;
  width: fit-content;
}

.discipline-tag.tag-easy { background: rgba(14, 165, 233, 0.12); color: #0284c7; }
.discipline-tag.tag-standard { background: rgba(16, 185, 129, 0.12); color: #059669; }
.discipline-tag.tag-accelerate { background: rgba(245, 158, 11, 0.12); color: #d97706; }
.discipline-tag.tag-hardcore { background: rgba(239, 68, 68, 0.12); color: #dc2626; }

.discipline-desc {
  font-size: 0.72rem;
  color: var(--text-secondary);
  line-height: 1.35;
}

/* Footer & Buttons */
.goal-planner-footer {
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  flex-shrink: 0;
}

.btn-planner-cancel {
  padding: 10px 18px;
  font-size: 0.85rem;
  font-weight: 750;
  border-radius: 10px;
  background: var(--bg-secondary);
  border: 1.5px solid var(--border);
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.16s ease;
}

[data-theme="light"] .btn-planner-cancel {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

.btn-planner-cancel:hover {
  background: var(--bg-tertiary);
  border-color: var(--text-muted);
}

.btn-planner-save {
  padding: 10px 24px;
  font-size: 0.88rem;
  font-weight: 850;
  border-radius: 10px;
  background: linear-gradient(135deg, #10b981, #059669);
  color: #ffffff;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.3);
  transition: all 0.18s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn-planner-save:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
  filter: brightness(1.05);
}

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

/* ==========================================================================
   STREAK RECOVERY BANNER (HOME DASHBOARD ALERT)
   ========================================================================== */

.streak-recovery-alert-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.12), rgba(239, 68, 68, 0.08));
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: var(--radius-lg, 16px);
  cursor: pointer;
  margin-bottom: 12px;
  transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(245, 158, 11, 0.08);
}

.streak-recovery-alert-card:hover {
  transform: translateY(-1.5px);
  border-color: rgba(245, 158, 11, 0.55);
  box-shadow: 0 6px 20px rgba(245, 158, 11, 0.16);
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.16), rgba(239, 68, 68, 0.12));
}

.alert-pulse-dot {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #ef4444;
  box-shadow: 0 0 0 rgba(239, 68, 68, 0.6);
  animation: pulseBrokenStreak 1.8s infinite;
}

.recovery-icon-badge {
  font-size: 1.5rem;
  line-height: 1;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(245, 158, 11, 0.18);
  border: 1px solid rgba(245, 158, 11, 0.3);
  flex-shrink: 0;
}

.recovery-text-group {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.recovery-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.recovery-main-title {
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--text-primary);
}

.recovery-badge-pill {
  font-size: 0.64rem;
  font-weight: 800;
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #ef4444;
  text-transform: uppercase;
}

.recovery-sub-text {
  font-size: 0.74rem;
  color: var(--text-secondary);
  line-height: 1.35;
}

.btn-recovery-cta {
  flex-shrink: 0;
  padding: 8px 14px;
  font-size: 0.78rem;
  font-weight: 800;
  border-radius: 10px;
  border: none;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #ffffff;
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(245, 158, 11, 0.3);
  transition: all 0.18s ease;
  white-space: nowrap;
}

.btn-recovery-cta:hover {
  transform: translateY(-1px);
  filter: brightness(1.08);
}

/* ==========================================================================
   STREAK HUB & RECOVERY MODAL
   ========================================================================== */

.streak-hub-dialog {
  max-width: 480px;
}

.badge-streak-hub {
  background: rgba(245, 158, 11, 0.16);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: #f59e0b;
}

.streak-hub-grid {
  grid-template-columns: repeat(3, 1fr) !important;
  gap: 8px !important;
  margin-bottom: 14px !important;
}

.streak-hub-grid .quick-stat-tile {
  position: relative;
  padding: 10px 8px !important;
  text-align: center;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
}

.streak-hub-grid .tile-icon {
  font-size: 1.35rem;
  margin-bottom: 2px;
}

.streak-hub-grid .tile-val {
  font-size: 1.15rem !important;
}

.streak-hub-grid .tile-label {
  font-size: 0.65rem !important;
  white-space: nowrap;
}

.tile-broken-state {
  border-color: rgba(239, 68, 68, 0.4) !important;
  background: rgba(239, 68, 68, 0.06) !important;
}

.tile-tag-broken {
  display: inline-block;
  font-size: 0.58rem;
  font-weight: 800;
  color: #ef4444;
  background: rgba(239, 68, 68, 0.12);
  border-radius: 4px;
  padding: 1px 4px;
  margin-top: 2px;
}

/* Broken Alert Section */
.streak-hub-broken-alert {
  background: var(--bg-tertiary);
  border: 1px solid rgba(245, 158, 11, 0.28);
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.broken-alert-header {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.broken-alert-icon {
  font-size: 1.4rem;
  line-height: 1;
}

.broken-alert-title {
  font-size: 0.94rem;
  font-weight: 800;
  color: var(--text-primary);
  margin: 0 0 2px 0;
}

.broken-alert-sub {
  font-size: 0.72rem;
  color: var(--text-secondary);
}

.broken-alert-desc {
  font-size: 0.76rem;
  color: var(--text-secondary);
  line-height: 1.45;
  margin: 0;
}

/* Option Cards */
.streak-recovery-option-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  transition: all 0.2s ease;
}

.streak-recovery-option-card.option-available {
  border-color: rgba(99, 102, 241, 0.3);
}

.streak-recovery-option-card.option-disabled {
  opacity: 0.6;
}

.option-icon-box {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
}

.option-info {
  flex: 1;
  min-width: 0;
}

.option-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 3px;
  flex-wrap: wrap;
}

.option-name {
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--text-primary);
}

.option-badge {
  font-size: 0.62rem;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 6px;
}

.option-badge.badge-ok {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
}

.option-badge.badge-empty {
  background: rgba(148, 163, 184, 0.15);
  color: var(--text-muted);
}

.option-badge.badge-quiz {
  background: rgba(99, 102, 241, 0.15);
  color: var(--primary);
}

.option-badge.badge-cooldown {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
}

.option-desc {
  font-size: 0.7rem;
  color: var(--text-secondary);
  line-height: 1.35;
  margin: 0;
}

.btn-use-streak-freeze {
  flex-shrink: 0;
  padding: 8px 12px;
  font-size: 0.74rem;
  font-weight: 800;
  border-radius: 8px;
  border: none;
  background: linear-gradient(135deg, #0284c7, #0369a1);
  color: #ffffff;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.18s ease;
}

.btn-use-streak-freeze:hover:not(:disabled) {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.btn-use-streak-freeze:disabled {
  background: var(--bg-tertiary);
  color: var(--text-muted);
  cursor: not-allowed;
}

.btn-start-redemption-quiz {
  flex-shrink: 0;
  padding: 8px 12px;
  font-size: 0.74rem;
  font-weight: 800;
  border-radius: 8px;
  border: none;
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  color: #ffffff;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.18s ease;
}

.btn-start-redemption-quiz:hover:not(:disabled) {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.btn-start-redemption-quiz:disabled {
  background: var(--bg-tertiary);
  color: var(--text-muted);
  cursor: not-allowed;
}

/* Safe State Card */
.streak-hub-safe-card {
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 12px;
}

.safe-status-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.safe-status-icon {
  font-size: 1.3rem;
  line-height: 1;
}

.safe-status-title {
  font-size: 0.86rem;
  font-weight: 800;
  color: var(--text-primary);
  margin: 0 0 2px 0;
}

.safe-status-sub {
  font-size: 0.72rem;
  color: var(--text-secondary);
  line-height: 1.35;
}

/* Rules Box */
.streak-hub-rules-box {
  background: var(--bg-tertiary) !important;
  border: 1px solid var(--border) !important;
  border-radius: 12px !important;
  padding: 10px 12px !important;
}

@media (max-width: 480px) {
  .streak-recovery-option-card {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .btn-use-streak-freeze,
  .btn-start-redemption-quiz {
    width: 100%;
    text-align: center;
  }
}

/* ==========================================================================
   SMART MICRO-BATCHING CHECKPOINT MODAL
   ========================================================================== */
.study-checkpoint-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.study-checkpoint-modal.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.study-checkpoint-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.study-checkpoint-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
  background: var(--bg-card, #ffffff);
  border: 1px solid var(--border, rgba(0, 0, 0, 0.1));
  border-radius: 24px;
  padding: 24px 20px;
  box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.3);
  text-align: center;
  box-sizing: border-box;
  transform: scale(0.95) translateY(10px);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.study-checkpoint-modal.active .study-checkpoint-card {
  transform: scale(1) translateY(0);
}

[data-theme="dark"] .study-checkpoint-card {
  background: #1e293b;
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.6);
}

.checkpoint-celebration-icon {
  font-size: 2.8rem;
  margin-bottom: 8px;
  display: inline-block;
  animation: checkpointBounce 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes checkpointBounce {
  0% { transform: scale(0.4); opacity: 0; }
  60% { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(1); }
}

.checkpoint-title {
  font-size: 1.25rem;
  font-weight: 850;
  color: var(--text-primary);
  margin: 0 0 6px 0;
}

.checkpoint-desc {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.4;
  margin: 0 0 16px 0;
}

.checkpoint-stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  background: var(--bg-tertiary, #f8fafc);
  border: 1px solid var(--border, rgba(0, 0, 0, 0.06));
  border-radius: 14px;
  padding: 10px 6px;
  margin-bottom: 18px;
}

[data-theme="dark"] .checkpoint-stats-row {
  background: rgba(15, 23, 42, 0.6);
  border-color: rgba(255, 255, 255, 0.06);
}

.cp-stat-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  align-items: center;
}

.cp-stat-val {
  font-size: 1.15rem;
  font-weight: 850;
  color: var(--primary, #6366f1);
  font-family: var(--font-mono, monospace);
}

.cp-stat-lbl {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
}

.checkpoint-actions-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.btn-checkpoint-continue {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 18px;
  background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
  color: #ffffff;
  border: none;
  border-radius: 14px;
  font-size: 0.88rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
  transition: all 0.2s ease;
}

.btn-checkpoint-continue:hover {
  transform: translateY(-1px);
  filter: brightness(1.08);
  box-shadow: 0 6px 18px rgba(99, 102, 241, 0.45);
}

.btn-checkpoint-continue:active {
  transform: scale(0.98);
}

.btn-checkpoint-rest {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  background: rgba(14, 165, 233, 0.1);
  color: #0284c7;
  border: 1px solid rgba(14, 165, 233, 0.25);
  border-radius: 14px;
  font-size: 0.82rem;
  font-weight: 750;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-checkpoint-rest:hover {
  background: rgba(14, 165, 233, 0.18);
  border-color: rgba(14, 165, 233, 0.4);
}

[data-theme="dark"] .btn-checkpoint-rest {
  color: #38bdf8;
  background: rgba(14, 165, 233, 0.15);
  border-color: rgba(14, 165, 233, 0.3);
}

.btn-checkpoint-finish {
  padding: 8px 14px;
  background: transparent;
  color: var(--text-muted);
  border: none;
  font-size: 0.78rem;
  font-weight: 650;
  cursor: pointer;
  transition: color 0.18s ease;
}

.btn-checkpoint-finish:hover {
  color: var(--text-primary);
  text-decoration: underline;
}


