:root {
  /* COLORS */
  --bg-app: #f8fafc;
  --bg-sidebar: #ffffff;
  --bg-header: #ffffff;
  
  --primary: #008080;       /* Updated to a Teal/Greenish tone matching logo */
  --primary-hover: #006666;
  --primary-light: #e6f2f2;
  
  --text-main: #0f172a;
  --text-body: #334155;
  --text-muted: #64748b;
  
  --border: #e2e8f0;
  --success: #10b981;
  --accent: #f59e0b;        /* Gold accent from logo */
  
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  
  --font-ui: 'Inter', system-ui, sans-serif;
  --font-read: 'Merriweather', Georgia, serif;
  --font-code: 'JetBrains Mono', monospace;
  
  --header-height: 64px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
  margin: 0;
  height: 100vh;
  font-family: var(--font-ui);
  background: var(--bg-app);
  color: var(--text-main);
  overflow: hidden;
}

.app-container {
  display: flex;
  height: 100%;
  width: 100%;
}

/* --- SIDEBAR --- */
.sidebar {
  width: 280px;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  z-index: 50;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-header {
  height: var(--header-height);
  padding: 0 20px;
  display: flex; align-items: center;
  border-bottom: 1px solid var(--border);
}
.logo-area { display: flex; align-items: center; gap: 12px; }

/* BRAND LOGO STYLES */
.brand-logo {
  width: 40px; height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border);
}
.brand-logo-sm {
  width: 28px; height: 28px;
  border-radius: 50%;
  object-fit: cover;
}

.logo-text { line-height: 1.2; display: flex; flex-direction: column; }
.logo-title { font-weight: 800; font-size: 16px; color: var(--text-main); letter-spacing: -0.02em; }
.logo-subtitle { font-size: 11px; color: var(--text-muted); font-weight: 500; }

.sidebar-search { padding: 16px; }
.search-input-wrapper { position: relative; }
.search-icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--text-muted); pointer-events: none; }
.search-input-wrapper input {
  width: 100%;
  padding: 10px 10px 10px 34px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f8fafc;
  font-size: 14px;
  outline: none;
  font-family: inherit;
  transition: 0.2s;
}
.search-input-wrapper input:focus { background: white; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }

.curriculum-tree { flex: 1; overflow-y: auto; padding: 0 12px 20px; }

.nav-module { margin-bottom: 24px; }
.nav-module-title {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  color: var(--text-muted); margin: 0 0 8px 8px; letter-spacing: 0.05em;
}

