/* ============================================
   DAY TRADING COURSE — Design System & Layout
   ============================================ */

/* --- CSS Custom Properties --- */
:root {
  /* Backgrounds */
  --bg-primary: #0a0e17;
  --bg-secondary: #111827;
  --bg-elevated: #1e293b;
  --bg-hover: #263348;

  /* Brand Colors */
  --accent-blue: #3b82f6;
  --accent-blue-dim: #2563eb;
  --accent-purple: #8b5cf6;
  --accent-gold: #f59e0b;
  --accent-gold-dim: #d97706;

  /* Trading Colors */
  --bull-green: #10b981;
  --bull-green-bright: #00e676;
  --bear-red: #ef4444;
  --bear-red-bright: #ff1744;

  /* Text */
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #475569;
  --text-inverse: #0a0e17;

  /* Borders & Dividers */
  --border-color: #1e293b;
  --border-light: #334155;

  /* Gradients */
  --gradient-blue: linear-gradient(135deg, #3b82f6, #8b5cf6);
  --gradient-green: linear-gradient(135deg, #10b981, #06b6d4);
  --gradient-gold: linear-gradient(135deg, #f59e0b, #ef4444);
  --gradient-dark: linear-gradient(180deg, #0a0e17 0%, #111827 100%);
  --gradient-card: linear-gradient(135deg, rgba(30, 41, 59, 0.5), rgba(17, 24, 39, 0.8));
  --gradient-hero: linear-gradient(135deg, rgba(59, 130, 246, 0.15), rgba(139, 92, 246, 0.1));

  /* Glass */
  --glass-bg: rgba(17, 24, 39, 0.7);
  --glass-border: rgba(148, 163, 184, 0.1);
  --glass-blur: blur(20px);

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
  --shadow-glow-blue: 0 0 20px rgba(59, 130, 246, 0.3);
  --shadow-glow-green: 0 0 20px rgba(16, 185, 129, 0.3);
  --shadow-glow-red: 0 0 20px rgba(239, 68, 68, 0.3);

  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --space-3xl: 4rem;

  /* Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  /* Sidebar */
  --sidebar-width: 300px;
  --sidebar-collapsed: 0px;
  --topbar-height: 60px;

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
  --transition-slow: 400ms ease;
}

/* --- Reset & Base --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.7;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
  background: var(--border-light);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* --- Typography --- */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.3;
  color: var(--text-primary);
}

h1 { font-size: 2.5rem; letter-spacing: -0.02em; }
h2 { font-size: 1.875rem; letter-spacing: -0.01em; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }
h5 { font-size: 1.1rem; }

p {
  color: var(--text-secondary);
  margin-bottom: var(--space-md);
}

a {
  color: var(--accent-blue);
  text-decoration: none;
  transition: color var(--transition-fast);
}
a:hover {
  color: var(--accent-purple);
}

strong {
  color: var(--text-primary);
  font-weight: 600;
}

code {
  font-family: var(--font-mono);
  background: var(--bg-elevated);
  padding: 0.15em 0.4em;
  border-radius: var(--radius-sm);
  font-size: 0.9em;
  color: var(--accent-gold);
}

/* --- Layout --- */
.app-container {
  display: flex;
  min-height: 100vh;
}

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

.sidebar-header {
  padding: var(--space-lg) var(--space-xl);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.sidebar-logo {
  width: 36px;
  height: 36px;
  background: var(--gradient-blue);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar-logo svg {
  width: 20px;
  height: 20px;
  color: white;
}

.sidebar-title {
  font-size: 1.1rem;
  font-weight: 700;
  background: var(--gradient-blue);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.sidebar-subtitle {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

/* Progress bar in sidebar */
.sidebar-progress {
  padding: var(--space-md) var(--space-xl);
  border-bottom: 1px solid var(--border-color);
}

.progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: var(--space-xs);
}

.progress-bar {
  width: 100%;
  height: 4px;
  background: var(--bg-elevated);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--gradient-blue);
  border-radius: var(--radius-full);
  transition: width var(--transition-slow);
  width: 0%;
}

/* Module nav list */
.module-nav {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-md) 0;
}

.module-nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-sm) var(--space-xl);
  cursor: pointer;
  transition: all var(--transition-fast);
  border-left: 3px solid transparent;
  position: relative;
}

.module-nav-item:hover {
  background: rgba(59, 130, 246, 0.05);
}

.module-nav-item.active {
  background: rgba(59, 130, 246, 0.1);
  border-left-color: var(--accent-blue);
}

.module-nav-item.completed .module-nav-number {
  background: var(--bull-green);
  color: white;
}

.module-nav-number {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  background: var(--bg-elevated);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  flex-shrink: 0;
  transition: all var(--transition-fast);
}

.module-nav-item.active .module-nav-number {
  background: var(--accent-blue);
  color: white;
}

.module-nav-text {
  font-size: 0.85rem;
  color: var(--text-secondary);
  transition: color var(--transition-fast);
  line-height: 1.3;
}

.module-nav-item.active .module-nav-text {
  color: var(--text-primary);
  font-weight: 500;
}

.module-nav-check {
  margin-left: auto;
  color: var(--bull-green);
  font-size: 0.85rem;
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.module-nav-item.completed .module-nav-check {
  opacity: 1;
}

/* --- Main Content --- */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-height: 100vh;
}

/* Top bar */
.topbar {
  height: var(--topbar-height);
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid var(--glass-border);
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-2xl);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.menu-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: var(--space-sm);
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.menu-toggle:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

.menu-toggle svg {
  width: 24px;
  height: 24px;
}

.topbar-breadcrumb {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.topbar-breadcrumb span {
  color: var(--text-primary);
  font-weight: 500;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
}

.topbar-stat {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 0.8rem;
  color: var(--text-muted);
}

.topbar-stat svg {
  width: 16px;
  height: 16px;
}

.topbar-stat .stat-value {
  color: var(--accent-gold);
  font-weight: 600;
  font-family: var(--font-mono);
}

/* --- Content Area --- */
.content-area {
  max-width: 900px;
  margin: 0 auto;
  padding: var(--space-2xl) var(--space-2xl) var(--space-3xl);
}

/* --- Hero Section (Landing) --- */
.hero {
  text-align: center;
  padding: var(--space-3xl) var(--space-xl);
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at 50% 50%, rgba(59, 130, 246, 0.08) 0%, transparent 50%);
  animation: heroGlow 8s ease-in-out infinite alternate;
}

@keyframes heroGlow {
  0% { transform: translate(0, 0); }
  100% { transform: translate(-5%, 5%); }
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  color: var(--accent-blue);
  margin-bottom: var(--space-xl);
  position: relative;
}

.hero-badge .pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--bull-green);
  animation: pulse 2s ease-in-out infinite;
}

