/* ==========================================================================
   DESIGN SYSTEM & CUSTOM VARIABLES (MYAQUIZ.AI THEME)
   ========================================================================== */
:root {
  /* Fonts */
  --font-main: 'Hanken Grotesk', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-headings: 'Space Grotesk', var(--font-main);

  /* Light Theme Colors (Sui Ocean/Water theme) */
  --primary: 195, 100%, 46%; /* Sui Vibrant Blue/Cyan #00b4d8 */
  --primary-light: hsla(195, 100%, 46%, 0.08);
  --primary-medium: hsla(195, 100%, 46%, 0.15);
  --primary-dark: 195, 100%, 35%;
  
  --bg-app: #f4f7fa; /* Light water-gray app background */
  --bg-sidebar: #ffffff;
  --bg-card: #ffffff;
  --bg-input: #ffffff;
  --bg-hover: #eaf3fa;
  
  --text-main: #0f172a;
  --text-muted: #475569;
  --text-inverse: #ffffff;
  
  --border-color: #e2e8f0;
  --border-focus: rgba(0, 180, 216, 0.4);
  
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.03);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.03), 0 2px 4px -2px rgb(0 0 0 / 0.03);
  --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.04), 0 4px 6px -4px rgba(15, 23, 42, 0.04);
  
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 26px;
  
  --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  
  --sidebar-width: 280px;
}

/* Dark Theme Variables (Sui Space-Navy) */
[data-theme="dark"] {
  --bg-app: #030712; /* Deep space-black background */
  --bg-sidebar: #090e1a; /* Navy-black sidebar background */
  --bg-card: #0c1524; /* Ocean-slate card background */
  --bg-input: #080d18;
  --bg-hover: rgba(255, 255, 255, 0.05);
  
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  
  --border-color: rgba(255, 255, 255, 0.06);
  --border-focus: rgba(17, 195, 236, 0.6);
  
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.4);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.4), 0 2px 4px -2px rgb(0 0 0 / 0.4);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.5), 0 4px 6px -4px rgb(0 0 0 / 0.5);
  
  --primary-light: rgba(17, 195, 236, 0.12);
}

/* ==========================================================================
   BASE & RESET STYLES
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  height: 100vh;
  height: 100dvh;
  margin: 0;
  padding: 0;
  overflow: hidden;
}

body {
  font-family: var(--font-main);
  background-color: var(--bg-app);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition: background-color var(--transition-normal), color var(--transition-normal);
}

input, textarea, button {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

/* Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ==========================================================================
   AUTHENTICATION SCREEN STYLES
   ========================================================================== */
.auth-viewport {
  height: 100%;
  height: 100vh;
  height: 100dvh;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 16px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: radial-gradient(circle at 10% 20%, rgba(243, 232, 255, 0.7) 0%, rgba(248, 250, 252, 1) 90%);
}

[data-theme="dark"] .auth-viewport {
  background: radial-gradient(circle at 10% 20%, rgba(88, 28, 135, 0.15) 0%, rgba(15, 23, 42, 1) 90%);
}

.auth-card {
  width: 100%;
  max-width: 440px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 40px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  gap: 28px;
  margin: 40px auto;
  flex-shrink: 0;
}

.auth-header {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

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

.auth-brand {
  font-family: var(--font-headings);
  font-size: 1.65rem;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.auth-subtitle {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.auth-tab-buttons {
  display: flex;
  background-color: var(--bg-hover);
  padding: 4px;
  border-radius: var(--radius-md);
  margin-bottom: 6px;
}

.auth-tab {
  flex: 1;
  border: none;
  background: none;
  padding: 8px 0;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-muted);
  transition: all var(--transition-fast);
}

.auth-tab.active {
  background-color: var(--bg-card);
  color: hsl(var(--primary-dark));
  box-shadow: var(--shadow-sm);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.auth-divider {
  display: flex;
  align-items: center;
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  gap: 12px;
}

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

.btn-google {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-fast);
  padding: 11px 18px;
  border-radius: var(--radius-md);
  font-size: 0.925rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
}

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

.google-icon {
  width: 18px;
  height: 18px;
}

/* ==========================================================================
   LAYOUT STRUCTURE
   ========================================================================== */
.app-container {
  display: flex;
  height: 100%;
  height: 100vh;
  height: 100dvh;
  position: relative;
  overflow: hidden;
}

/* Sidebar Styling */
.sidebar {
  width: var(--sidebar-width);
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 100;
  transition: transform var(--transition-normal), background-color var(--transition-normal), border-color var(--transition-normal);
}

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

.logo-area {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-icon {
  width: 28px;
  height: 28px;
  color: hsl(var(--primary));
}

.brand-name {
  font-family: var(--font-headings);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.5px;
}

.brand-dot {
  color: hsl(var(--primary));
}

.sidebar-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
}

.sidebar-toggle:hover {
  background-color: var(--bg-hover);
  color: var(--text-main);
}

/* Navigation Lists */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 20px 12px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

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

.section-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px;
}

.section-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

.nav-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item, .nav-action-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 0.925rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: all var(--transition-fast);
}

