/* ===================================
   MAD Teaching Website - Main Styles
   Modern Dark Mode Design
   =================================== */

/* CSS Variables */
:root {
  /* Dark Mode Colors (Default) */
  --bg-primary: #0a0a0f;
  --bg-secondary: #12121a;
  --bg-card: rgba(255, 255, 255, 0.03);
  --bg-glass: rgba(255, 255, 255, 0.05);

  --text-primary: #ffffff;
  --text-secondary: #a0a0b0;
  --text-muted: #606070;

  --accent-primary: #6366f1;
  --accent-secondary: #8b5cf6;
  --accent-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #a855f7 100%);

  --border-color: rgba(255, 255, 255, 0.08);
  --shadow-glow: 0 0 60px rgba(99, 102, 241, 0.15);

  /* Spacing */
  --space-xs: 0.5rem;
  --space-sm: 1rem;
  --space-md: 1.5rem;
  --space-lg: 2rem;
  --space-xl: 3rem;
  --space-2xl: 4rem;

  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.3s ease;
  --transition-slow: 0.5s ease;

  /* Border Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
}

/* Light Mode */
[data-theme="light"] {
  --bg-primary: #fafafa;
  --bg-secondary: #ffffff;
  --bg-card: rgba(0, 0, 0, 0.02);
  --bg-glass: rgba(0, 0, 0, 0.03);

  --text-primary: #1a1a2e;
  --text-secondary: #4a4a5a;
  --text-muted: #8a8a9a;

  --border-color: rgba(0, 0, 0, 0.08);
  --shadow-glow: 0 0 60px rgba(99, 102, 241, 0.1);
}

/* Reset & Base */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Background Effects */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(99, 102, 241, 0.15), transparent),
    radial-gradient(ellipse 60% 40% at 100% 0%, rgba(139, 92, 246, 0.1), transparent),
    radial-gradient(ellipse 60% 40% at 0% 100%, rgba(168, 85, 247, 0.08), transparent);
  pointer-events: none;
  z-index: -1;
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

h1 {
  font-size: clamp(2.5rem, 5vw, 4rem);
}

h2 {
  font-size: clamp(1.75rem, 3vw, 2.5rem);
}

h3 {
  font-size: clamp(1.25rem, 2vw, 1.5rem);
}

a {
  color: var(--accent-primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--accent-secondary);
}

/* Container */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-md);
}

/* Header */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: var(--space-sm) 0;
  background: rgba(10, 10, 15, 0.8);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-color);
}

[data-theme="light"] .header {
  background: rgba(255, 255, 255, 0.8);
}

.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
}

.logo-icon {
  width: 36px;
  height: 36px;
  background: var(--accent-gradient);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}

.nav {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.nav-link {
  color: var(--text-secondary);
  font-weight: 500;
  transition: color var(--transition-fast);
}

.nav-link:hover {
  color: var(--text-primary);
}

/* Theme Toggle */
.theme-toggle {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  transition: all var(--transition-fast);
}

.theme-toggle:hover {
  background: var(--bg-glass);
  border-color: var(--accent-primary);
}

/* Hero Section */
.hero {
  padding: calc(80px + var(--space-2xl)) 0 var(--space-2xl);
  text-align: center;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-xs) var(--space-sm);
  background: var(--bg-glass);
  border: 1px solid var(--border-color);
  border-radius: 100px;
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: var(--space-md);
}

.hero-badge::before {
  content: '📱';
}

.hero h1 {
  margin-bottom: var(--space-md);
}

.hero h1 span {
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-description {
  max-width: 600px;
  margin: 0 auto var(--space-lg);
  color: var(--text-secondary);
  font-size: 1.125rem;
}

.hero-stats {
  display: flex;
  justify-content: center;
  gap: var(--space-xl);
  flex-wrap: wrap;
}

.stat {
  text-align: center;
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.stat-label {
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* Section */
.section {
  padding: var(--space-2xl) 0;
}

.section-header {
  text-align: center;
  margin-bottom: var(--space-xl);
}

.section-header h2 {
  margin-bottom: var(--space-sm);
}

.section-header p {
  color: var(--text-secondary);
}

/* Week Cards Grid */
.weeks-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-md);
}

.week-card {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  transition: all var(--transition-normal);
  overflow: hidden;
}

.week-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--accent-gradient);
  opacity: 0;
  transition: opacity var(--transition-normal);
}

.week-card:hover {
  transform: translateY(-4px);
  border-color: rgba(99, 102, 241, 0.3);
  box-shadow: var(--shadow-glow);
}

.week-card:hover::before {
  opacity: 1;
}

.week-number {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent-primary);
  margin-bottom: var(--space-xs);
}

.week-card h3 {
  margin-bottom: var(--space-sm);
  color: var(--text-primary);
}