.hero h1 {
  font-size: 3.5rem;
  margin-bottom: var(--space-lg);
  position: relative;
  line-height: 1.1;
}

.hero h1 .gradient-text {
  background: var(--gradient-blue);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-description {
  font-size: 1.15rem;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto var(--space-2xl);
  line-height: 1.7;
  position: relative;
}

.hero-actions {
  display: flex;
  gap: var(--space-md);
  justify-content: center;
  position: relative;
}

/* Hero SVG Illustration */
.hero-illustration {
  position: relative;
  width: 100%;
  max-width: 700px;
  margin: var(--space-2xl) auto 0;
  height: 300px;
}

/* --- Module Header --- */
.module-header {
  margin-bottom: var(--space-2xl);
  padding-bottom: var(--space-xl);
  border-bottom: 1px solid var(--border-color);
}

.module-label {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 0.8rem;
  color: var(--accent-blue);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: var(--space-md);
}

.module-label .module-icon {
  width: 20px;
  height: 20px;
}

.module-header h1 {
  margin-bottom: var(--space-md);
}

.module-header p {
  font-size: 1.1rem;
  max-width: 700px;
}

/* --- Section Styles --- */
.lesson-section {
  margin-bottom: var(--space-3xl);
}

.lesson-section h2 {
  margin-bottom: var(--space-lg);
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.lesson-section h2 .section-number {
  font-size: 0.85rem;
  color: var(--accent-blue);
  font-weight: 600;
  background: rgba(59, 130, 246, 0.1);
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-sm);
}

.lesson-section h3 {
  margin: var(--space-xl) 0 var(--space-md);
  color: var(--text-primary);
}

/* --- Key Concept Card --- */
.concept-card {
  background: var(--gradient-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  margin: var(--space-lg) 0;
  position: relative;
  overflow: hidden;
}

.concept-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--gradient-blue);
}

