/* ===== GK GS Analysis - Modern Stylesheet ===== */

:root {
  --primary: #1e3a8a;
  --primary-dark: #1e293b;
  --accent: #f59e0b;
  --accent-light: #fbbf24;
  --bg: #f8fafc;
  --bg-card: #ffffff;
  --text: #1e293b;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.05);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ===== Navigation ===== */
.navbar {
  position: sticky;
  top: 0;
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  z-index: 100;
  padding: 0.75rem 0;
}

.nav-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  color: var(--primary);
  font-weight: 800;
  font-size: 1.1rem;
  letter-spacing: -0.02em;
}

.nav-logo-icon {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: 8px;
  display: grid; place-items: center;
  color: white;
  font-size: 1.1rem;
}

.nav-links {
  display: flex;
  gap: 0.25rem;
  list-style: none;
  flex-wrap: wrap;
}

.nav-links a {
  display: block;
  padding: 0.5rem 0.85rem;
  text-decoration: none;
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.9rem;
  border-radius: var(--radius-sm);
  transition: all 0.2s;
}

.nav-links a:hover {
  color: var(--primary);
  background: #eff6ff;
}

.nav-links a.active {
  color: white;
  background: var(--primary);
}

/* ===== Hero Section ===== */
.hero {
  background: linear-gradient(135deg, #1e3a8a 0%, #312e81 50%, #1e1b4b 100%);
  color: white;
  padding: 4rem 1.5rem 5rem;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: -50%; right: -10%;
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(245,158,11,0.2) 0%, transparent 70%);
  border-radius: 50%;
}

.hero::after {
  content: '';
  position: absolute;
  bottom: -30%; left: -10%;
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(59,130,246,0.2) 0%, transparent 70%);
  border-radius: 50%;
}

.hero-content {
  max-width: 1280px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 1.25rem;
  backdrop-filter: blur(10px);
}

.hero h1 {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin-bottom: 1rem;
  background: linear-gradient(135deg, #fff 0%, #fbbf24 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero p {
  font-size: 1.1rem;
  color: rgba(255,255,255,0.85);
  max-width: 640px;
  margin-bottom: 2rem;
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
  max-width: 800px;
}

.hero-stat {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.15);
  backdrop-filter: blur(10px);
  padding: 1.25rem;
  border-radius: var(--radius-md);
  text-align: center;
}

.hero-stat-num {
  font-size: 2rem;
  font-weight: 800;
  color: var(--accent-light);
  letter-spacing: -0.02em;
  line-height: 1;
}

.hero-stat-label {
  font-size: 0.85rem;
  color: rgba(255,255,255,0.8);
  margin-top: 0.35rem;
}

/* ===== Section ===== */
.section {
  max-width: 1280px;
  margin: 0 auto;
  padding: 4rem 1.5rem;
}

.section-title {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
}

.section-subtitle {
  color: var(--text-muted);
  font-size: 1.05rem;
  margin-bottom: 2.5rem;
}

/* ===== Subject Grid ===== */
.subject-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
}

.subject-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  text-decoration: none;
  color: inherit;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: all 0.3s cubic-bezier(0.4,0,0.2,1);
  position: relative;
  overflow: hidden;
}

.subject-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: var(--card-color, var(--primary));
}

.subject-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-xl);
  border-color: var(--card-color, var(--primary));
}

.subject-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.subject-icon {
  width: 56px; height: 56px;
  border-radius: var(--radius-md);
  background: var(--card-gradient, linear-gradient(135deg, var(--primary), var(--accent)));
  display: grid; place-items: center;
  font-size: 1.75rem;
  color: white;
}

.subject-count {
  background: #f1f5f9;
  color: var(--text);
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.85rem;
}

.subject-card h3 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
  letter-spacing: -0.01em;
}

