/* ==========================================================================
   C-FAP Study Material Platform - Modern Clean Design System
   Industry-Grade Financial Accounting & TallyPrime Learning Portal
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  /* Core Brand Colors - Modern Corporate Slate & Electric Blue */
  --primary: #0f2744;
  --primary-light: #2563eb;
  --primary-dark: #091a2f;
  --primary-hover: #1d4ed8;
  --primary-subtle: rgba(37, 99, 235, 0.08);

  --secondary: #0284c7;
  --secondary-light: #38bdf8;
  --secondary-dark: #0369a1;

  --accent: #d97706;
  --accent-light: #f59e0b;

  --success: #10b981;
  --success-bg: #ecfdf5;
  --success-border: #a7f3d0;
  --success-text: #065f46;

  --warning: #f59e0b;
  --warning-bg: #fffbeb;
  --warning-border: #fde68a;
  --warning-text: #92400e;

  --danger: #ef4444;
  --danger-bg: #fef2f2;
  --danger-border: #fecaca;
  --danger-text: #991b1b;

  --info: #0284c7;
  --info-bg: #f0f9ff;
  --info-border: #bae6fd;
  --info-text: #075985;

  /* Surfaces & Clean Backgrounds (Light Mode) */
  --bg-main: #f8fafc;
  --bg-surface: #ffffff;
  --bg-surface-elevated: #ffffff;
  --bg-subtle: #f1f5f9;
  --bg-active: #e2e8f0;

  /* Typography Colors */
  --text-primary: #0f172a;
  --text-secondary: #334155;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --text-on-primary: #ffffff;

  /* Borders & Shadows */
  --border-color: #e2e8f0;
  --border-subtle: #cbd5e1;
  --shadow-xs: 0 1px 2px 0 rgba(15, 23, 42, 0.04);
  --shadow-sm: 0 1px 3px 0 rgba(15, 23, 42, 0.06), 0 1px 2px -1px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.07), 0 2px 4px -2px rgba(15, 23, 42, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.08), 0 4px 6px -4px rgba(15, 23, 42, 0.04);
  --shadow-xl: 0 20px 25px -5px rgba(15, 23, 42, 0.08), 0 8px 10px -6px rgba(15, 23, 42, 0.04);

  /* Dimensions & Spacing */
  --sidebar-width: 290px;
  --header-height: 64px;
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;
  --radius-full: 9999px;

  --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);

  /* Fonts */
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', Consolas, monospace;
}

/* Dark Theme Overrides */
[data-theme="dark"] {
  --primary: #1e3a8a;
  --primary-light: #3b82f6;
  --primary-dark: #09101f;
  --primary-hover: #2563eb;
  --primary-subtle: rgba(59, 130, 246, 0.15);

  --secondary: #38bdf8;
  --secondary-light: #7dd3fc;
  --secondary-dark: #0284c7;

  --bg-main: #0a0f1d;
  --bg-surface: #111827;
  --bg-surface-elevated: #1a2234;
  --bg-subtle: #182235;
  --bg-active: #22304d;

  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --text-light: #64748b;

  --border-color: #1f2a3f;
  --border-subtle: #2d3b55;

  --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.4);
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.5);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.6);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.7);

  --success-bg: rgba(16, 185, 129, 0.15);
  --success-border: rgba(16, 185, 129, 0.3);
  --success-text: #6ee7b7;

  --warning-bg: rgba(245, 158, 11, 0.15);
  --warning-border: rgba(245, 158, 11, 0.3);
  --warning-text: #fcd34d;

  --danger-bg: rgba(239, 68, 68, 0.15);
  --danger-border: rgba(239, 68, 68, 0.3);
  --danger-text: #fca5a5;

  --info-bg: rgba(2, 132, 199, 0.15);
  --info-border: rgba(2, 132, 199, 0.3);
  --info-text: #7dd3fc;
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  scroll-padding-top: 84px;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-main);
  color: var(--text-primary);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}

a {
  color: var(--primary-light);
  text-decoration: none;
  transition: color var(--transition-fast);
}

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

img {
  max-width: 100%;
  height: auto;
  display: block;
}

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

/* Global Top Navigation Bar */
.top-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: rgba(255, 255, 255, 0.88);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.75rem;
  z-index: 1000;
  box-shadow: var(--shadow-xs);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  transition: background var(--transition-normal);
}

