/* ============================================================================
   MAX EXAM LAB — STUDENT SATISFACTION SUITE (Track E)
   Master Design Tokens matching Vocabulary Trainer canonical dark glass UI.
   Covers:
   1. "Jump Back In" Smart HUD
   2. Fullscreen Zen / Exam Focus Mode
   3. Keyboard-First Exam Navigation & Shortcut Tooltip Cheatsheet
   4. Daily Study Streak & Goal Tracker Widget
   5. Instant Offline State Protection Indicator
   6. Tactile Audio Feedback & Mute Toggle Controls
   ============================================================================ */

:root {
  --mel-sat-emerald: #00f5c4;
  --mel-sat-teal: #0d9488;
  --mel-sat-cyan: #38bdf8;
  --mel-sat-gold: #ffd166;
  --mel-sat-bg: #060b0a;
  --mel-sat-glass: rgba(14, 25, 23, 0.85);
  --mel-sat-glass-card: rgba(16, 28, 26, 0.75);
  --mel-sat-border: rgba(255, 255, 255, 0.12);
  --mel-sat-border-hover: rgba(0, 245, 196, 0.45);
  --mel-sat-text: #f3fbf8;
  --mel-sat-text-muted: #94a8a2;
}

/* ----------------------------------------------------------------------------
   1. "JUMP BACK IN" SMART HUD BANNER
   ---------------------------------------------------------------------------- */
.smart-resume-hud {
  position: relative;
  z-index: 95;
  width: 100%;
  max-width: 1180px;
  margin: 14px auto 0;
  padding: 0 16px;
  animation: melHudSlideDown 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

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

.resume-hud-container {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 18px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(14, 28, 25, 0.88), rgba(8, 18, 16, 0.94));
  border: 1px solid rgba(0, 245, 196, 0.32);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 18px rgba(0, 245, 196, 0.15);
  color: var(--mel-sat-text);
}

.resume-hud-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(0, 245, 196, 0.10);
  border: 1px solid rgba(0, 245, 196, 0.4);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--mel-sat-emerald);
  white-space: nowrap;
}

.resume-hud-badge .pulse-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--mel-sat-emerald);
  box-shadow: 0 0 8px var(--mel-sat-emerald);
  animation: melPulseDot 1.8s ease-in-out infinite;
}

@keyframes melPulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

.resume-hud-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.resume-hud-title {
  font-size: 14px;
  font-weight: 700;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.resume-hud-meta {
  font-size: 12px;
  color: var(--mel-sat-text-muted);
}

.resume-hud-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.resume-hud-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  min-height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(13, 148, 136, 0.95), rgba(16, 185, 129, 0.98));
  border: 1px solid rgba(0, 245, 196, 0.5);
  color: #04120f !important;
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
  box-shadow: 0 4px 14px rgba(0, 245, 196, 0.3);
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.resume-hud-cta:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(0, 245, 196, 0.45);
}

.resume-hud-dismiss {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
  color: var(--mel-sat-text-muted);
  font-size: 16px;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: all 0.16s ease;
}

.resume-hud-dismiss:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.25);
}

/* ----------------------------------------------------------------------------
   2. FULLSCREEN ZEN / EXAM FOCUS MODE
   ---------------------------------------------------------------------------- */
.zen-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 13px;
  min-height: 34px;
  border-radius: 10px;
  background: rgba(16, 28, 26, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--mel-sat-text);
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  backdrop-filter: blur(12px);
  transition: all 0.2s ease;
}

.zen-toggle-btn:hover {
  border-color: var(--mel-sat-emerald);
  color: var(--mel-sat-emerald);
  box-shadow: 0 0 14px rgba(0, 245, 196, 0.22);
}

/* Compact sizing when mounted inside sidebar navigator headers */
.nav-header .zen-toggle-btn,
#ieltsNavigator .nav-header .zen-toggle-btn,
#navigator .nav-header .zen-toggle-btn {
  padding: 3px 7px;
  min-height: 24px;
  border-radius: 8px;
  font-size: 10.5px;
  font-weight: 700;
  gap: 4px;
  flex-shrink: 0;
  white-space: nowrap;
  box-sizing: border-box;
}