.week-card p {
  color: var(--text-secondary);
  font-size: 0.875rem;
  margin-bottom: var(--space-md);
}

.week-meta {
  display: flex;
  gap: var(--space-md);
  font-size: 0.8rem;
  color: var(--text-muted);
}

.week-meta span {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.week-card-link {
  position: absolute;
  inset: 0;
  z-index: 1;
}

/* Week Page Styles */
.week-hero {
  padding: calc(80px + var(--space-xl)) 0 var(--space-xl);
}

.week-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-lg);
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.back-link:hover {
  color: var(--accent-primary);
}

.week-pagination {
  display: flex;
  gap: var(--space-sm);
}

.week-pagination a {
  padding: var(--space-xs) var(--space-sm);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.875rem;
  transition: all var(--transition-fast);
}

.week-pagination a:hover {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

.week-title {
  margin-bottom: var(--space-sm);
}

.week-description {
  color: var(--text-secondary);
  max-width: 700px;
}

/* Content Sections */
.content-section {
  margin-bottom: var(--space-xl);
}

.content-section h2 {
  margin-bottom: var(--space-md);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.content-section h2::before {
  content: '';
  width: 4px;
  height: 1.5em;
  background: var(--accent-gradient);
  border-radius: 2px;
}

/* Video List */
.video-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.video-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}

.video-item:hover {
  border-color: var(--accent-primary);
  background: var(--bg-glass);
}

.video-icon {
  width: 48px;
  height: 48px;
  background: var(--accent-gradient);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
}

.video-info {
  flex: 1;
}

.video-title {
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.video-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.video-link {
  padding: var(--space-xs) var(--space-md);
  background: var(--accent-gradient);
  border-radius: var(--radius-sm);
  color: white;
  font-weight: 500;
  font-size: 0.875rem;
  transition: opacity var(--transition-fast);
}

.video-link:hover {
  opacity: 0.9;
  color: white;
}

/* PDF Section */
.pdf-card {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-lg);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
}

.pdf-icon {
  width: 64px;
  height: 64px;
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  flex-shrink: 0;
}

.pdf-info {
  flex: 1;
}

.pdf-title {
  font-weight: 600;
  font-size: 1.125rem;
  margin-bottom: 0.25rem;
}

.pdf-meta {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.pdf-actions {
  display: flex;
  gap: var(--space-sm);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: 0.875rem;
  transition: all var(--transition-fast);
  cursor: pointer;
  border: none;
}

.btn-primary {
  background: var(--accent-gradient);
  color: white;
}

.btn-primary:hover {
  opacity: 0.9;
  color: white;
}

.btn-secondary {
  background: var(--bg-glass);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
}

.btn-secondary:hover {
  border-color: var(--accent-primary);
}

/* Code Section */
.code-card {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-lg);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
}

.code-icon {
  width: 64px;
  height: 64px;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  flex-shrink: 0;
}

.code-info {
  flex: 1;
}

.code-title {
  font-weight: 600;
  font-size: 1.125rem;
  margin-bottom: 0.25rem;
}

.code-meta {
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* Footer */
.footer {
  padding: var(--space-xl) 0;
  border-top: 1px solid var(--border-color);
  text-align: center;
  color: var(--text-muted);
  font-size: 0.875rem;
}

/* Responsive */
@media (max-width: 768px) {
  .nav {
    display: none;
  }

  .hero-stats {
    gap: var(--space-lg);
  }

  .week-nav {
    flex-direction: column;
    gap: var(--space-sm);
    align-items: flex-start;
  }

  .video-item {
    flex-wrap: wrap;
  }

  .video-link {
    width: 100%;
    text-align: center;
  }

  .pdf-card {
    flex-direction: column;
    text-align: center;
  }

  .pdf-actions {
    width: 100%;
    flex-direction: column;
  }
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.week-card {
  animation: fadeIn 0.5s ease backwards;
}

.week-card:nth-child(1) {
  animation-delay: 0.1s;
}

.week-card:nth-child(2) {
  animation-delay: 0.15s;
}

.week-card:nth-child(3) {
  animation-delay: 0.2s;
}

.week-card:nth-child(4) {
  animation-delay: 0.25s;
}

.week-card:nth-child(5) {
  animation-delay: 0.3s;
}

.week-card:nth-child(6) {
  animation-delay: 0.35s;
}

.week-card:nth-child(7) {
  animation-delay: 0.4s;
}

.week-card:nth-child(8) {
  animation-delay: 0.45s;
}

.week-card:nth-child(9) {
  animation-delay: 0.5s;
}

.week-card:nth-child(10) {
  animation-delay: 0.55s;
}

.week-card:nth-child(11) {
  animation-delay: 0.6s;
}

.week-card:nth-child(12) {
  animation-delay: 0.65s;
}

.week-card:nth-child(13) {
  animation-delay: 0.7s;
}