/* ==========================================================================
   THEME DESIGN INITIALIZATION & MODERN GRAPHICS TOKENS
   ========================================================================== */
:root {
  --bg-main: #f0f4f8;
  --bg-sidebar: #ffffff;
  --bg-pane: #ffffff;
  --border-color: #e2e8f0;

  --text-main: #1e293b;
  --text-muted: #64748b;
  --text-white: #ffffff;

  --color-primary: #4f46e5;
  --color-primary-hover: #4338ca;
  --color-accent: #0ea5e9;
  --color-success: #10b981;
  --color-danger: #ef4444;
  --color-warning: #f59e0b;
/* green-#04cc7d */
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --radius-round: 30px;

  --shadow-sm: 0 2px 4px rgba(0,0,0,0.02);
  --shadow-md: 0 10px 25px -5px rgba(0,0,0,0.05), 0 8px 10px -6px rgba(0,0,0,0.03);
  --shadow-lg: 0 20px 30px -10px rgba(79, 70, 229, 0.1);
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  background-color: var(--bg-main);
  color: var(--text-main);
  font-family: 'Plus Jakarta Sans', sans-serif;
  letter-spacing: -0.01em;
  min-height: 100vh;
  overflow: hidden;
}

/* ==========================================================================
   APP WORKSPACE STRUCTURAL CONTROL HOUSINGS
   ========================================================================== */
.app {
  display: flex;
  height: 100vh;
  width: 100vw;
}

/* SIDEBAR BRANDING PANELS */
.sidebar {
  width: 260px;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  padding: 32px 24px;
  display: flex;
  flex-direction: column;
  gap: 40px;
  z-index: 10;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
  border-radius: var(--radius-sm);
}

.logo {
  font-size: 20px;
  font-weight: 700;
  color: #0f172a;
}

.logo span {
  color: var(--text-muted);
  font-weight: 400;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  background: none;
  border: none;
  color: var(--text-muted);
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  width: 100%;
}

.nav-btn:hover {
  color: var(--color-primary);
  background: #f1f5f9;
}

.nav-btn.active {
  color: var(--text-white);
  background: #0f172a;
  box-shadow: var(--shadow-md);
}

.nav-icon {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

/* MAIN VIEWPORTS CONTAINER SYSTEM */
.main {
  flex: 1;
  padding: 40px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 32px;
  position: relative;
}

/* ACCOUNT TOP METADATA BAR */
.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.search-wrapper {
  position: relative;
  width: 340px;
}

.search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  fill: var(--text-muted);
}

.search-wrapper input {
  width: 100%;
  padding: 12px 16px 12px 46px;
  border-radius: var(--radius-round);
  border: 1px solid var(--border-color);
  background: var(--bg-pane);
  font-size: 14px;
  color: var(--text-main);
  transition: var(--transition);
}

.search-wrapper input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-badge {
  width: 40px;
  height: 40px;
  background: #fef3c7;
  color: #d97706;
  border-radius: var(--radius-round);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
}

.user-info {
  display: flex;
  flex-direction: column;
}

.user-name {
  font-size: 14px;
  font-weight: 600;
  color: #0f172a;
}

.user-role {
  font-size: 12px;
  color: var(--text-muted);
}

/* VIEW CONTROLLERS LAYERS */
.view {
  animation: fadeIn 0.4s ease;
}

