/* =============================================
   math.css — Mathematics Subject Page Styles
   Integrates with the existing style.css system
   ============================================= */

/* ── Hero ─────────────────────────────────── */
.math-hero {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #1E3A5F 0%, #1A1A2E 60%, #16213E 100%);
  padding: 80px 0 60px;
  color: #fff;
}

body:not(.dark-mode) .math-hero {
  background: linear-gradient(135deg, #1E3A5F 0%, #1A1A2E 60%, #16213E 100%);
}

.math-hero-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.math-grid-overlay {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(59,130,246,.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(59,130,246,.06) 1px, transparent 1px);
  background-size: 40px 40px;
}

.math-symbol {
  position: absolute;
  color: #fff;
  font-family: 'Georgia', serif;
  user-select: none;
  pointer-events: none;
}

.math-hero-content {
  position: relative;
  z-index: 1;
  text-align: center;
}

.math-hero-icon {
  width: 80px;
  height: 80px;
  background: linear-gradient(135deg, #3B82F6, #8B5CF6);
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: #fff;
  margin: 0 auto 20px;
  box-shadow: 0 8px 32px rgba(59,130,246,.4);
}

.math-subject-badge {
  display: inline-block;
  padding: 6px 18px;
  background: rgba(59,130,246,.2);
  border: 1px solid rgba(59,130,246,.4);
  border-radius: 50px;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #93C5FD;
  margin-bottom: 16px;
}

.math-hero-title {
  font-size: clamp(2.5rem, 6vw, 4rem);
  font-weight: 800;
  margin-bottom: 12px;
  background: linear-gradient(135deg, #fff 0%, #93C5FD 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.math-hero-subtitle {
  font-size: 1.1rem;
  color: rgba(255,255,255,.75);
  max-width: 560px;
  margin: 0 auto 30px;
  line-height: 1.7;
}

.math-hero-stats {
  display: flex;
  gap: 40px;
  justify-content: center;
  margin-bottom: 32px;
  flex-wrap: wrap;
}

.math-hero-stat {
  text-align: center;
}

.math-stat-num {
  display: block;
  font-size: 1.8rem;
  font-weight: 800;
  color: #60A5FA;
  line-height: 1;
}

.math-stat-label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: rgba(255,255,255,.5);
  margin-top: 4px;
  display: block;
}

.math-hero-actions {
  display: flex;
  gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
}

.math-hero-actions .btn-secondary {
  background: rgba(255,255,255,.1);
  border-color: rgba(255,255,255,.25);
  color: #fff;
}

.math-hero-actions .btn-secondary:hover {
  background: rgba(255,255,255,.2);
  border-color: #fff;
  color: #fff;
}

/* ── Tabs Bar ──────────────────────────────── */
.math-tabs-bar {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 70px;
  z-index: 50;
}

.math-tabs {
  display: flex;
  gap: 4px;
  padding: 0 4px;
  overflow-x: auto;
}

.math-tab {
  flex-shrink: 0;
  padding: 14px 22px;
  font-size: 0.9rem;
  font-weight: 600;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.25s ease;
  white-space: nowrap;
}

.math-tab:hover {
  color: var(--accent-primary);
}

.math-tab.active {
  color: var(--accent-primary);
  border-bottom-color: var(--accent-primary);
}

/* ── Main Layout ───────────────────────────── */
.math-main {
  padding: 50px 0 80px;
}

.math-section {
  margin-bottom: 70px;
}

.math-section-header {
  margin-bottom: 30px;
}

.math-section-title {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.math-section-title i {
  color: var(--accent-primary);
}

.math-section-desc {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

/* ── Topic Cards ───────────────────────────── */
.math-topics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 20px;
}

.math-topic-card {
  border-radius: 16px;
  border: 1px solid var(--border-color);
  background: var(--card-bg);
  overflow: hidden;
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
  position: relative;
}

.math-topic-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 40px var(--shadow);
  border-color: var(--accent-primary);
}

.math-topic-card.hidden {
  display: none;
}

.topic-card-accent {
  height: 4px;
  width: 100%;
}

.topic-card-inner {
  padding: 22px;
}

.topic-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  margin-bottom: 14px;
}

.topic-info {
  margin-bottom: 16px;
}

.topic-category-tag {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 3px 10px;
  border-radius: 50px;
  margin-bottom: 8px;
  display: inline-block;
}

.topic-category-tag.geometry {
  background: rgba(59,130,246,.12);
  color: #3B82F6;
}

.topic-category-tag.number {
  background: rgba(16,185,129,.12);
  color: #10B981;
}

.topic-category-tag.algebra {
  background: rgba(139,92,246,.12);
  color: #8B5CF6;
}

.topic-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
  font-family: 'Poppins', sans-serif;
}