[data-theme="dark"] .top-nav {
  background: rgba(17, 24, 39, 0.88);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--text-primary);
  text-decoration: none;
  letter-spacing: -0.01em;
}

.brand-badge {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: white;
  padding: 0.3rem 0.65rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  box-shadow: 0 2px 4px rgba(37, 99, 235, 0.2);
}

.brand-text {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.nav-search-btn {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 0.45rem 1rem;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all var(--transition-fast);
  min-width: 220px;
  justify-content: space-between;
}

.nav-search-btn:hover {
  border-color: var(--primary-light);
  color: var(--text-primary);
  background: var(--bg-surface);
  box-shadow: var(--shadow-sm);
}

.nav-search-btn kbd {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 0.15rem 0.4rem;
  font-size: 0.72rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

.icon-btn {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  font-size: 1rem;
}

.icon-btn:hover {
  background: var(--bg-active);
  color: var(--text-primary);
  border-color: var(--border-subtle);
}

/* Sidebar Styles */
.sidebar {
  position: fixed;
  top: var(--header-height);
  bottom: 0;
  left: 0;
  width: var(--sidebar-width);
  background: var(--bg-surface);
  border-right: 1px solid var(--border-color);
  overflow-y: auto;
  z-index: 900;
  display: flex;
  flex-direction: column;
  transition: transform var(--transition-normal);
}

.sidebar::-webkit-scrollbar {
  width: 5px;
}

.sidebar::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}

.sidebar-header {
  padding: 1.25rem 1.25rem 0.85rem;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-subtle);
}

.sidebar-progress-summary {
  background: var(--bg-surface);
  padding: 0.75rem 0.9rem;
  border-radius: var(--radius-md);
  margin-top: 0.5rem;
  border: 1px solid var(--border-color);
}

.sidebar-progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.4rem;
}

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

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary-light), var(--success));
  border-radius: var(--radius-full);
  transition: width 0.4s ease;
}

.sidebar-nav {
  padding: 1rem 0.75rem;
  flex: 1;
}

.nav-section-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: 0.65rem 0.75rem 0.35rem;
  margin-top: 0.6rem;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.75rem;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  transition: all var(--transition-fast);
  margin-bottom: 0.15rem;
}

.sidebar-link:hover {
  background: var(--bg-subtle);
  color: var(--primary-light);
}

.sidebar-link.active {
  background: var(--primary-subtle);
  color: var(--primary-light);
  font-weight: 600;
  border-left: 3px solid var(--primary-light);
}

.sidebar-link .day-tag {
  font-size: 0.7rem;
  font-family: var(--font-mono);
  background: var(--bg-subtle);
  color: var(--text-muted);
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
}

.sidebar-link.completed .day-tag {
  background: var(--success-bg);
  color: var(--success);
}

/* Module Accordion in Sidebar */
.module-accordion {
  margin-bottom: 0.35rem;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
}

.module-accordion-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0.55rem 0.75rem;
  background: none;
  border: none;
  font-family: inherit;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-primary);
  text-align: left;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: background var(--transition-fast);
}

.module-accordion-header:hover {
  background: var(--bg-subtle);
}

.module-accordion-content {
  display: none;
  padding-left: 0.5rem;
  margin-top: 0.15rem;
}

.module-accordion.open .module-accordion-content {
  display: block;
}

.module-accordion.open .accordion-icon {
  transform: rotate(90deg);
}

.accordion-icon {
  transition: transform var(--transition-fast);
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* Main Content Area */
.main-wrapper {
  margin-left: var(--sidebar-width);
  margin-top: var(--header-height);
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.content-container {
  max-width: 1040px;
  width: 100%;
  margin: 0 auto;
  padding: 2.5rem 2.25rem 5rem;
}

/* Breadcrumbs */
.breadcrumbs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-size: 0.84rem;
  color: var(--text-muted);
  margin-bottom: 1.75rem;
}

.breadcrumbs a {
  color: var(--text-secondary);
  font-weight: 500;
}

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

.breadcrumbs .separator {
  color: var(--text-light);
  font-size: 0.75rem;
}

.breadcrumbs .current {
  color: var(--text-primary);
  font-weight: 600;
}

/* Typography & Headings */
h1, h2, h3, h4, h5, h6 {
  color: var(--text-primary);
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.015em;
  margin-top: 2rem;
  margin-bottom: 1rem;
}

h1 { font-size: 2.2rem; letter-spacing: -0.025em; font-weight: 800; }
h2 { font-size: 1.55rem; padding-bottom: 0.45rem; border-bottom: 1px solid var(--border-color); }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.05rem; }

