/* ============================================================
    COPRLEARN - NEW DESIGN SYSTEM (LUNAR-STUDIOS)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&family=Inter:wght@300;400;500;600&display=swap');

:root {
  /* Colors - Premium Tech (Platzi Inspired) */
  --primary:     #98ca3f; /* Lunar Green */
  --primary-hover:#b4dc5f;
  --primary-dark: #7aa332;
  
  --secondary:   #121f3d; /* Navy Dark */
  --accent:      #20c997; /* Teal */
  
  /* Surface Colors */
  --bg-dark:     #0c162d;
  --bg-surface:  #121f3d;
  --bg-light:    #1e2d4d;
  
  --text-main:   #ffffff;
  --text-muted:  #94a3b8;
  --text-dim:    #64748b;

  /* Status Colors */
  --success:     #22c55e;
  --warning:     #eab308;
  --error:       #ef4444;
  --info:        #3b82f6;

  /* Borders & Shadows */
  --border:      rgba(255, 255, 255, 0.08);
  --border-glow: rgba(152, 202, 63, 0.2);
  --shadow-sm:   0 1px 2px rgba(0, 0, 0, 0.5);
  --shadow-md:   0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg:   0 10px 30px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 20px rgba(152, 202, 63, 0.15);

  /* Radius */
  --radius-sm:   8px;
  --radius-md:   12px;
  --radius-lg:   20px;
  --radius-full: 9999px;

  /* Typography */
  --font:        'Outfit', 'Inter', system-ui, -apple-system, sans-serif;
}

/* ── DARK MODE ── */
/* ── BASE STYLES ── */
body.new-template {
  font-family: var(--font);
  background: var(--bg-dark);
  color: var(--text-main);
  font-size: 16px;
  line-height: 1.6;
  min-height: 100vh;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.new-template *, .new-template *::before, .new-template *::after { box-sizing: border-box; }

a { color: var(--primary); text-decoration: none; transition: 0.2s; }
a:hover { color: var(--primary-hover); }

/* ── TOP BAR ── */
.topbar {
  background: rgba(18, 31, 61, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 1000;
  padding: 0 2.5rem;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.logo-icon {
  width: 36px;
  height: 36px;
  background: var(--primary);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-glow);
}

.logo-icon svg { width: 22px; height: 22px; stroke: var(--secondary); }

.logo-text {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.02em;
}

.logo-sep {
  width: 1px;
  height: 20px;
  background: var(--border);
  margin: 0 4px;
}

.logo-sub {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 400;
}

.topbar-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar-nav a {
  text-decoration: none;
  font-size: 14px;
  color: var(--text-muted);
  padding: 8px 16px;
  border-radius: var(--radius-full);
  transition: all 0.3s ease;
  font-weight: 500;
}

.topbar-nav a:hover { background: var(--bg-light); color: var(--text-main); }
.topbar-nav a.active { background: var(--primary); color: var(--secondary); }

.topbar-right {
  display: flex;
  align-items: center;
  gap: 15px;
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary);
  color: var(--secondary);
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: 2px solid var(--border);
  transition: transform 0.2s;
}

.avatar:hover { transform: scale(1.05); }

.topbar-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.topbar-nav a {
  text-decoration: none;
  font-size: 13px;
  color: var(--gray-600);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  transition: background 0.15s, color 0.15s;
  font-weight: 400;
}

.topbar-nav a:hover { background: var(--gray-100); color: var(--gray-900); }
.topbar-nav a.active { background: var(--blue-light); color: var(--blue); font-weight: 500; }

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--blue);
  color: white;
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

/* ── HERO ── */
.hero {
  background: linear-gradient(135deg, rgba(12, 22, 45, 0.9) 0%, rgba(18, 31, 61, 0.8) 100%), url('hero-bg.png');
  background-size: cover;
  background-position: center;
  padding: 5rem 2.5rem;
  position: relative;
  overflow: hidden;
}

