@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
  --bg-color: #050505;
  --surface-color: #111111;
  --surface-border: #222222;
  --primary-color: #7b2cbf;
  --primary-hover: #9d4edd;
  --secondary-color: #3a0ca3;
  --accent-color: #9d4edd;
  --text-primary: #ffffff;
  --text-secondary: #a0a0a0;
  --success: #2dce89;
  --danger: #f5365c;
  --warning: #fb6340;
  --gold: #d4af37;
  --saffron: #ff9933;
  --saffron-hover: #e68a2e;
  --glass-bg: rgba(255, 255, 255, 0.03);
  --glass-blur: 15px;
  --shadow-sm: 0 2px 4px rgba(0,0,0,0.5);
  --shadow-md: 0 8px 16px rgba(0,0,0,0.7);
  --shadow-lg: 0 20px 40px rgba(0,0,0,0.9);
}

.light-theme {
  --bg-color: #f8fafc;
  --surface-color: #ffffff;
  --surface-border: #e2e8f0;
  --primary-color: #6d28d9;
  --primary-hover: #5b21b6;
  --secondary-color: #4c1d95;
  --accent-color: #0ea5e9;
  --text-primary: #0f172a;
  --text-secondary: #64748b;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --glass-bg: rgba(255, 255, 255, 0.85);
  --glass-blur: 10px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.05);
  --shadow-lg: 0 10px 30px rgba(0,0,0,0.1);
}

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

body {
  font-family: 'Outfit', sans-serif;
  background-color: var(--bg-color);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  transition: background-color 0.3s, color 0.3s;
}

body:not(.light-theme) {
  background-image: 
    radial-gradient(circle at 15% 50%, rgba(123, 44, 191, 0.15), transparent 25%),
    radial-gradient(circle at 85% 30%, rgba(76, 201, 240, 0.15), transparent 25%);
}

.light-theme body {
  background-image: 
    radial-gradient(circle at 15% 50%, rgba(109, 40, 217, 0.05), transparent 25%),
    radial-gradient(circle at 85% 30%, rgba(14, 165, 233, 0.05), transparent 25%);
}

/* Global Copyright Watermark */
body::after {
  content: "© RC Mastery";
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15vw;
  font-weight: 800;
  color: var(--watermark-color, rgba(255, 255, 255, 0.03));
  transform: rotate(-30deg);
  pointer-events: none;
  z-index: -1;
  white-space: nowrap;
}

.light-theme { --watermark-color: rgba(0, 0, 0, 0.02); }

a {
  text-decoration: none;
  color: inherit;
}

/* Glassmorphism utility */
.glass-panel {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--surface-border);
  border-radius: 16px;
  padding: 24px;
}

/* Button utility */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 24px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.3s ease;
  border: none;
  outline: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  color: white;
  box-shadow: 0 4px 15px rgba(123, 44, 191, 0.4);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(123, 44, 191, 0.6);
  background: linear-gradient(135deg, var(--primary-hover), var(--primary-color));
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--primary-color);
  color: var(--text-primary);
}

.btn-outline:hover {
  background: rgba(123, 44, 191, 0.1);
  transform: translateY(-2px);
}

.btn-danger {
  background: transparent;
  border: 1px solid var(--danger);
  color: var(--danger);
}
.btn-danger:hover {
  background: rgba(239, 71, 111, 0.1);
}

/* Navigation */
nav {
  padding: 20px 5%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--surface-border);
  background: rgba(10, 10, 15, 0.8);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 100;
}

.logo {
  font-size: 1.5rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 2px;
}

.logo-saffron {
  color: var(--saffron) !important;
  -webkit-text-fill-color: var(--saffron) !important;
}

.logo-mastery {
  background: linear-gradient(135deg, var(--accent-color), var(--primary-hover));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.nav-links {
  display: flex;
  gap: 20px;
}

.nav-links a {
  font-weight: 500;
  transition: color 0.3s;
}

.nav-links a:hover {
  color: var(--accent-color);
}

/* Dropdown Menu */
.menu-container {
  position: relative;
  display: inline-block;
}

.menu-trigger {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-secondary);
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 1.1rem;
}