.nav-header .zen-toggle-btn:hover,
#ieltsNavigator .nav-header .zen-toggle-btn:hover,
#navigator .nav-header .zen-toggle-btn:hover {
  border-color: #00f5c4;
  color: #00f5c4;
  box-shadow: 0 0 10px rgba(0, 245, 196, 0.2);
}

/* When Zen Mode is Active */
body.mel-zen-mode-active {
  background-color: #030605 !important;
}

body.mel-zen-mode-active #siteHeader,
body.mel-zen-mode-active .max-section-header,
body.mel-zen-mode-active .max-global-nav,
body.mel-zen-mode-active .footer,
body.mel-zen-mode-active .launch-footer {
  display: none !important;
}

body.mel-zen-mode-active .layout {
  max-width: 1300px !important;
  margin: 0 auto !important;
  padding-top: 20px !important;
}

body.mel-zen-mode-active .exam-content {
  font-size: 1.05em !important;
  line-height: 1.75 !important;
}

.zen-exit-floating-bar {
  display: none;
}

body.mel-zen-mode-active .zen-exit-floating-bar {
  display: flex !important;
  position: fixed;
  top: 14px;
  right: 20px;
  z-index: 9999;
  align-items: center;
  gap: 12px;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(14, 25, 23, 0.92);
  border: 1px solid rgba(0, 245, 196, 0.4);
  backdrop-filter: blur(20px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
}

.zen-exit-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #ffffff;
  padding: 5px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.16s ease;
}

.zen-exit-btn:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.5);
  color: #fca5a5;
}

/* ----------------------------------------------------------------------------
   3. KEYBOARD-FIRST EXAM SHORTCUT BADGES & CHEATSHEET
   ---------------------------------------------------------------------------- */
.keyboard-hint-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 6px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--mel-sat-emerald);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  pointer-events: none;
  vertical-align: middle;
}

/* Shortcuts Dialog Modal */
.shortcuts-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  display: none;
  place-items: center;
  padding: 20px;
}

.shortcuts-modal-backdrop.is-open {
  display: grid !important;
}

.shortcuts-dialog {
  width: 100%;
  max-width: 500px;
  padding: 26px 28px;
  border-radius: 22px;
  background: rgba(14, 25, 23, 0.95);
  border: 1px solid rgba(0, 245, 196, 0.35);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.7), 0 0 25px rgba(0, 245, 196, 0.18);
  color: var(--mel-sat-text);
}

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

.shortcuts-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
  color: #ffffff;
}

.shortcuts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 22px;
}

.shortcut-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 13px;
}

.shortcut-key {
  padding: 2px 7px;
  border-radius: 5px;
  background: rgba(0, 245, 196, 0.12);
  border: 1px solid rgba(0, 245, 196, 0.4);
  color: var(--mel-sat-emerald);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11.5px;
  font-weight: 800;
}

/* ----------------------------------------------------------------------------
   4. DAILY STUDY STREAK & GOAL TRACKER WIDGET
   ---------------------------------------------------------------------------- */
.study-streak-widget {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 18px;
  border-radius: 16px;
  background: rgba(14, 25, 23, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.10);
  backdrop-filter: blur(16px);
  color: var(--mel-sat-text);
  margin-top: 14px;
}

.streak-flame-box {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 12px;
  background: rgba(255, 209, 102, 0.10);
  border: 1px solid rgba(255, 209, 102, 0.35);
  color: #ffd166;
  font-weight: 800;
  font-size: 14px;
  white-space: nowrap;
}

.streak-goal-container {
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex: 1;
}

.streak-goal-header {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 700;
  color: var(--mel-sat-text-muted);
}

.streak-progress-bar {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.streak-progress-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #0d9488, #00f5c4);
  transition: width 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 0 10px rgba(0, 245, 196, 0.4);
}

.streak-goal-celebration {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(16, 185, 129, 0.18);
  border: 1px solid rgba(16, 185, 129, 0.45);
  color: #34d399;
  font-size: 11px;
  font-weight: 800;
}