.hero::after {
  content: '';
  position: absolute;
  top: -50%;
  right: -10%;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, var(--border-glow) 0%, transparent 70%);
  z-index: 0;
  pointer-events: none;
}

.hero-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 400px;
  gap: 4rem;
  align-items: center;
  position: relative;
  z-index: 1;
}

.hero-greeting {
  font-size: 14px;
  font-weight: 600;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  margin-bottom: 12px;
}

.hero-title {
  font-size: 42px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 16px;
  line-height: 1.1;
  letter-spacing: -0.03em;
}

.hero-desc {
  font-size: 18px;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 2.5rem;
  max-width: 540px;
}

.hero-stats {
  display: flex;
  gap: 3rem;
}

.stat-item { text-align: left; }
.stat-number { font-size: 32px; font-weight: 700; color: var(--text-main); line-height: 1; margin-bottom: 4px; }
.stat-label { font-size: 12px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.1em; }

.hero-card {
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-lg);
}

.hero-card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 1.5rem;
}

.prog-item { margin-bottom: 20px; }
.prog-item:last-child { margin-bottom: 0; }
.prog-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.prog-name { font-size: 15px; color: var(--text-main); font-weight: 500; }
.prog-pct { font-size: 14px; color: var(--primary); font-weight: 600; }
.prog-track { height: 8px; background: var(--bg-light); border-radius: 4px; overflow: hidden; }
.prog-fill { height: 100%; border-radius: 4px; background: var(--primary); box-shadow: var(--shadow-glow); transition: width 1s cubic-bezier(0.4, 0, 0.2, 1); }

/* ── MAIN LAYOUT ── */
.main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 3rem 2.5rem;
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 2.5rem;
  align-items: start;
}

.main-col { display: flex; flex-direction: column; gap: 2rem; }

/* ── SEARCH ── */
.search-wrap {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow-md);
  transition: border-color 0.3s, box-shadow 0.3s;
}

.search-wrap:focus-within {
  border-color: var(--primary);
  box-shadow: var(--shadow-glow);
}

.search-wrap svg { flex-shrink: 0; color: var(--text-dim); }

.search-wrap input {
  border: none;
  background: transparent;
  font-size: 16px;
  color: var(--text-main);
  flex: 1;
  outline: none;
  font-family: var(--font);
}

.search-wrap input::placeholder { color: var(--text-dim); }

.search-tag {
  font-size: 12px;
  padding: 5px 12px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  color: var(--text-muted);
  background: var(--bg-light);
  cursor: pointer;
  transition: all 0.2s;
  font-weight: 500;
}

.search-tag:hover { background: var(--primary); color: var(--secondary); border-color: var(--primary); }