.menu-trigger:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-primary);
  transform: translateY(-2px);
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  width: 180px;
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--surface-border);
  border-radius: 12px;
  padding: 8px;
  display: none;
  flex-direction: column;
  gap: 4px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  animation: dropdownFade 0.2s ease;
  z-index: 1000;
}

.dropdown-menu.show {
  display: flex;
}

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

.dropdown-item {
  padding: 10px 14px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all 0.2s;
}

.dropdown-item:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
}

.dropdown-item i {
  font-size: 1rem;
  width: 20px;
  text-align: center;
}

/* Login Page Specific */
.login-container {
  min-height: calc(100vh - 140px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}

.login-card {
  width: 100%;
  max-width: 400px;
  padding: 40px;
  animation: fadeUp 0.5s ease;
}

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

.login-header {
  text-align: center;
  margin-bottom: 32px;
}

.login-header h1 {
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.login-header p {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.login-footer {
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid var(--surface-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.protection-mark {
  color: rgba(255, 255, 255, 0.2);
  transition: all 0.3s;
  font-size: 1.2rem;
}

.protection-mark:hover {
  color: var(--accent-color);
  transform: scale(1.1);
}

/* Home Page */
.hero {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 0 20px;
  position: relative;
}

.hero h1 {
  font-size: 4rem;
  font-weight: 700;
  margin-bottom: 20px;
  line-height: 1.1;
}

.hero h1 span {
  background: linear-gradient(135deg, var(--primary-hover), var(--accent-color));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero p {
  font-size: 1.2rem;
  color: var(--text-secondary);
  max-width: 600px;
  margin-bottom: 40px;
}

.features {
  display: flex;
  gap: 30px;
  margin-top: 60px;
  flex-wrap: wrap;
  justify-content: center;
}

.feature-card {
  width: 250px;
  padding: 30px 20px;
  text-align: center;
  transition: transform 0.3s;
}

.feature-card:hover {
  transform: translateY(-10px);
}

.feature-card i {
  font-size: 2.5rem;
  color: var(--accent-color);
  margin-bottom: 15px;
}

/* Practice Page Layout */
.practice-container {
  display: flex;
  flex: 1;
  height: calc(100vh - 70px); /* Minus nav */
}

.sidebar {
  width: 300px;
  border-right: 1px solid var(--surface-border);
  background: rgba(10, 10, 15, 0.5);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.sidebar-header {
  padding: 20px;
  border-bottom: 1px solid var(--surface-border);
  font-weight: 600;
  font-size: 1.2rem;
  color: var(--accent-color);
}

.rc-list {
  list-style: none;
  padding: 10px;
}

.rc-item {
  padding: 15px;
  border-radius: 8px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: background 0.2s;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid transparent;
}

.rc-item:hover {
  background: var(--surface-color);
}

.rc-item.active {
  background: rgba(123, 44, 191, 0.2);
  border-color: var(--primary-color);
}

.rc-item-date {
  font-size: 0.9rem;
  color: var(--text-secondary);
}
.rc-item-title {
  font-weight: 500;
}

.main-content {
  flex: 1;
  padding: 30px;
  overflow-y: auto;
  position: relative;
}

/* RC Quiz Interface */
.passage-container {
  margin-bottom: 40px;
  line-height: 2;
  font-size: 1.15rem;
  color: var(--text-primary);
  max-width: 900px;
  margin-left: auto;
  margin-right: auto;
}

.passage-container p {
  margin-bottom: 24px;
}

.question-card {
  margin-bottom: 30px;
}

.question-text {
  font-weight: 600;
  font-size: 1.2rem;
  margin-bottom: 15px;
}

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

.option-label {
  display: flex;
  align-items: center;
  padding: 15px;
  border-radius: 8px;
  background: var(--surface-color);
  border: 1px solid var(--surface-border);
  cursor: pointer;
  transition: all 0.2s;
}

.option-label:hover {
  background: rgba(255, 255, 255, 0.1);
}

.option-label input[type="radio"] {
  margin-right: 15px;
  accent-color: var(--primary-color);
  width: 18px;
  height: 18px;
}

/* Selected option visual */
.option-label:has(input[type="radio"]:checked) {
  border-color: var(--primary-color);
  background: rgba(123, 44, 191, 0.1);
}

.submit-section {
  margin-top: 40px;
  text-align: center;
}

/* Results Interface */
.results-header {
  text-align: center;
  margin-bottom: 40px;
}

.score-display {
  font-size: 3rem;
  font-weight: 700;
  color: var(--success);
  margin: 10px 0;
}

.option-label.correct {
  border-color: var(--success);
  background: rgba(6, 214, 160, 0.1);
}

.option-label.incorrect {
  border-color: var(--danger);
  background: rgba(239, 71, 111, 0.1);
}

.question-meta {
  display: flex;
  justify-content: space-between;
  margin-top: 15px;
  font-size: 0.9rem;
  padding-top: 15px;
  border-top: 1px solid var(--surface-border);
}

.difficulty-badge {
  padding: 4px 10px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 0.8rem;
}

.diff-easy { background: rgba(6, 214, 160, 0.2); color: var(--success); }
.diff-medium { background: rgba(255, 209, 102, 0.2); color: var(--warning); }
.diff-hard { background: rgba(239, 71, 111, 0.2); color: var(--danger); }

.feedback-text {
  font-weight: 600;
}
.feedback-text.correct { color: var(--success); }
.feedback-text.incorrect { color: var(--danger); }

/* Admin Form */
.admin-container {
  max-width: 800px;
  margin: 40px auto;
  padding: 0 20px;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  color: var(--text-secondary);
  font-weight: 500;
}

.form-control {
  width: 100%;
  padding: 12px 15px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--surface-border);
  border-radius: 8px;
  color: white;
  font-family: inherit;
  font-size: 1rem;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary-color);
}

textarea.form-control {
  resize: vertical;
  min-height: 120px;
}

.question-builder {
  margin-top: 30px;
  border-top: 1px solid var(--surface-border);
  padding-top: 30px;
}

.admin-q-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px dashed var(--surface-border);
  padding: 20px;
  margin-bottom: 20px;
  border-radius: 8px;
}

.flex-row {
  display: flex;
  gap: 15px;
}
.flex-row > div {
  flex: 1;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-secondary);
  text-align: center;
}
.empty-state i {
  font-size: 4rem;
  margin-bottom: 20px;
  opacity: 0.5;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-color);
}
::-webkit-scrollbar-thumb {
  background: var(--surface-border);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary);
}

@media print {
  body { 
    background: #ffffff !important; 
    color: #1f2937 !important; 
    font-family: 'Outfit', 'Inter', sans-serif !important;
    font-size: 11pt;
    line-height: 1.7;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  
  body::after {
    content: "OFFICIAL RC MASTERY REPORT";
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-45deg);
    font-size: 60pt;
    font-weight: 800;
    color: rgba(0, 0, 0, 0.03) !important;
    white-space: nowrap;
    pointer-events: none;
    z-index: -1;
  }
  
  .no-print { display: none !important; }
  .print-only { display: block !important; }

  /* Premium Cover Page styling */
  .pdf-cover-page {
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    page-break-after: always;
    padding: 40px;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif !important;
  }

  .pdf-cover-logo {
    font-size: 3rem;
    font-weight: 900;
    margin-bottom: 25px;
    letter-spacing: 4px;
    text-transform: uppercase;
    color: #111827;
    border-bottom: 3px solid #111827;
    padding-bottom: 10px;
    display: inline-block;
  }

  .pdf-cover-title {
    font-size: 2.2rem;
    font-weight: 800;
    margin-top: 20px;
    margin-bottom: 15px;
    color: #374151;
  }

  .pdf-cover-subtitle {
    font-size: 1.2rem;
    font-weight: 500;
    color: #6b7280;
    margin-bottom: 50px;
    letter-spacing: 1px;
  }

  .pdf-score-box {
    border: 2px solid #e5e7eb;
    border-radius: 16px;
    padding: 50px 100px;
    margin: 40px 0;
    background: #f9fafb !important;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
  }

  .pdf-score-val {
    font-size: 5.5rem;
    font-weight: 900;
    color: #111827;
    margin: 0;
    line-height: 1;
  }

  .pdf-score-lbl {
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-top: 10px;
  }

  .print-header {
    border-bottom: 2px solid #000;
    padding-bottom: 15px;
    margin-bottom: 25px;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    font-family: 'Outfit', sans-serif;
  }
  
  .print-logo {
    font-size: 18pt;
    font-weight: 800;
    color: #050505;
    letter-spacing: -1px;
  }

  footer.print-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    text-align: center;
    font-size: 9pt;
    color: #444;
    border-top: 1px solid #000;
    padding-top: 15px;
    padding-bottom: 10px;
    background: white;
    font-family: 'Outfit', sans-serif;
  }

  .passage-box, .passage-text, .exam-passage {
    page-break-after: always;
    border: none;
    padding: 0;
    background: transparent !important;
    line-height: 1.9;
    font-size: 12pt;
    color: #222;
  }
  
  .q-card, .review-item, .admin-q-card, .print-q {
    page-break-inside: avoid;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    margin-bottom: 24px;
    padding: 20px;
    background: #ffffff !important;
  }

  .print-copyright {
    margin-top: 40px;
    padding: 20px;
    border-top: 1px solid #000;
    font-size: 9pt;
    line-height: 1.6;
    text-align: center;
    font-family: 'Outfit', sans-serif;
  }
}