.nav-item:hover, .nav-action-item:hover {
  background-color: var(--bg-hover);
  color: var(--text-main);
}

.nav-item.active {
  background-color: hsl(var(--primary-light));
  color: hsl(var(--primary-dark));
}

.nav-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  transition: stroke var(--transition-fast);
}

.nav-item.active .nav-icon {
  stroke: hsl(var(--primary));
}

/* Secondary & Action list in Sidebar */
.nav-action-item {
  font-weight: 400;
  color: var(--text-muted);
}

.nav-action-item svg {
  color: hsl(var(--primary));
}

/* Classes list under classes section */
.classes-list {
  padding: 4px 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 180px;
  overflow-y: auto;
}

.empty-list-text {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-style: italic;
  padding: 8px 4px;
}

.class-sidebar-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  cursor: pointer;
  color: var(--text-main);
  transition: background var(--transition-fast);
}

.class-sidebar-item:hover {
  background-color: var(--bg-hover);
}

.class-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: hsl(var(--primary));
  flex-shrink: 0;
}

/* Sidebar Footer & User Profile */
.sidebar-footer {
  padding: 16px 12px;
  border-top: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.footer-list {
  margin-bottom: 4px;
}

.user-profile-widget {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  background-color: var(--bg-card);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.user-profile-widget:hover {
  background-color: var(--bg-hover);
  box-shadow: var(--shadow-sm);
}

.avatar-area {
  position: relative;
}

.avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, hsl(var(--primary)), #38bdf8);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1rem;
}

.user-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0; /* allows text truncation */
}

.user-name-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.user-display-name {
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-badge {
  font-size: 0.65rem;
  background-color: var(--border-color);
  color: var(--text-muted);
  padding: 1px 6px;
  border-radius: 20px;
  font-weight: 600;
  text-transform: uppercase;
}

.user-badge.pro {
  background-color: #fef3c7;
  color: #d97706;
}

.user-email {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dropdown-chevron {
  width: 16px;
  height: 16px;
  color: var(--text-muted);
}

/* Main Content Area Styling */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  height: 100%;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background-color: transparent;
  transition: margin-left var(--transition-normal);
  min-width: 0;
  width: 100%;
  max-width: 100%;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* Mobile Header */
.mobile-header {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background-color: var(--bg-sidebar);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 90;
}

.menu-hamburger {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-main);
}

.mobile-logo-text {
  font-family: var(--font-headings);
  font-size: 1.15rem;
  font-weight: 700;
}

.mobile-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, hsl(var(--primary)), #38bdf8);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.85rem;
}

/* View Viewport */
.view-viewport {
  flex: 1;
  padding: 40px;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 32px;
  transition: padding var(--transition-normal);
  min-width: 0;
}

.loading-spinner-container {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--border-color);
  border-top-color: hsl(var(--primary));
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* ==========================================================================
   SHARED UI COMPONENTS (BUTTONS, CARDS, INPUTS)
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  border: 1px solid transparent;
}

.btn-primary {
  background: linear-gradient(135deg, hsl(var(--primary)), #0284c7);
  color: white;
  box-shadow: 0 4px 12px hsla(195, 100%, 46%, 0.2);
}

.btn-primary:hover {
  background: linear-gradient(135deg, hsl(var(--primary-dark)), #0369a1);
  box-shadow: 0 4px 16px hsla(195, 100%, 46%, 0.35);
  transform: translateY(-1px);
}

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

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

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
  border-radius: var(--radius-sm);
}

/* Cards style */
.card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition-normal), border-color var(--transition-normal);
}

.card:hover {
  box-shadow: var(--shadow-md);
}

/* Inputs & Form Groups */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 18px;
}

.form-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
}