/* ----------------------------------------------------------------------------
   5. INSTANT OFFLINE STATE PROTECTION INDICATOR
   ---------------------------------------------------------------------------- */
.offline-state-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  transition: all 0.25s ease;
  user-select: none;
}

.offline-state-badge.status-guest {
  background: rgba(148, 163, 184, 0.12);
  border: 1px solid rgba(148, 163, 184, 0.35);
  color: #cbd5e1;
}

.offline-state-badge.status-local {
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.28);
  color: #6ee7b7;
}

.offline-state-badge.status-saving {
  background: rgba(56, 189, 248, 0.14);
  border: 1px solid rgba(56, 189, 248, 0.45);
  color: #38bdf8;
  animation: melPulseSaving 1.5s infinite;
}

.offline-state-badge.status-online,
.offline-state-badge.status-synced {
  background: rgba(0, 245, 196, 0.10);
  border: 1px solid rgba(0, 245, 196, 0.40);
  color: #00f5c4;
}

.offline-state-badge.status-offline {
  background: rgba(245, 158, 11, 0.14);
  border: 1px solid rgba(245, 158, 11, 0.45);
  color: #fbbf24;
}

.offline-state-badge.status-offline-pending {
  background: rgba(245, 158, 11, 0.18);
  border: 1px solid rgba(245, 158, 11, 0.55);
  color: #fbbf24;
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.25);
  animation: melOfflineBlink 2s infinite;
}

.offline-state-badge.status-error {
  background: rgba(239, 68, 68, 0.16);
  border: 1px solid rgba(239, 68, 68, 0.55);
  color: #f87171;
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.25);
}

.offline-state-badge.is-retryable {
  cursor: pointer;
}

.offline-state-badge.is-retryable:hover {
  filter: brightness(1.15);
  transform: translateY(-1px);
}

@keyframes melOfflineBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.65; }
}

@keyframes melPulseSaving {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.75; transform: scale(0.98); }
}

.offline-state-badge .status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.offline-state-badge.status-guest .status-dot {
  background: #94a3b8;
  box-shadow: 0 0 4px #94a3b8;
}

.offline-state-badge.status-local .status-dot {
  background: #34d399;
  box-shadow: 0 0 5px #34d399;
}

.offline-state-badge.status-saving .status-dot {
  background: #38bdf8;
  box-shadow: 0 0 6px #38bdf8;
}

.offline-state-badge.status-online .status-dot,
.offline-state-badge.status-synced .status-dot {
  background: #00f5c4;
  box-shadow: 0 0 6px #00f5c4;
}

.offline-state-badge.status-offline .status-dot,
.offline-state-badge.status-offline-pending .status-dot {
  background: #f59e0b;
  box-shadow: 0 0 8px #f59e0b;
}

.offline-state-badge.status-error .status-dot {
  background: #ef4444;
  box-shadow: 0 0 8px #ef4444;
}

/* ----------------------------------------------------------------------------
   6. TACTILE AUDIO FEEDBACK & MUTE TOGGLE
   ---------------------------------------------------------------------------- */
.sound-fx-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: rgba(16, 28, 26, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--mel-sat-text);
  font-size: 15px;
  cursor: pointer;
  backdrop-filter: blur(12px);
  transition: all 0.18s ease;
}

.sound-fx-btn:hover {
  border-color: var(--mel-sat-emerald);
  color: var(--mel-sat-emerald);
  box-shadow: 0 0 14px rgba(0, 245, 196, 0.25);
}

.sound-fx-btn.is-muted {
  opacity: 0.55;
  border-color: rgba(255, 255, 255, 0.08);
}

/* Mobile responsive adjustments */
@media (max-width: 760px) {
  .smart-resume-hud {
    padding: 0 12px;
  }
  .resume-hud-container {
    flex-wrap: wrap;
    gap: 10px;
    padding: 10px 14px;
  }
  .resume-hud-info {
    order: 3;
    width: 100%;
  }
  .shortcuts-grid {
    grid-template-columns: 1fr;
  }
  .study-streak-widget {
    flex-direction: column;
    align-items: stretch;
  }
}