p {
  margin-bottom: 1rem;
  color: var(--text-secondary);
  font-size: 0.96rem;
  line-height: 1.7;
}

ul, ol {
  margin-bottom: 1.25rem;
  padding-left: 1.5rem;
  color: var(--text-secondary);
  font-size: 0.96rem;
}

li {
  margin-bottom: 0.45rem;
  line-height: 1.65;
}

/* Topic Meta Banner Header */
.topic-meta-banner {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--primary-light);
  border-radius: var(--radius-lg);
  padding: 1.75rem 2rem;
  margin-bottom: 2.25rem;
  box-shadow: var(--shadow-sm);
}

.meta-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: 1rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.7rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.badge-primary { background: var(--primary-subtle); color: var(--primary-light); border: 1px solid rgba(37, 99, 235, 0.2); }
.badge-secondary { background: rgba(2, 132, 199, 0.1); color: var(--secondary); border: 1px solid rgba(2, 132, 199, 0.2); }
.badge-success { background: var(--success-bg); color: var(--success-text); border: 1px solid var(--success-border); }
.badge-warning { background: var(--warning-bg); color: var(--warning-text); border: 1px solid var(--warning-border); }
.badge-danger { background: var(--danger-bg); color: var(--danger-text); border: 1px solid var(--danger-border); }
.badge-info { background: var(--info-bg); color: var(--info-text); border: 1px solid var(--info-border); }

/* Learning Objectives Card */
.objectives-card {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.5rem;
  margin-top: 1.25rem;
}

.objectives-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--text-primary);
  margin-bottom: 0.6rem;
}

.objectives-list {
  margin: 0;
  padding-left: 1.25rem;
  font-size: 0.9rem;
}

/* Callout Boxes (Important, Warning, Tip, Note) */
.callout {
  padding: 1.15rem 1.4rem;
  border-radius: var(--radius-md);
  margin: 1.75rem 0;
  border-left: 4px solid;
  background: var(--bg-surface);
  box-shadow: var(--shadow-xs);
}

.callout-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 0.95rem;
  margin-bottom: 0.4rem;
}

.callout-important {
  background: var(--danger-bg);
  border-color: var(--danger);
  color: var(--danger-text);
}

.callout-warning {
  background: var(--warning-bg);
  border-color: var(--warning);
  color: var(--warning-text);
}

.callout-tip {
  background: var(--success-bg);
  border-color: var(--success);
  color: var(--success-text);
}

.callout-note {
  background: var(--info-bg);
  border-color: var(--info);
  color: var(--info-text);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 1.35rem;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--transition-fast);
  text-decoration: none;
  box-shadow: var(--shadow-xs);
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, #1e3a8a 100%);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #173d66 0%, #2563eb 100%);
  color: white;
  box-shadow: var(--shadow-md);
}

.btn-secondary {
  background: var(--primary-light);
  color: white;
}

.btn-secondary:hover {
  background: var(--primary-hover);
  color: white;
  box-shadow: var(--shadow-md);
}

.btn-outline {
  background: var(--bg-surface);
  border-color: var(--border-color);
  color: var(--text-primary);
}

.btn-outline:hover {
  background: var(--bg-subtle);
  border-color: var(--border-subtle);
  color: var(--primary-light);
}

.btn-success {
  background: var(--success);
  color: white;
}

.btn-success:hover {
  background: #059669;
}

/* Topic Bottom Navigation */
.topic-bottom-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 3.5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border-color);
}

.btn-complete-topic {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-md);
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-complete-topic.completed {
  background: var(--success);
  color: white;
  border-color: var(--success);
}

/* Footer */
.site-footer {
  background: var(--bg-surface);
  border-top: 1px solid var(--border-color);
  padding: 2.5rem 1.5rem;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: auto;
}