.form-group input, .form-group textarea, .form-group select {
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background-color: var(--bg-input);
  outline: none;
  font-size: 0.925rem;
  transition: all var(--transition-fast);
}

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

.required {
  color: #ef4444;
}

.form-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ==========================================================================
   VIEW: TRANG CHỦ (DASHBOARD HOME)
   ========================================================================== */
.welcome-header {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.welcome-title {
  font-family: var(--font-headings);
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-main);
}

/* AI Prompt Composer Panel */
.ai-composer-card {
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  box-shadow: var(--shadow-sm);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: relative;
}

.ai-composer-textarea {
  width: 100%;
  min-height: 80px;
  border: none;
  resize: vertical;
  background: transparent;
  outline: none;
  font-size: 1.05rem;
  line-height: 1.6;
  color: var(--text-main);
}

.ai-composer-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--border-color);
  padding-top: 16px;
  flex-wrap: wrap;
  gap: 12px;
}

.ai-composer-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.composer-select-wrapper {
  position: relative;
}

.composer-select {
  appearance: none;
  padding: 8px 32px 8px 16px;
  background-color: var(--bg-hover);
  border: 1px solid var(--border-color);
  border-radius: 30px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  outline: none;
  color: hsl(var(--primary-dark));
}

.composer-select-wrapper::after {
  content: "";
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  border: 4px solid transparent;
  border-top-color: hsl(var(--primary));
  pointer-events: none;
}

.btn-attach {
  background: none;
  border: none;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  padding: 8px 12px;
  border-radius: 30px;
  transition: background var(--transition-fast);
}

.btn-attach:hover {
  background-color: var(--bg-hover);
  color: var(--text-main);
}

.btn-attach svg {
  width: 18px;
  height: 18px;
}

/* Simulated Attachment Indicator */
.attached-files-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.attached-file-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background-color: var(--bg-hover);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  border: 1px solid var(--border-color);
}

.attached-file-badge button {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
}

.attached-file-badge button:hover {
  color: #ef4444;
}

/* Grid Sections: Lớp học & Không gian làm việc */
.home-sections-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

@media (max-width: 900px) {
  .home-sections-grid {
    grid-template-columns: 1fr;
  }
}

.section-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.section-card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.15rem;
  font-weight: 700;
  font-family: var(--font-headings);
}

.section-card-title svg {
  width: 20px;
  height: 20px;
  color: hsl(var(--primary));
}

.btn-add-section {
  background: none;
  border: 1px solid var(--border-color);
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  transition: all var(--transition-fast);
}

.btn-add-section:hover {
  background-color: var(--bg-hover);
  color: var(--text-main);
  border-color: var(--text-muted);
}

/* Empty State Card Content */
.empty-state-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  text-align: center;
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-md);
  background-color: hsla(0, 0%, 100%, 0.2);
}

.empty-state-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background-color: var(--bg-hover);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
}

.empty-state-icon svg {
  width: 24px;
  height: 24px;
}

.empty-state-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 4px;
}

.empty-state-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
  max-width: 260px;
  margin-bottom: 12px;
}

.empty-state-btn {
  background: none;
  border: none;
  color: hsl(var(--primary));
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
}

.empty-state-btn:hover {
  text-decoration: underline;
}

/* Dynamic Classes / Workspaces Cards lists */
.items-list-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

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

.item-list-card:hover {
  border-color: hsl(var(--primary-medium));
  box-shadow: var(--shadow-sm);
  transform: translateX(2px);
}

.item-card-info {
  display: flex;
  flex-direction: column;
}

.item-card-title {
  font-size: 0.95rem;
  font-weight: 600;
}

.item-card-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
}

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

.btn-icon-only {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 6px;
  border-radius: var(--radius-sm);
}

.btn-icon-only:hover {
  background-color: var(--bg-hover);
  color: #ef4444;
}

/* Suggested Exams Carousel Section */
.carousel-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

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

.carousel-title {
  font-family: var(--font-headings);
  font-size: 1.25rem;
  font-weight: 700;
}

.carousel-controls {
  display: flex;
  gap: 8px;
}

.carousel-arrow {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border-color);
  background-color: var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  transition: all var(--transition-fast);
}

.carousel-arrow:hover {
  background-color: var(--bg-hover);
  color: var(--text-main);
  border-color: var(--text-muted);
}

.carousel-track-wrapper {
  overflow-x: auto;
  scroll-behavior: smooth;
  padding: 4px;
}