.topic-desc {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* Key Facts */
.topic-key-facts {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
  background: var(--hover-overlay);
  border-radius: 10px;
  padding: 12px;
}

.key-fact {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.83rem;
  color: var(--text-secondary);
}

.fact-symbol {
  width: 22px;
  height: 22px;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent-primary);
  flex-shrink: 0;
}

/* Topic Actions */
.topic-actions {
  display: flex;
  gap: 10px;
}

.topic-expand-btn {
  flex: 1;
  padding: 9px 14px;
  border-radius: 9px;
  font-size: 0.82rem;
  font-weight: 600;
  background: var(--hover-overlay);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.topic-expand-btn:hover {
  background: var(--accent-primary);
  color: #fff;
  border-color: var(--accent-primary);
}

.topic-expand-btn.active {
  background: var(--accent-primary);
  color: #fff;
  border-color: var(--accent-primary);
}

.topic-quiz-btn {
  flex: 1;
  padding: 9px 14px;
  border-radius: 9px;
  font-size: 0.82rem;
  font-weight: 600;
  background: var(--accent-gradient);
  color: #fff;
  text-decoration: none;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.topic-quiz-btn:hover {
  opacity: 0.9;
  transform: scale(1.02);
}

/* Concept Panel */
.topic-concept-panel {
  margin-top: 16px;
  padding: 16px;
  background: var(--hover-overlay);
  border-radius: 10px;
  border-left: 3px solid var(--accent-primary);
  animation: slideDownFade 0.3s ease;
}

.topic-concept-panel h4 {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent-primary);
  margin-bottom: 8px;
  margin-top: 12px;
}

.topic-concept-panel h4:first-child {
  margin-top: 0;
}

.topic-concept-panel ul {
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.topic-concept-panel li {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.topic-concept-panel p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

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

/* ── Stats Strip ───────────────────────────── */
.math-stats-strip {
  display: flex;
  gap: 0;
  border: 1px solid var(--border-color);
  border-radius: 16px;
  overflow: hidden;
  background: var(--card-bg);
  margin-bottom: 60px;
}

.math-stat-strip-item {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 24px 20px;
  border-right: 1px solid var(--border-color);
}

.math-stat-strip-item:last-child {
  border-right: none;
}

.math-stat-strip-item i {
  font-size: 1.4rem;
}

.math-stat-strip-item div {
  display: flex;
  flex-direction: column;
}

.math-stat-strip-item strong {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
}

.math-stat-strip-item span {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  margin-top: 3px;
}

/* ── Tips Grid ─────────────────────────────── */
.math-tips-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 18px;
}

.math-tip-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 24px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.math-tip-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px var(--shadow);
}

.math-tip-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1rem;
  margin-bottom: 14px;
}

.math-tip-card h4 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
  font-family: 'Poppins', sans-serif;
}

.math-tip-card p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ── Responsive ────────────────────────────── */
@media (max-width: 900px) {
  .math-topics-grid {
    grid-template-columns: 1fr;
  }

  .math-stats-strip {
    flex-direction: column;
  }

  .math-stat-strip-item {
    border-right: none;
    border-bottom: 1px solid var(--border-color);
  }

  .math-stat-strip-item:last-child {
    border-bottom: none;
  }
}

@media (max-width: 600px) {
  .math-hero {
    padding: 50px 0 40px;
  }

  .math-hero-stats {
    gap: 24px;
  }

  .math-hero-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .math-hero-actions .btn {
    justify-content: center;
  }

  .math-tips-grid {
    grid-template-columns: 1fr;
  }
}