.subject-card p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.subject-card-meta {
  display: flex;
  gap: 1rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.subject-card-meta span {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

/* ===== Subject Page Hero ===== */
.subject-hero {
  background: var(--subject-gradient, linear-gradient(135deg, var(--primary), var(--accent)));
  color: white;
  padding: 3.5rem 1.5rem 4rem;
  position: relative;
  overflow: hidden;
}

.subject-hero::before {
  content: '';
  position: absolute;
  top: -50%; right: -10%;
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
  border-radius: 50%;
}

.subject-hero-content {
  max-width: 1280px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 2rem;
  flex-wrap: wrap;
}

.subject-hero-icon {
  width: 96px; height: 96px;
  background: rgba(255,255,255,0.15);
  border: 2px solid rgba(255,255,255,0.3);
  border-radius: var(--radius-lg);
  display: grid; place-items: center;
  font-size: 3rem;
  backdrop-filter: blur(10px);
  flex-shrink: 0;
}

.subject-hero-text {
  flex: 1;
  min-width: 280px;
}

.subject-hero h1 {
  font-size: clamp(1.8rem, 4vw, 2.75rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
}

.subject-hero p {
  font-size: 1.05rem;
  color: rgba(255,255,255,0.9);
  margin-bottom: 1.25rem;
  max-width: 640px;
}

.subject-hero-stats {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.subject-hero-stat {
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.2);
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-sm);
  backdrop-filter: blur(10px);
}

.subject-hero-stat-num {
  font-size: 1.5rem;
  font-weight: 800;
  line-height: 1;
}

.subject-hero-stat-label {
  font-size: 0.8rem;
  color: rgba(255,255,255,0.8);
  margin-top: 0.2rem;
}

/* ===== Chart Container ===== */
.chart-container {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
  margin-bottom: 2rem;
}

.chart-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
}

.chart-subtitle {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.chart-wrapper {
  position: relative;
  height: 400px;
  width: 100%;
}

/* ===== Sub-topic Section ===== */
.subtopic-section {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  margin-bottom: 1.5rem;
  border: 1px solid var(--border);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.subtopic-header {
  padding: 1.25rem 1.5rem;
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  transition: background 0.2s;
}

.subtopic-header:hover {
  background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
}

.subtopic-title-row {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex: 1;
}

.subtopic-number {
  width: 32px; height: 32px;
  background: var(--subject-color, var(--primary));
  color: white;
  border-radius: 50%;
  display: grid; place-items: center;
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.subtopic-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
}

.subtopic-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.subtopic-count {
  background: var(--subject-color, var(--primary));
  color: white;
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.8rem;
}

.subtopic-toggle {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0.4rem;
  color: var(--text-muted);
  transition: transform 0.3s;
  font-size: 1.1rem;
}

.subtopic-section.expanded .subtopic-toggle {
  transform: rotate(180deg);
}

.subtopic-body {
  display: none;
  padding: 1.5rem;
}

.subtopic-section.expanded .subtopic-body {
  display: block;
  animation: fadeIn 0.3s ease;
}

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

/* ===== Question Card ===== */
.question-card {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-left: 4px solid var(--subject-color, var(--primary));
  border-radius: var(--radius-sm);
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.question-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.75rem;
  gap: 1rem;
  flex-wrap: wrap;
}

.question-num {
  font-weight: 700;
  color: var(--subject-color, var(--primary));
  font-size: 0.85rem;
  background: rgba(0,0,0,0.04);
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
}

.question-shift {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-style: italic;
}

.question-text {
  font-size: 0.98rem;
  line-height: 1.55;
  margin-bottom: 0.85rem;
  color: var(--text);
}

.question-options {
  list-style: none;
  display: grid;
  gap: 0.5rem;
}

.question-options li {
  padding: 0.55rem 0.85rem;
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  transition: all 0.15s;
}

.question-options li:hover {
  background: #f8fafc;
  border-color: var(--subject-color, var(--primary));
}

.option-letter {
  font-weight: 700;
  color: var(--subject-color, var(--primary));
  flex-shrink: 0;
}

/* Explanation box under each question */
.explanation {
  margin-top: 0.75rem;
  padding: 0.75rem 1rem;
  background: #fef3c7;
  border-left: 3px solid #f59e0b;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  color: #78350f;
  line-height: 1.5;
}

.explanation strong {
  color: #92400e;
  font-weight: 700;
}

/* ===== Footer ===== */
.footer {
  background: var(--primary-dark);
  color: rgba(255,255,255,0.7);
  padding: 3rem 1.5rem 2rem;
  margin-top: 4rem;
}

.footer-content {
  max-width: 1280px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 2rem;
  margin-bottom: 2rem;
}

.footer-section h4 {
  color: white;
  font-size: 1rem;
  margin-bottom: 0.85rem;
  font-weight: 700;
}

.footer-section a {
  display: block;
  color: rgba(255,255,255,0.7);
  text-decoration: none;
  font-size: 0.9rem;
  padding: 0.25rem 0;
  transition: color 0.15s;
}

.footer-section a:hover { color: var(--accent-light); }

.footer-bottom {
  max-width: 1280px;
  margin: 0 auto;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(255,255,255,0.1);
  text-align: center;
  font-size: 0.85rem;
  color: rgba(255,255,255,0.5);
}

/* ===== Breadcrumb ===== */
.breadcrumb {
  max-width: 1280px;
  margin: 0 auto;
  padding: 1rem 1.5rem;
  display: flex;
  gap: 0.5rem;
  align-items: center;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.breadcrumb a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.15s;
}

.breadcrumb a:hover { color: var(--primary); }

.breadcrumb-sep {
  color: var(--text-muted);
  opacity: 0.5;
}

/* ===== Mobile Menu ===== */
.mobile-menu-btn {
  display: none;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.4rem 0.6rem;
  cursor: pointer;
  font-size: 1.2rem;
  color: var(--text);
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .mobile-menu-btn { display: block; }
  .nav-links {
    display: none;
    position: absolute;
    top: 100%; left: 0; right: 0;
    background: white;
    border-bottom: 1px solid var(--border);
    padding: 1rem;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
  }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 0.75rem 1rem; }
  .section { padding: 2.5rem 1rem; }
  .hero { padding: 3rem 1rem 4rem; }
  .subject-hero { padding: 2.5rem 1rem 3rem; }
  .subject-hero-content { flex-direction: column; align-items: flex-start; }
  .question-card { padding: 1rem; }
  .chart-wrapper { height: 300px; }
}

/* ===== Loading ===== */
.loading {
  display: grid;
  place-items: center;
  padding: 4rem 2rem;
  color: var(--text-muted);
  font-size: 1.05rem;
}

.loading-spinner {
  width: 40px; height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 1rem;
}

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

/* ===== Utility ===== */
.text-center { text-align: center; }
.mt-4 { margin-top: 2rem; }
.mb-4 { margin-bottom: 2rem; }
.container { max-width: 1280px; margin: 0 auto; padding: 0 1.5rem; }