.concept-card h4 {
  margin-bottom: var(--space-md);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.concept-card h4 svg {
  width: 18px;
  height: 18px;
  color: var(--accent-blue);
}

/* --- Info/Tip/Warning Boxes --- */
.info-box {
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  margin: var(--space-lg) 0;
  display: flex;
  gap: var(--space-md);
  align-items: flex-start;
}

.info-box svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  margin-top: 2px;
}

.info-box.tip {
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.2);
}
.info-box.tip svg { color: var(--bull-green); }

.info-box.warning {
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.2);
}
.info-box.warning svg { color: var(--accent-gold); }

.info-box.danger {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.2);
}
.info-box.danger svg { color: var(--bear-red); }

.info-box.info {
  background: rgba(59, 130, 246, 0.08);
  border: 1px solid rgba(59, 130, 246, 0.2);
}
.info-box.info svg { color: var(--accent-blue); }

.info-box-content {
  flex: 1;
}

.info-box-content strong {
  display: block;
  margin-bottom: var(--space-xs);
  font-size: 0.9rem;
}

.info-box-content p {
  font-size: 0.9rem;
  margin-bottom: 0;
}

/* --- Tables --- */
.data-table {
  width: 100%;
  border-collapse: collapse;
  margin: var(--space-lg) 0;
  font-size: 0.9rem;
  display: block;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.data-table th {
  text-align: left;
  padding: var(--space-md);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border-color);
}

.data-table th:first-child {
  border-radius: var(--radius-md) 0 0 0;
}
.data-table th:last-child {
  border-radius: 0 var(--radius-md) 0 0;
}

.data-table td {
  padding: var(--space-md);
  border-bottom: 1px solid var(--border-color);
  color: var(--text-secondary);
}

.data-table tr:hover td {
  background: rgba(59, 130, 246, 0.03);
}

/* --- Lists --- */
.feature-list {
  list-style: none;
  margin: var(--space-md) 0;
}

.feature-list li {
  padding: var(--space-sm) 0;
  padding-left: var(--space-xl);
  position: relative;
  color: var(--text-secondary);
}

.feature-list li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.85em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-blue);
}

/* --- Diagram Container --- */
.diagram-container {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  margin: var(--space-xl) 0;
  text-align: center;
  overflow: hidden;
}

.diagram-container svg {
  max-width: 100%;
  height: auto;
}

.diagram-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: var(--space-md);
  font-style: italic;
}

/* --- Module Navigation Footer --- */
.module-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: var(--space-2xl);
  margin-top: var(--space-3xl);
  border-top: 1px solid var(--border-color);
  gap: var(--space-md);
}

.module-footer-btn {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-lg);
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  font-size: 0.9rem;
  font-family: var(--font-sans);
}

.module-footer-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--accent-blue);
}

.module-footer-btn.primary {
  background: var(--accent-blue);
  border-color: var(--accent-blue);
  color: white;
}

.module-footer-btn.primary:hover {
  background: var(--accent-blue-dim);
  box-shadow: var(--shadow-glow-blue);
}

.module-footer-btn svg {
  width: 16px;
  height: 16px;
}