/* ── SECTION BLOCK ── */
.block {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.block-head {
  padding: 1.5rem 1.75rem 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.block-title { font-size: 18px; font-weight: 600; color: var(--text-main); }
.block-link { font-size: 14px; color: var(--primary); font-weight: 500; }
.block-link:hover { color: var(--primary-hover); }

/* ── MODULE GRID ── */
.modules-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
}

.mod-cell {
  padding: 1.5rem;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  display: flex;
  flex-direction: column;
}

.mod-cell:hover { background: var(--bg-light); }
.mod-cell:nth-child(3n) { border-right: none; }

.mod-icon-wrap {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  margin-bottom: 12px;
  background: var(--bg-light);
}

.mod-name { font-size: 15px; font-weight: 600; color: var(--text-main); margin-bottom: 4px; }
.mod-meta { font-size: 13px; color: var(--text-dim); margin-bottom: 12px; }
.mod-bar { height: 4px; background: var(--bg-dark); border-radius: 2px; overflow: hidden; }
.mod-bar-fill { height: 100%; border-radius: 2px; background: var(--primary); }

/* ── COURSES ── */
.course-item {
  padding: 1.25rem 1.75rem;
  border-bottom: 1px solid var(--border);
  display: grid;
  grid-template-columns: 44px 1fr auto;
  gap: 16px;
  align-items: center;
  cursor: pointer;
  transition: background 0.2s;
}

.course-item:last-child { border-bottom: none; }
.course-item:hover { background: var(--bg-light); }

.course-num {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: var(--bg-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: var(--primary);
  flex-shrink: 0;
}

.course-name { font-size: 15px; font-weight: 600; color: var(--text-main); margin-bottom: 4px; }
.course-meta { font-size: 13px; color: var(--text-dim); }

/* ── BADGES ── */
.badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-blue   { background: rgba(59, 130, 246, 0.1); color: #60a5fa; }
.badge-green  { background: rgba(34, 197, 94, 0.1);  color: #4ade80; }
.badge-primary{ background: var(--border-glow);      color: var(--primary); }
.badge-gray   { background: var(--bg-light);         color: var(--text-muted); }

/* ── ALERT BLOCKS ── */
.alert-block {
  padding: 1.25rem 2rem;
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 500;
  margin-bottom: 2rem;
  display: flex;
  align-items: center;
  gap: 15px;
  border: 1px solid transparent;
  animation: fadeInDown 0.4s ease;
}

.alert-block-success { background: rgba(34, 197, 94, 0.1); color: #4ade80; border-color: rgba(34, 197, 94, 0.2); }
.alert-block-error   { background: rgba(239, 68, 68, 0.1); color: #f87171; border-color: rgba(239, 68, 68, 0.2); }
.alert-block-info    { background: rgba(59, 130, 246, 0.1); color: #60a5fa; border-color: rgba(59, 130, 246, 0.2); }

/* ── SIDEBAR ── */
.sidebar { display: flex; flex-direction: column; gap: 1.5rem; }

.side-block {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.side-head {
  padding: 1.25rem 1.5rem 1rem;
  border-bottom: 1px solid var(--border);
  font-size: 15px;
  font-weight: 600;
  color: var(--text-main);
}

/* ── ACTIVITY ── */
.act-item {
  padding: 1rem 1.5rem;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  border-bottom: 1px solid var(--border);
}

.act-item:last-child { border-bottom: none; }

.act-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: 6px;
  flex-shrink: 0;
  box-shadow: 0 0 8px currentColor;
}

.act-text { font-size: 13px; color: var(--text-main); line-height: 1.5; margin-bottom: 4px; }
.act-time { font-size: 12px; color: var(--text-dim); }

/* ── LEVEL CARD ── */
.level-card {
  margin: 1.25rem;
  background: var(--bg-light);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  border: 1px solid var(--border);
}

.level-title { font-size: 14px; font-weight: 700; color: var(--primary); margin-bottom: 6px; }
.level-desc  { font-size: 13px; color: var(--text-muted); line-height: 1.5; margin-bottom: 15px; }

.level-btn {
  display: inline-block;
  background: var(--primary);
  color: var(--secondary);
  font-size: 13px;
  font-weight: 700;
  padding: 10px 20px;
  border-radius: var(--radius-full);
  text-decoration: none;
  cursor: pointer;
  border: none;
  font-family: var(--font);
  transition: all 0.2s;
  width: 100%;
  text-align: center;
}

.level-btn:hover { background: var(--primary-hover); transform: translateY(-1px); }

/* ── FOOTER ── */
.footer {
  background: var(--bg-surface);
  padding: 3rem 2.5rem;
  text-align: center;
  font-size: 14px;
  color: var(--text-dim);
  border-top: 1px solid var(--border);
}

.footer a { color: var(--primary); font-weight: 500; }

/* ── CUSTOM MODAL ── */
.custom-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.custom-modal-overlay.active { opacity: 1; visibility: visible; }

.custom-modal {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 480px;
  padding: 3rem;
  box-shadow: var(--shadow-lg);
  transform: translateY(30px);
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  text-align: center;
  border: 1px solid var(--border);
}

.custom-modal-overlay.active .custom-modal { transform: translateY(0); }

.custom-modal-icon {
  width: 80px;
  height: 80px;
  background: var(--border-glow);
  color: var(--primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 2rem;
  font-size: 40px;
}

.custom-modal-title { font-size: 24px; font-weight: 700; color: var(--text-main); margin-bottom: 1rem; }
.custom-modal-text { font-size: 16px; color: var(--text-muted); line-height: 1.6; margin-bottom: 2.5rem; }

.modal-btn {
  flex: 1;
  padding: 14px;
  border-radius: var(--radius-full);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  border: none;
  font-family: var(--font);
  transition: all 0.2s;
}

.modal-btn-cancel { background: var(--bg-light); color: var(--text-main); }
.modal-btn-cancel:hover { background: var(--border); }
.modal-btn-confirm { background: var(--primary); color: var(--secondary); box-shadow: var(--shadow-glow); }
.modal-btn-confirm:hover { background: var(--primary-hover); }

/* ── VIEWPORT / VIDEO PLAYER ── */
.viewer-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem;
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 2rem;
}

.video-section { display: flex; flex-direction: column; gap: 1.5rem; }

.video-wrapper {
  background: #000;
  border-radius: var(--radius-lg);
  aspect-ratio: 16 / 9;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  position: relative;
  border: 1px solid var(--border);
}

.video-wrapper iframe, .video-wrapper video {
  width: 100%;
  height: 100%;
  border: none;
}

.lesson-info {
  background: var(--bg-surface);
  padding: 2rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}

.lesson-title { font-size: 24px; font-weight: 700; color: var(--text-main); margin-bottom: 0.5rem; }
.lesson-meta { font-size: 14px; color: var(--text-dim); margin-bottom: 1.5rem; }

.material-buttons {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.btn-material {
  background: var(--bg-light);
  color: var(--text-muted);
  border: 1px solid var(--border);
  padding: 8px 16px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s;
}

.btn-material:hover { background: var(--border); color: var(--text-main); border-color: var(--primary); }

.chapters-sidebar {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: fit-content;
  max-height: calc(100vh - 120px);
  position: sticky;
  top: 84px;
}

.chapters-head {
  padding: 1.5rem;
  border-bottom: 1px solid var(--border);
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
}

.chapters-list {
  overflow-y: auto;
  flex: 1;
}

.chapter-item {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 12px;
  transition: background 0.2s;
  cursor: pointer;
}

.chapter-item:hover { background: var(--bg-light); }
.chapter-item.active { background: var(--border-glow); border-left: 3px solid var(--primary); }

.chapter-num { font-size: 12px; font-weight: 700; color: var(--primary); opacity: 0.6; min-width: 20px; }
.chapter-name { font-size: 14px; color: var(--text-main); font-weight: 500; line-height: 1.4; }
.chapter-time { font-size: 12px; color: var(--text-dim); margin-top: 4px; }

/* ── EVENTS GRID ── */
.events-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}

.event-card {
  background: var(--bg-surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  overflow: hidden;
  transition: transform 0.3s;
}

.event-card:hover { transform: translateY(-5px); border-color: var(--primary); }

.event-img {
  height: 140px;
  background: var(--bg-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
}

.event-body { padding: 1.25rem; }
.event-date { font-size: 11px; font-weight: 700; color: var(--primary); text-transform: uppercase; margin-bottom: 6px; }
.event-title { font-size: 15px; font-weight: 600; color: var(--text-main); margin-bottom: 8px; }
.event-desc { font-size: 13px; color: var(--text-dim); line-height: 1.5; }

/* ── RESPONSIVE ── */
@media (max-width: 1024px) {
  .viewer-container { grid-template-columns: 1fr; }
  .chapters-sidebar { position: static; max-height: none; }
  .hero-inner { grid-template-columns: 1fr; gap: 3rem; text-align: center; }
  .hero-desc { margin: 0 auto 2.5rem; }
  .hero-stats { justify-content: center; }
  .main { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .topbar { padding: 0 1.5rem; }
  .topbar-nav { display: none; }
  .modules-grid { grid-template-columns: 1fr 1fr; }
  .hero-title { font-size: 32px; }
}

@media (max-width: 480px) {
  .modules-grid { grid-template-columns: 1fr; }
}