.nav-item {
  display: flex; align-items: center;
  padding: 10px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px; color: var(--text-body);
  transition: background 0.15s;
  min-height: 40px;
}
.nav-item:hover { background: #f1f5f9; }
.nav-item.active { background: var(--primary-light); color: var(--primary); font-weight: 600; }
.nav-status { margin-left: auto; color: var(--success); display: none; }
.nav-item.completed .nav-status { display: block; }

.sidebar-footer { padding: 16px; border-top: 1px solid var(--border); background: #f8fafc; }
.progress-label { display: flex; justify-content: space-between; font-size: 12px; font-weight: 600; margin-bottom: 8px; }
.progress-bar-bg { height: 6px; background: var(--border); border-radius: 10px; overflow: hidden; }
.progress-bar-fill { height: 100%; background: var(--success); width: 0%; transition: width 0.3s; }

/* --- MAIN CONTENT --- */
.main-content {
  flex: 1;
  display: flex; flex-direction: column;
  position: relative;
  overflow: hidden;
  width: 100%;
}

/* TOP HEADER */
.top-header {
  height: var(--header-height);
  background: var(--bg-header);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px;
  flex-shrink: 0;
  z-index: 40;
}
.header-left { display: flex; align-items: center; gap: 16px; }
.page-title { margin: 0; font-size: 18px; font-weight: 700; color: var(--text-main); }
.mobile-brand { display: flex; align-items: center; gap: 10px; }

.mobile-only { display: none; }
.desktop-only { display: block; }

.header-right { display: flex; align-items: center; gap: 20px; }
.header-link { background: none; border: none; font-size: 14px; color: var(--text-muted); cursor: pointer; font-weight: 500; }
.header-link:hover { color: var(--primary); }
.user-avatar {
  width: 32px; height: 32px; background: var(--primary-light); color: var(--primary);
  border-radius: 50%; font-size: 12px; font-weight: 700;
  display: grid; place-items: center; border: 1px solid rgba(0,0,0,0.05);
}

/* SCROLL CONTAINER */
.scroll-container {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex; flex-direction: column;
}

.content-wrapper {
  flex: 1; /* Pushes footer down */
  max-width: 1000px;
  margin: 0 auto;
  padding: 32px;
  width: 100%;
}

/* UTILITY */
.view-section[hidden] { display: none !important; }
.view-section { animation: fadeIn 0.3s ease-out; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* DASHBOARD */
.hero-banner {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  color: white; border-radius: 16px; padding: 40px; margin-bottom: 40px; position: relative; overflow: hidden;
}
.hero-content { position: relative; z-index: 2; }
.badge-pill {
  display: inline-block; padding: 4px 10px;
  background: rgba(255,255,255,0.15); border-radius: 20px;
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em;
  margin-bottom: 16px;
}
.hero-banner h1 { margin: 0 0 12px; font-size: clamp(24px, 5vw, 36px); line-height: 1.2; font-weight: 800; }
.hero-banner p { color: #cbd5e1; font-size: clamp(15px, 3vw, 17px); margin-bottom: 24px; max-width: 600px; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.hero-decoration { position: absolute; right: 0; top: 0; bottom: 0; width: 40%; pointer-events: none; opacity: 0.1; }
.geo-shape { position: absolute; background: white; }
.circle { width: 300px; height: 300px; border-radius: 50%; top: -50px; right: -50px; opacity: 0.1; }
.square { width: 150px; height: 150px; bottom: 40px; right: 100px; transform: rotate(45deg); opacity: 0.05; }

.btn { padding: 10px 20px; border-radius: 8px; font-weight: 600; font-size: 14px; cursor: pointer; border: none; transition: 0.2s; display: inline-flex; align-items: center; justify-content: center; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:active { transform: scale(0.98); }
.btn-outline { background: transparent; border: 1px solid rgba(255,255,255,0.4); color: white; }
.btn-secondary { background: white; border: 1px solid var(--border); color: var(--text-body); }
.btn-secondary:hover { border-color: var(--text-muted); color: var(--text-main); }
.btn-secondary:disabled { opacity: 0.5; cursor: not-allowed; }

/* MODULES GRID */
.dashboard-grid-header { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 20px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.dashboard-grid-header h2 { font-size: 20px; margin: 0; font-weight: 700; }
.meta-text { font-size: 13px; color: var(--text-muted); }

.modules-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; }
.module-card {
  background: white; border: 1px solid var(--border); border-radius: 12px; padding: 20px; cursor: pointer; transition: 0.2s; display: flex; flex-direction: column;
}
.module-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); border-color: var(--primary); }
.module-num { font-size: 11px; font-weight: 800; color: var(--primary); text-transform: uppercase; display: block; margin-bottom: 8px; }
.module-card h3 { font-size: 17px; margin: 0 0 8px; line-height: 1.4; color: var(--text-main); font-weight: 700; }
.module-progress-wrapper { margin-top: auto; padding-top: 16px; }
.progress-mini-track { height: 4px; background: #f1f5f9; border-radius: 4px; overflow: hidden; }
.progress-mini-fill { height: 100%; background: var(--success); width: 0%; }

/* LESSON READER */
.lesson-breadcrumbs { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; font-size: 13px; color: var(--text-muted); margin-bottom: 24px; }
.btn-text { background: none; border: none; padding: 0; color: var(--text-muted); font-weight: 600; cursor: pointer; display: flex; align-items: center; gap: 6px; }
.btn-text:hover { color: var(--primary); }
.crumb-separator { color: var(--border); }
.crumb-item.active { color: var(--text-main); font-weight: 600; }

.lesson-paper { background: white; border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-sm); overflow: hidden; }
.lesson-header { padding: 32px 32px 20px; border-bottom: 1px solid #f1f5f9; }
.lesson-meta-top { display: flex; justify-content: space-between; margin-bottom: 12px; font-size: 12px; }
.topic-badge { background: var(--primary-light); color: var(--primary); padding: 2px 8px; border-radius: 4px; font-weight: 700; text-transform: uppercase; }
.lesson-header h1 { font-size: clamp(22px, 4vw, 30px); margin: 0; line-height: 1.3; font-weight: 800; }

.lesson-body { padding: 32px; min-height: 300px; }
.typography { font-family: var(--font-read); font-size: 17px; line-height: 1.8; color: var(--text-body); }
.typography h2 { font-family: var(--font-ui); font-size: 20px; color: var(--text-main); margin-top: 32px; margin-bottom: 16px; border-bottom: 2px solid #f1f5f9; padding-bottom: 6px; font-weight: 700; }
.typography p { margin-bottom: 20px; }
.typography ul { padding-left: 20px; margin-bottom: 24px; }
.typography li { margin-bottom: 8px; }
.typography code { font-family: var(--font-code); font-size: 0.9em; background: #f1f5f9; padding: 2px 5px; border-radius: 4px; color: var(--primary); }
.typography strong { color: var(--text-main); font-weight: 700; }

.callout { padding: 20px; margin: 24px 0; border-radius: 8px; border-left: 4px solid; font-family: var(--font-ui); font-size: 15px; }
.callout.concept { background: #f0f9ff; border-color: var(--accent); }
.callout.concept h4 { color: #b45309; margin: 0 0 8px; font-size: 12px; text-transform: uppercase; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.callout.example { background: #f0fdf4; border-color: var(--success); }
.callout.example h4 { color: #15803d; margin: 0 0 8px; font-size: 12px; text-transform: uppercase; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.code-wrapper { background: #1e293b; color: #f8fafc; padding: 16px; border-radius: 8px; overflow-x: auto; font-family: var(--font-code); font-size: 13px; margin: 24px 0; }

.lesson-footer { padding: 16px 24px; background: #fafafa; border-top: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; position: sticky; bottom: 0; }

/* SITE FOOTER & SOCIALS */
.site-footer {
  background: white; border-top: 1px solid var(--border); padding: 40px 32px;
  margin-top: auto;
}
.footer-content {
  max-width: 1000px; margin: 0 auto;
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 32px;
}
.footer-brand-col { max-width: 300px; }
.footer-logo-row { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.footer-brand-name { font-weight: 800; font-size: 16px; color: var(--text-main); }
.footer-desc { font-size: 14px; color: var(--text-muted); line-height: 1.5; margin-bottom: 16px; }
.footer-copy { font-size: 13px; color: var(--text-muted); opacity: 0.8; }

.footer-social-col { display: flex; flex-direction: column; gap: 12px; }
.footer-heading { font-size: 12px; text-transform: uppercase; font-weight: 700; color: var(--text-muted); letter-spacing: 0.05em; }
.social-links { display: flex; gap: 12px; }
.social-btn {
  display: grid; place-items: center; width: 40px; height: 40px;
  background: #f1f5f9; color: var(--text-body); border-radius: 8px;
  transition: all 0.2s ease;
}
.social-btn:hover { background: var(--primary); color: white; transform: translateY(-3px); }


/* MODALS */
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 40; opacity: 0; pointer-events: none; transition: opacity 0.3s; }
.overlay.active { opacity: 1; pointer-events: auto; }
.modal-backdrop { display: none; position: fixed; inset: 0; z-index: 100; background: rgba(15,23,42,0.8); backdrop-filter: blur(4px); align-items: center; justify-content: center; padding: 20px; }
.modal-backdrop.active { display: flex; }
.modal-content { background: white; width: 100%; max-width: 400px; border-radius: 16px; padding: 32px; text-align: center; box-shadow: var(--shadow-lg); animation: popUp 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); }
@keyframes popUp { from { transform: scale(0.9); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal-icon-wrapper { width: 56px; height: 56px; background: #dcfce7; color: #15803d; border-radius: 50%; display: grid; place-items: center; margin: 0 auto 16px; }
.modal-actions { display: flex; gap: 12px; justify-content: center; margin-top: 24px; }
.modal-actions .btn { flex: 1; }

/* RESPONSIVE */
@media (max-width: 900px) {
  .app-container { flex-direction: column; }
  .sidebar { position: fixed; top: 0; left: 0; bottom: 0; width: 85%; max-width: 320px; transform: translateX(-100%); border-right: none; box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: translateX(0); }
  
  .mobile-only { display: flex; }
  .desktop-only { display: none; }  
  
  .top-header { padding: 0 16px; }
  .content-wrapper { padding: 20px 16px; }
  .site-footer { padding: 32px 20px; }
  .footer-content { flex-direction: column; gap: 32px; }
  
  .hero-banner { padding: 24px; text-align: center; }
  .hero-actions { justify-content: center; }
  .hero-decoration { display: none; }
  .lesson-header, .lesson-body { padding: 20px; }
}
@media (max-width: 480px) {
  .modules-grid { grid-template-columns: 1fr; }
  .modal-actions, .lesson-footer { flex-direction: column; gap: 12px; }
  .lesson-footer .btn { width: 100%; }
}