.carousel-track {
  display: flex;
  gap: 16px;
  width: max-content;
}

.suggested-exam-card {
  width: 260px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 180px;
  transition: all var(--transition-fast);
}

.suggested-exam-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: hsl(var(--primary-medium));
}

.suggested-header {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.suggested-tag {
  align-self: flex-start;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  background-color: hsl(var(--primary-light));
  color: hsl(var(--primary-dark));
  padding: 2px 8px;
  border-radius: 20px;
}

.suggested-title {
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.4;
}

.suggested-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ==========================================================================
   VIEW: LIBRARY (THƯ VIỆN CỦA BẠN)
   ========================================================================== */
.view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.view-title-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.view-title {
  font-family: var(--font-headings);
  font-size: 1.75rem;
  font-weight: 700;
}

.search-filter-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.search-input-wrapper {
  position: relative;
  flex: 1;
  min-width: 260px;
}

.search-input-wrapper svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  width: 18px;
  height: 18px;
}

.search-input {
  width: 100%;
  padding: 10px 14px 10px 38px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background-color: var(--bg-card);
  outline: none;
}

.filter-select {
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background-color: var(--bg-card);
  outline: none;
  cursor: pointer;
}

.library-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.exam-library-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 220px;
  transition: all var(--transition-normal);
  cursor: pointer;
}

.exam-library-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: hsl(var(--primary-medium));
}