.view-tagline {
  font-size: 13px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

.dashboard-header h1 {
  font-size: 32px;
  font-weight: 700;
  color: #0f172a;
  margin-top: 4px;
}

/* Sidebar Hiding Logic */
.quiz-active .sidebar,
.recall-active .sidebar {
  display: none !important;
}

.quiz-active .main,
.recall-active .main {
  padding: 20px;
  max-width: 1000px;
  margin: 0 auto;
}

/* Nav Highlighting */
.nav-btn.active {
  background: #0f172a !important;
  color: #fff !important;
  border-left: 4px solid var(--color-accent);
}

/* Section Specific Header Elements */
.search-wrapper, .user-profile { display: none; }

#dashboardView:not(.hide) ~ .top-bar .dashboard-only,
.view:not(.hide)#dashboardView ~ .top-bar .dashboard-only { display: flex; }

#settingsView:not(.hide) ~ .top-bar .settings-only,
.view:not(.hide)#settingsView ~ .top-bar .settings-only { display: block; }

/* Dashboard-Specific Header Display Logic */
body:has(#dashboardView:not(.hide)) .dashboard-only { display: flex; }
body:has(#settingsView:not(.hide)) .settings-only { display: block; }

/* Modernized Inputs for Quiz/Settings */
select, input[type="text"], input[type="file"] {
  appearance: none;
  background-color: #f8fafc;
  border: 1px solid var(--border-color);
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 14px;
  transition: var(--transition);
}

select:focus, input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
  outline: none;
}
/* toggle switch */

.toggle {
  display: none;
}

.toggle-label {
  width: 75px;
  height: 38px;
  background: #ddd;
  border-radius: 78px;
  position: relative;
  display: flex;
  align-items: center;
  cursor: pointer;
  transition: background 0.3s ease;
}

.toggle-label::before {
  content: '';
  width: 28px;
  height: 28px;
  background: #fff;
  border-radius: 50%;
  position: absolute;
  left: 5px;
  transition: transform 0.3s ease;
  box-shadow: 0 4px 20px rgba(0,0,0,.3);
}

.toggle:checked + .toggle-label {
  background: linear-gradient(45deg, #7f1bea, #669dfc);
}

.toggle:checked + .toggle-label::before {
  transform: translateX(37px);
}

.switch-container, .pane-card-details {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
/* --- Responsive Hamburger Menu --- */
.mobile-menu-btn {
  display: none;
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 100;
  background: #0f172a;
  color: white;
  border: none;
  padding: 10px 15px;
  border-radius: 8px;
  cursor: pointer;
}


/* ==========================================================================
   METRIC WIDGETS & GRID LAYOUT MODULES
   ========================================================================== */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
  margin-top: 24px;
}

.pane-card, .metric-card {
  background: var(--bg-pane);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.metric-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.card-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.metric-card h2 {
  font-size: 28px;
  font-weight: 700;
  color: #0f172a;
  margin-top: 12px;
}

.pane-card.full, .metric-card.wide {
  grid-column: span 4;
}

.row-span {
  grid-row: span 2;
}

/* DYNAMIC GUIDED CURRICULUM DISPLAY WIDGET */
.lesson-screen {
  margin-top: 24px;
}

.lesson-card-modern {
  background: linear-gradient(135deg, #1e293b, #0f172a);
  border-radius: var(--radius-lg);
  padding: 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-white);
  box-shadow: var(--shadow-lg);
}

.lesson-details h2 {
  font-size: 24px;
  font-weight: 700;
}

.lesson-details p {
  color: #94a3b8;
  font-size: 14px;
  margin-top: 4px;
}

/* ==========================================================================
   STRICT SIDE-BY-SIDE RECALL PRACTICE ROW FIELDS
   ========================================================================== */
.recall-board-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-pane);
  border: 1px solid var(--border-color);
  padding: 16px 24px;
  border-radius: var(--radius-md);
  margin: 24px 0;
}

.recall-counter {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
}

/* COMPACT GRID CONTAINER FOR INPUT COLUMNS */
.recall-matrix-grid {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
}

/* FLEX ENGINE ENSURING SIDE-BY-SIDE GRID ALLOTMENT */
.recall-row {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  background: var(--bg-pane);
  border: 1px solid var(--border-color);
  padding: 12px 20px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.recall-row:focus-within {
  border-color: #cbd5e1;
  box-shadow: var(--shadow-md);
}

.recall-left,
.recall-right {
  flex: 1; /* Grants exact layout space share split */
  min-width: 0;
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: #f8fafc;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-main);
  transition: var(--transition);
}

.recall-left:focus,
.recall-right:focus {
  outline: none;
  background: var(--text-white);
  border-color: var(--color-primary);
}

.hint-btn {
  background: #f1f5f9;
  border: none;
  color: var(--text-main);
  font-weight: 600;
  font-size: 13px;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.hint-btn:hover {
  background: #e2e8f0;
}

.answer-display {
  font-size: 13px;
  font-weight: 600;
  min-width: 140px;
  padding-left: 8px;
}

/* ==========================================================================
   UNIVERSAL BUTTONS & GLOBAL ACTIONS CAPABILITIES
   ========================================================================== */
.action-btn, .primary-btn {
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 14px;
  border: none;
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.primary-btn {
  background: var(--color-primary);
  color: var(--text-white);
}

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

.action-btn.primary { background: #0f172a; color: var(--text-white); }
.action-btn.outline { background: transparent; border: 1px solid var(--border-color); color: var(--text-main); }
.action-btn.outline:hover { background: #f8fafc; }
.action-btn.cyan { background: var(--color-accent); color: var(--text-white); }
.action-btn.purple { background: var(--color-primary); color: var(--text-white); }
.action-btn.warning { background: var(--color-warning); color: var(--text-white); }
.action-btn.danger { background: var(--color-danger); color: var(--text-white); }
.action-btn.success { background: var(--color-success); color: var(--text-white); }
.action-btn.clean { background: #e2e8f0; color: var(--text-main); }

.btn-group-row {
  display: inline-flex;
  gap: 12px;
  align-items: center;
}

/* Smooth transition when items pop into view */
.action-btn:not(.hide) {
  animation: buttonFadeIn 0.2s ease-out;
}

@keyframes buttonFadeIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.controls {
  display: flex;
  justify-content: center;
}

/* Gateway Panel Variations */
.gateway-choice-panel {
  text-align: center;
  padding: 40px !important;
}

.panel-desc {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 24px;
}

.gateway-choice-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

/* Premium Interactive Selection Cards */
.gateway-choice-card {
  background: #f8fafc;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 32px 24px;
  cursor: pointer;
  text-align: center;
  transition: var(--transition);
}

.gateway-choice-card:hover {
  border-color: var(--color-primary);
  background: #ffffff;
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.route-icon {
  font-size: 32px;
  margin-bottom: 12px;
}

.gateway-choice-card h4 {
  font-size: 16px;
  color: #0f172a;
  margin-bottom: 6px;
}

.gateway-choice-card p {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Mastery Colors Override */
.primary-btn.warning {
  background: var(--color-warning);
  color: white;
}
.primary-btn.warning:hover {
  background: #d97706;
}

.alert-badge {
  background: #fef3c7 !important;
  color: #d97706 !important;
  margin-bottom: 8px;
  display: inline-block;
}

/* Smooth Slide Menu Animations */
.animated-drawer {
  background: #f1f5f9;
  padding: 20px;
  border-radius: var(--radius-md);
  margin-top: 20px;
  border: 1px solid var(--border-color);
  animation: slideDown 0.25s ease-out;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}
/* ==========================================================================
   QUIZ ENVIRONMENT CANVAS INTERFACES
   ========================================================================== */
.quiz-canvas {
  height: 280px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  margin: 32px 0;
  background: #f8fafc;
  border-radius: var(--radius-lg);
  border: 1px dashed var(--border-color);
}

#question {
  font-size: 56px;
  font-weight: 700;
  color: #0f172a;
}

#answer {
  font-size: 28px;
  font-weight: 500;
  color: var(--text-muted);
  margin-top: 16px;
}

.badge-tag {
  background: #e0f2fe;
  color: #0369a1;
  padding: 4px 12px;
  border-radius: var(--radius-round);
  font-size: 12px;
  font-weight: 600;
}

.badge-tag.phase {
  background: #e0e7ff;
  color: #4338ca;
}

.exit-btn {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
}

.exit-btn:hover {
  color: var(--color-danger);
  border-color: #fca5a5;
  background: #fff5f5;
}

.quiz-board-top {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 20px;
}

.quiz-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.lesson-meta {
  padding-bottom: 6px;
}

.trackerLabel {
  display: block;
}
/* ==========================================================================
   MODALS LAYERS & SCREEN GLASS OVERLAYS
   ========================================================================== */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(4px);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 100;
}

.modal.show {
  display: flex;
}

.modal-content-modern {
  background: var(--bg-pane);
  border-radius: var(--radius-lg);
  padding: 32px;
  width: 440px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.15);
  border: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.modal-form-fields {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.modal-form-fields input {
  padding: 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  font-size: 14px;
}

/* ==========================================================================
   ANALYTICS PREVIEW SHEETS & LIST DATA TABLES
   ========================================================================== */
.modern-table-view {
  margin-top: 16px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.preview-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr 120px;
  padding: 14px 20px;
  background: var(--bg-pane);
  font-size: 14px;
  border-bottom: 1px solid var(--border-color);
}

.preview-row.header {
  background: #f8fafc;
  font-weight: 700;
  color: #0f172a;
}

/* MOST MISSED COMPONENT UTILITIES */
#troubleList li {
  display: flex;
  justify-content: space-between;
  padding: 12px 4px;
  border-bottom: 1px solid var(--border-color);
  font-size: 14px;
  font-weight: 500;
}

#troubleList li span {
  color: var(--color-danger);
  font-weight: 600;
}

/* TOAST NOTIFICATION STYLING */
.notification {
  position: fixed;
  bottom: 32px;
  right: 32px;
  background: #0f172a;
  color: var(--text-white);
  padding: 14px 24px;
  border-radius: var(--radius-md);
  box-shadow: 0 10px 15px -3px rgba(0,0,0,0.3);
  font-size: 14px;
  font-weight: 600;
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: var(--transition);
  z-index: 200;
}

.notification.show {
  opacity: 1;
  transform: translateY(0);
}

.hide { display: none !important; }

/* ==========================================================================
   RESPONSIVE DESIGN SYSTEM MEDIA BREAKPOINTS
   ========================================================================== */
@media (max-width: 1024px) {
  .dashboard-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .pane-card.full, .metric-card.wide {
    grid-column: span 2;
  }
}

@media (max-width: 768px) {
  body { overflow-y: auto; }
  .app { flex-direction: column; height: auto; }
  .sidebar {padding: 20px; gap: 20px; position: fixed; left: -260px; height: 100vh; transition: 0.3s ease;}
  .main { padding: 20px; gap: 20px; }
  .search-wrapper { width: 100%; }
  .top-bar { flex-direction: column; align-items: flex-start; gap: 16px; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .pane-card.full, .metric-card.wide { grid-column: span 1; }
  .full-width-mobile { grid-column: span 1; }

  /* Retain stacked view format strictly for mobile dimensions */
  .recall-row {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  .hint-btn { width: 100%; }

  .mobile-menu-btn { display: block; }

  .sidebar.open {
    left: 0;
  }

  .main { padding: 80px 20px 20px 20px; }
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}


/* Guided vs Free Mode Logic */
.free-mode .guided-only {
  display: none !important;
}