.complete-btn {
  background: var(--bull-green);
  border-color: var(--bull-green);
  color: white;
}

.complete-btn:hover {
  box-shadow: var(--shadow-glow-green);
}

.complete-btn.completed {
  background: var(--bg-elevated);
  border-color: var(--bull-green);
  color: var(--bull-green);
}

/* --- Module Grid (Landing) --- */
.module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-lg);
  margin-top: var(--space-2xl);
}

.module-card {
  background: var(--gradient-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  cursor: pointer;
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
}

.module-card:hover {
  border-color: var(--accent-blue);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.module-card-number {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: var(--space-md);
}

.module-card-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-md);
}

.module-card-icon svg {
  width: 28px;
  height: 28px;
}

.module-card h3 {
  font-size: 1.1rem;
  margin-bottom: var(--space-sm);
}

.module-card p {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: var(--space-md);
}

.module-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

.module-card-status.completed {
  color: var(--bull-green);
}

.module-card-arrow {
  width: 24px;
  height: 24px;
  color: var(--text-muted);
  transition: all var(--transition-fast);
}

.module-card:hover .module-card-arrow {
  color: var(--accent-blue);
  transform: translateX(4px);
}

/* --- Overlay for mobile sidebar --- */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 90;
}

.sidebar-overlay.active {
  display: block;
}

/* --- Responsive --- */
@media (max-width: 1024px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0;
  }

  .menu-toggle {
    display: flex;
  }

  .hero h1 {
    font-size: 2.5rem;
  }
}

@media (max-width: 768px) {
  .content-area {
    padding: var(--space-lg);
  }

  .hero {
    padding: var(--space-xl) var(--space-md);
  }

  .hero h1 {
    font-size: 2rem;
  }

  .hero-description {
    font-size: 1rem;
  }

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

  .module-grid {
    grid-template-columns: 1fr;
  }

  h1 { font-size: 1.8rem; }
  h2 { font-size: 1.4rem; }
  h3 { font-size: 1.2rem; }

  .module-footer {
    flex-direction: column;
  }

  .topbar-right {
    display: none;
  }

  .data-table {
    font-size: 0.8rem;
  }

  .data-table th,
  .data-table td {
    padding: var(--space-sm);
  }

  .module-footer-btn {
    width: 100%;
    justify-content: center;
    min-height: 44px;
  }

  .feature-list li {
    padding-left: var(--space-lg);
  }

  .topbar {
    padding: 0 var(--space-md);
  }

  .concept-card {
    padding: var(--space-lg);
  }

  .info-box {
    padding: var(--space-md);
  }

  .diagram-container {
    padding: var(--space-md);
  }
}

@media (max-width: 480px) {
  .content-area {
    padding: var(--space-md);
  }

  h1 { font-size: 1.5rem; }
  h2 { font-size: 1.25rem; }
  h3 { font-size: 1.1rem; }
  h4 { font-size: 1rem; }

  .hero h1 {
    font-size: 1.6rem;
  }

  .hero-description {
    font-size: 0.9rem;
  }

  .hero-badge {
    font-size: 0.7rem;
  }

  .module-footer-btn {
    font-size: 0.85rem;
    padding: var(--space-md);
    min-height: 44px;
  }

  .feature-list li {
    padding-left: var(--space-md);
    font-size: 0.85rem;
  }

  .data-table th,
  .data-table td {
    padding: var(--space-xs) var(--space-sm);
    font-size: 0.75rem;
  }

  .concept-card {
    padding: var(--space-md);
  }

  .info-box {
    flex-direction: column;
    padding: var(--space-md);
  }

  .topbar {
    padding: 0 var(--space-sm);
    height: 50px;
  }

  .topbar-breadcrumb {
    font-size: 0.75rem;
  }

  .module-header p {
    font-size: 0.95rem;
  }

  .lesson-section h2 {
    flex-wrap: wrap;
  }
}