.exam-card-main {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.exam-card-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.exam-card-subject-tag {
  font-size: 0.7rem;
  font-weight: 700;
  background-color: #f1f5f9;
  color: #475569;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
}

.exam-card-subject-tag.math { background-color: #fee2e2; color: #991b1b; }
.exam-card-subject-tag.english { background-color: #e0f2fe; color: #075985; }
.exam-card-subject-tag.physics { background-color: #fef3c7; color: #92400e; }
.exam-card-subject-tag.chemistry { background-color: #dcfce7; color: #166534; }
.exam-card-subject-tag.ai { background-color: hsl(var(--primary-light)); color: hsl(var(--primary-dark)); }

.exam-card-date {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.exam-card-title {
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.exam-card-stats {
  display: flex;
  gap: 12px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.exam-card-stat-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

.exam-card-footer {
  border-top: 1px solid var(--border-color);
  padding-top: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.exam-card-author {
  font-size: 0.8rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
}

.exam-card-author-avatar {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--bg-hover);
  font-size: 0.7rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ==========================================================================
   VIEW: EXAM DETAIL & INTERACTIVE QUIZ
   ========================================================================== */
.exam-detail-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 28px;
}

@media (max-width: 950px) {
  .exam-detail-layout {
    grid-template-columns: 1fr;
  }
}

.exam-questions-panel {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.exam-meta-box {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.meta-box-item {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 8px;
}

.meta-box-label {
  color: var(--text-muted);
}

.meta-box-value {
  font-weight: 600;
}

.question-item-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.question-text {
  font-size: 1.05rem;
  font-weight: 600;
}

.quiz-options-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.quiz-option-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.quiz-option-item:hover {
  background-color: var(--bg-hover);
}

.quiz-option-item.selected {
  border-color: hsl(var(--primary));
  background-color: hsl(var(--primary-light));
}

.quiz-option-item.correct {
  border-color: #10b981;
  background-color: #d1fae5;
  color: #065f46;
}

.quiz-option-item.incorrect {
  border-color: #ef4444;
  background-color: #fee2e2;
  color: #991b1b;
}

.option-letter {
  font-weight: 700;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1.5px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  flex-shrink: 0;
}

.quiz-option-item.selected .option-letter {
  background-color: hsl(var(--primary));
  border-color: hsl(var(--primary));
  color: white;
}

.quiz-option-item.correct .option-letter {
  background-color: #10b981;
  border-color: #10b981;
  color: white;
}

.quiz-option-item.incorrect .option-letter {
  background-color: #ef4444;
  border-color: #ef4444;
  color: white;
}

.option-content {
  font-size: 0.95rem;
}

.question-explanation {
  background-color: var(--bg-hover);
  padding: 16px;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  border-left: 4px solid hsl(var(--primary));
}

.explanation-title {
  font-weight: 700;
  margin-bottom: 4px;
  color: hsl(var(--primary-dark));
}

/* Quiz Submission / Scoring Panel */
.quiz-result-banner {
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
  border-radius: var(--radius-lg);
  padding: 24px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow-md);
}

.result-score {
  font-family: var(--font-headings);
  font-size: 3rem;
  font-weight: 700;
}

/* ==========================================================================
   VIEW: SETTINGS (CÀI ĐẶT)
   ========================================================================== */
.settings-layout {
  max-width: 680px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.settings-section-card {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.settings-section-title {
  font-size: 1.1rem;
  font-weight: 700;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 8px;
  margin-bottom: 8px;
}

.theme-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
}

.switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 26px;
}

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

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #cbd5e1;
  transition: .4s;
  border-radius: 34px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  transition: .4s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: hsl(var(--primary));
}

input:focus + .slider {
  box-shadow: 0 0 1px hsl(var(--primary));
}

input:checked + .slider:before {
  transform: translateX(24px);
}

/* Plan card simulation */
.pricing-cards-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.plan-card-option {
  border: 2px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 18px;
  cursor: pointer;
  position: relative;
  transition: all var(--transition-fast);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.plan-card-option:hover {
  border-color: hsl(var(--primary-medium));
}

.plan-card-option.active {
  border-color: hsl(var(--primary));
  background-color: hsl(var(--primary-light));
}

.plan-card-option.active::after {
  content: "Đang chọn";
  position: absolute;
  top: 12px;
  right: 12px;
  background-color: hsl(var(--primary));
  color: white;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
}

.plan-option-name {
  font-size: 1rem;
  font-weight: 700;
}

.plan-option-price {
  font-size: 1.25rem;
  font-weight: 700;
  color: hsl(var(--primary-dark));
}

.plan-option-features {
  list-style: none;
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* ==========================================================================
   VIEW: MÔ PHỎNG AI CREATION POPUP/MODAL
   ========================================================================== */
.ai-processing-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ai-processing-card {
  width: 480px;
  background-color: var(--bg-card);
  border-radius: var(--radius-xl);
  padding: 32px;
  text-align: center;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.ai-icon-animation {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: radial-gradient(circle, hsl(var(--primary-light)) 0%, rgba(255,255,255,0) 70%);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.ai-icon-animation svg {
  width: 40px;
  height: 40px;
  color: hsl(var(--primary));
  animation: pulse 2s infinite ease-in-out;
}

@keyframes pulse {
  0% { transform: scale(1); opacity: 0.8; }
  50% { transform: scale(1.15); opacity: 1; filter: drop-shadow(0 0 10px hsla(195, 100%, 46%, 0.6)); }
  100% { transform: scale(1); opacity: 0.8; }
}

.ai-step-title {
  font-family: var(--font-headings);
  font-size: 1.25rem;
  font-weight: 700;
}

.ai-step-text {
  font-size: 0.875rem;
  color: var(--text-muted);
  min-height: 40px;
}

.ai-progress-bar {
  width: 100%;
  height: 6px;
  background-color: var(--border-color);
  border-radius: 10px;
  overflow: hidden;
}

.ai-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, hsl(var(--primary)), #38bdf8);
  width: 0%;
  transition: width 0.3s ease;
}

/* ==========================================================================
   MODALS LAYOUT
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
  z-index: 150;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-normal);
}

.modal-backdrop.show {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  width: 460px;
  background-color: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  transform: scale(0.95);
  transition: transform var(--transition-normal);
}

.modal-backdrop.show .modal-card {
  transform: scale(1);
}

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

.modal-header h3 {
  font-family: var(--font-headings);
  font-size: 1.15rem;
  font-weight: 700;
}

.modal-close-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-muted);
  line-height: 1;
}

.modal-close-btn:hover {
  color: var(--text-main);
}

.modal-body {
  padding: 20px;
}

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

/* ==========================================================================
   RESPONSIVE DESIGN ADAPTATIONS
   ========================================================================== */
@media (max-width: 768px) {
  /* Collapse Sidebar by default on mobile */
  .sidebar {
    transform: translateX(-100%);
    box-shadow: 0 0 20px rgba(0,0,0,0.15);
    height: 100vh;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }
  
  .sidebar.show {
    transform: translateX(0);
  }

  .sidebar-nav {
    flex: 1;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    display: flex;
    flex-direction: column;
  }

  .sidebar-footer {
    position: static;
    margin-top: auto;
    padding-bottom: 20px !important;
  }
  
  .sidebar-toggle {
    display: block;
  }
  
  .main-content {
    margin-left: 0;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }
  
  .mobile-header {
    display: flex;
  }
  
  .view-viewport {
    padding: 20px 20px 120px 20px;
    gap: 20px;
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }
  
  .welcome-title {
    font-size: 1.5rem;
  }
  
  .pricing-cards-container {
    grid-template-columns: 1fr;
  }

  .auth-card {
    padding: 24px 20px;
    gap: 18px;
    margin: 24px auto;
  }
  
  @media (max-width: 480px) {
    .auth-card {
      padding: 16px 14px;
      gap: 12px;
      margin: 12px auto;
    }
    .auth-brand {
      font-size: 1.35rem !important;
    }
    .auth-subtitle {
      font-size: 0.75rem !important;
    }
    .auth-form {
      gap: 10px !important;
    }
    .auth-logo-area svg {
      width: 26px !important;
      height: 26px !important;
    }
    .role-selector-card {
      padding: 8px !important;
    }
    .role-selector-card span {
      font-size: 0.8rem !important;
    }
    .role-selector-card span:last-child {
      font-size: 0.65rem !important;
    }
  }
  
  /* Prevent iOS Safari auto-zoom on input focus */
  .form-group input, 
  .form-group textarea, 
  .form-group select,
  .ai-composer-textarea,
  #authEmail,
  #authPassword,
  #authName {
    font-size: 16px !important;
  }
}

/* ==========================================================================
   UPGRADE MODAL & PAYMENT SIMULATION STYLES
   ========================================================================== */
.upgrade-card {
  width: 580px !important;
  max-width: 95% !important;
  background: var(--bg-card);
  border-radius: var(--radius-xl);
}

.payment-body {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.payment-intro p {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.payment-columns {
  display: flex;
  gap: 24px;
  align-items: stretch;
}

@media (max-width: 580px) {
  .payment-columns {
    flex-direction: column;
    align-items: center;
  }
}

.payment-qr-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
  border-right: 1px solid var(--border-color);
  padding-right: 24px;
}

@media (max-width: 580px) {
  .payment-qr-col {
    border-right: none;
    padding-right: 0;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 24px;
    width: 100%;
  }
}

.qr-container {
  position: relative;
  padding: 12px;
  background: white;
  border-radius: var(--radius-md);
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
  border: 1px solid var(--border-color);
  overflow: hidden;
}

.qr-svg {
  display: block;
}

.qr-scan-line {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 2px;
  background: linear-gradient(to right, transparent, hsl(var(--primary)), transparent);
  animation: scan 2.5s linear infinite;
  box-shadow: 0 0 8px hsl(var(--primary));
}

@keyframes scan {
  0% { top: 0%; }
  50% { top: 100%; }
  100% { top: 0%; }
}

.qr-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
  max-width: 180px;
  line-height: 1.4;
}

.payment-info-col {
  flex: 1.2;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 16px;
}

.payment-detail-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background-color: var(--bg-hover);
  padding: 18px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.pay-detail-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  line-height: 1.4;
}

.detail-label {
  color: var(--text-muted);
  font-weight: 500;
}

.detail-value {
  color: var(--text-main);
  text-align: right;
}

.text-price {
  color: #ef4444 !important;
  font-size: 1rem;
}

.text-copy {
  color: hsl(var(--primary-dark)) !important;
  background-color: var(--primary-light);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: monospace;
  font-size: 0.9rem;
}

.payment-alert {
  display: flex;
  gap: 8px;
  background-color: #fffbeb;
  border: 1px solid #fde68a;
  color: #92400e;
  padding: 12px;
  border-radius: var(--radius-md);
  font-size: 0.78rem;
  line-height: 1.4;
}

.payment-alert svg {
  flex-shrink: 0;
  margin-top: 2px;
}

/* Simulation Steps */
.payment-simulation-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 0;
}

.payment-spinner {
  width: 48px;
  height: 48px;
  border-width: 4px;
  border-color: #f3f3f3;
  border-top-color: hsl(var(--primary));
}

.payment-success-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 30px 10px;
}

/* Success Checkmark Animation */
.success-checkmark {
  width: 80px;
  height: 80px;
  margin: 0 auto 20px auto;
}

.success-checkmark .check-icon {
  width: 80px;
  height: 80px;
  position: relative;
  border-radius: 50%;
  box-sizing: content-box;
  border: 4px solid #4caf50;
}

.success-checkmark .check-icon::before {
  top: 3px;
  left: -2px;
  width: 30px;
  transform-origin: 100% 50%;
  border-radius: 100px 0 0 100px;
}

.success-checkmark .check-icon::after {
  top: 0;
  left: 30px;
  width: 60px;
  transform-origin: 0 50%;
  border-radius: 0 100px 100px 0;
}

.success-checkmark .check-icon::before, .success-checkmark .check-icon::after {
  content: '';
  height: 100px;
  position: absolute;
  background: var(--bg-card);
  transform: rotate(-45deg);
}

.success-checkmark .check-icon .icon-line {
  height: 5px;
  background-color: #4caf50;
  display: block;
  border-radius: 2px;
  position: absolute;
  z-index: 10;
}

.success-checkmark .check-icon .icon-line.line-tip {
  top: 46px;
  left: 19px;
  width: 25px;
  transform: rotate(45deg);
  animation: icon-line-tip 0.75s;
}

.success-checkmark .check-icon .icon-line.line-long {
  top: 38px;
  right: 15px;
  width: 47px;
  transform: rotate(-45deg);
  animation: icon-line-long 0.75s;
}

.success-checkmark .check-icon .icon-circle {
  top: -4px;
  left: -4px;
  z-index: 10;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 4px solid rgba(76, 175, 80, 0.2);
  box-sizing: content-box;
  position: absolute;
}

.success-checkmark .check-icon .icon-fix {
  top: 8px;
  left: 28px;
  width: 5px;
  height: 70px;
  z-index: 1;
  background: var(--bg-card);
  position: absolute;
  transform: rotate(-45deg);
}

@keyframes icon-line-tip {
  0% { width: 0; left: 1px; top: 19px; }
  54% { width: 0; left: 1px; top: 19px; }
  70% { width: 50px; left: -8px; top: 37px; }
  84% { width: 17px; left: 21px; top: 48px; }
  100% { width: 25px; left: 19px; top: 46px; }
}

@keyframes icon-line-long {
  0% { width: 0; right: 46px; top: 54px; }
  65% { width: 0; right: 46px; top: 54px; }
  84% { width: 55px; right: 0px; top: 35px; }
  100% { width: 47px; right: 15px; top: 38px; }
}

/* User Badge Color Variants */
.user-badge.trial {
  background-color: var(--primary-light);
  color: hsl(var(--primary));
  border: 1px solid rgba(17, 195, 236, 0.2);
}
.user-badge.pro {
  background-color: rgba(2, 132, 199, 0.08);
  color: #0284c7;
  border: 1px solid rgba(2, 132, 199, 0.2);
}

/* Ambient Liquid Background Blobs */
.fluid-bg-blobs {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
  opacity: 0.55;
}
.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.12;
  animation: drift 22s infinite ease-in-out;
}
[data-theme="dark"] .blob {
  opacity: 0.22;
}
.blob-1 {
  width: 550px;
  height: 550px;
  background: radial-gradient(circle, hsl(195, 100%, 50%), transparent 70%);
  top: -12%;
  left: 25%;
  animation-duration: 28s;
}
.blob-2 {
  width: 450px;
  height: 450px;
  background: radial-gradient(circle, hsl(215, 90%, 55%), transparent 70%);
  bottom: 8%;
  right: 8%;
  animation-delay: -6s;
  animation-duration: 22s;
}
.blob-3 {
  width: 380px;
  height: 380px;
  background: radial-gradient(circle, hsl(180, 100%, 45%), transparent 70%);
  bottom: 25%;
  left: 3%;
  animation-delay: -11s;
  animation-duration: 19s;
}
@keyframes drift {
  0% { transform: translate(0, 0) scale(1) rotate(0deg); }
  33% { transform: translate(120px, 90px) scale(1.15) rotate(120deg); }
  66% { transform: translate(-60px, 140px) scale(0.85) rotate(240deg); }
  100% { transform: translate(0, 0) scale(1) rotate(360deg); }
}

/* Card Spotlight Border Hover Animation */
.card, .suggested-exam-card, .item-list-card {
  position: relative;
}

.card::after, .suggested-exam-card::after, .item-list-card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1.5px;
  background: radial-gradient(
    240px circle at var(--mouse-x, 0px) var(--mouse-y, 0px),
    rgba(17, 195, 236, 0.45),
    transparent 100%
  );
  -webkit-mask: 
    linear-gradient(#fff 0 0) content-box, 
    linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--transition-normal);
  z-index: 5;
}

.card:hover::after, .suggested-exam-card:hover::after, .item-list-card:hover::after {
  opacity: 1;
}

/* Smooth Entrance Transition for Main Views */
.view-viewport {
  animation: viewFadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

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

/* Ambient Canvas Particle Network */
#ambient-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: none;
}

/* Sidebar Mobile Spacer */
.sidebar-mobile-spacer {
  display: none;
  height: 90px;
  flex-shrink: 0;
}

@media (max-width: 768px) {
  .sidebar-mobile-spacer {
    display: block !important;
  }
}

/* Body lock when sidebar is open */
body.sidebar-open {
  overflow: hidden !important;
}

/* Mobile Avatar Dropdown Popover */
.avatar-dropdown {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  width: 250px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 200;
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
  transition: opacity var(--transition-fast), transform var(--transition-fast);
}

.avatar-dropdown.show {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.avatar-dropdown::before {
  content: "";
  position: absolute;
  top: -6px;
  right: 12px;
  width: 10px;
  height: 10px;
  background-color: var(--bg-card);
  border-left: 1px solid var(--border-color);
  border-top: 1px solid var(--border-color);
  transform: rotate(45deg);
}

.dropdown-user-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.dropdown-user-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dropdown-user-email {
  font-size: 0.78rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dropdown-divider {
  height: 1px;
  background-color: var(--border-color);
  margin: 4px 0;
}

.dropdown-item-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.85rem;
}

.dropdown-item-label {
  color: var(--text-muted);
  font-weight: 500;
}

.dropdown-item-badge {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
  text-transform: uppercase;
}

.dropdown-item-badge.pro {
  background-color: rgba(2, 132, 199, 0.1);
  color: #0284c7;
  border: 1px solid rgba(2, 132, 199, 0.2);
}

.dropdown-item-badge.trial {
  background-color: var(--primary-light);
  color: hsl(var(--primary));
  border: 1px solid rgba(17, 195, 236, 0.2);
}

.dropdown-item-badge.free {
  background-color: var(--bg-hover);
  color: var(--text-muted);
  border: 1px solid var(--border-color);
}

.dropdown-item-value {
  font-weight: 600;
  color: var(--text-main);
}

.dropdown-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  background: transparent;
  color: var(--text-main);
  transition: background-color var(--transition-fast);
  text-align: left;
}

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

.dropdown-btn svg {
  color: var(--text-muted);
  flex-shrink: 0;
}

.dropdown-btn.btn-logout {
  color: #ef4444;
}

.dropdown-btn.btn-logout svg {
  color: #ef4444;
}

/* Sidebar Submenu styles */
.sidebar-submenu {
  list-style: none;
  padding-left: 28px;
  margin-top: 6px;
  width: 100%;
}

.submenu-item {
  font-size: 0.82rem;
  padding: 6px 12px;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
  display: block;
  font-weight: 500;
}

.submenu-item:hover {
  background-color: var(--bg-hover);
  color: var(--text-main);
}

.submenu-item.active {
  background: var(--bg-hover) !important;
  color: var(--text-main) !important;
  font-weight: 700;
  border-left: 3px solid #0072ff;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding-left: 9px;
}

.nav-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.nav-item.active .chevron-icon {
  transform: rotate(180deg);
}

/* Sidebar auto-generate spark button styling */
.btn-auto-generate {
  opacity: 0.3;
  transition: opacity 0.2s, transform 0.2s, color 0.2s;
  background: transparent;
  border: none;
  padding: 4px;
  cursor: pointer;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
}

.submenu-item:hover .btn-auto-generate {
  opacity: 0.8;
}

.btn-auto-generate:hover {
  opacity: 1 !important;
  color: #0072ff !important;
  background: rgba(0, 114, 255, 0.08);
  transform: scale(1.15);
}

/* AI Generation Modal Specific Styles */
.ai-modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.3);
  backdrop-filter: blur(8px);
  z-index: 9999;
  overflow-y: auto;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 24px 16px;
  -webkit-overflow-scrolling: touch;
}

.ai-modal-content {
  position: relative;
  z-index: 10000;
  width: 100%;
  max-width: 580px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  margin: auto;
  margin-top: 24px;
  margin-bottom: 24px;
}

@media (max-width: 480px) {
  .ai-modal-backdrop {
    padding: 8px 12px;
  }
  .ai-modal-content {
    margin-top: 8px;
    margin-bottom: 12px;
    border-radius: var(--radius-md);
  }
}