.print-only { display: none; }



/* Saffron Utility Classes */
.text-saffron { color: var(--saffron) !important; }
.bg-saffron { background-color: var(--saffron) !important; }
.border-saffron { border-color: var(--saffron) !important; }

.btn-saffron {
  background: linear-gradient(135deg, var(--saffron), var(--saffron-hover));
  color: white;
  border: none;
  box-shadow: 0 4px 15px rgba(255, 153, 51, 0.4);
}
.btn-saffron:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(255, 153, 51, 0.6);
  background: linear-gradient(135deg, var(--saffron-hover), var(--saffron));
}

/* Global Mobile Fixes */
@media (max-width: 768px) {
  nav {
    flex-direction: column;
    padding: 15px 20px;
    gap: 15px;
  }
  .nav-links {
    width: 100%;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
  }
  .features-grid, .features {
    grid-template-columns: 1fr !important;
    gap: 15px !important;
  }
  .feature-card {
    width: 100% !important;
  }
  .login-card {
    padding: 30px 20px;
  }
  /* Practice page specific mobile fixes */
  .passage-box { padding: 20px; font-size: 1rem; }
  .q-card { padding: 20px; }
  .exam-body { flex-direction: column; }
  
  /* Sidebar Mobile Dropdown */
  #mobile-sidebar-toggle {
    display: block !important;
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--surface-border);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 1.2rem;
  }
  .rc-scroll { display: none; }
  .rc-scroll.show { display: block; max-height: 350px; overflow-y: auto; border-top: 1px solid var(--surface-border); }
  .p-sidebar { max-height: none !important; }

  /* Exam Palette Mobile Dropdown */
  #mobile-palette-toggle {
    display: inline-block !important;
    background: transparent;
    color: white;
    border: 1px solid rgba(255,255,255,0.3);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.9rem;
  }
  .exam-palette {
    display: none; /* hidden by default on mobile */
    position: absolute;
    right: 0;
    top: 60px; /* below header */
    z-index: 1000;
    background: white;
    box-shadow: -5px 5px 15px rgba(0,0,0,0.3);
    width: 280px;
    border-left: 1px solid #ddd;
    border-bottom: 1px solid #ddd;
    border-bottom-left-radius: 12px;
  }
  .exam-palette.show { display: flex !important; flex-direction: column; }
}
