/* ══════════════════════════════════════════════════════════════
   YOURLEGACY ACADEMY — GROWTH LAB COMMUNITY PLATFORM
   Design System & Core Styles
   ══════════════════════════════════════════════════════════════ */

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

:root {
  /* ── IDENTIDAD ACADEMY — Emerald (YL-Tech=Blue, Studio=Purple, Academy=Emerald) ── */
  --accent: #10b981;
  --accent-hover: #059669;
  --accent-glow: rgba(16,185,129,0.25);
  --accent-soft: rgba(16,185,129,0.08);
  /* ── HERENCIA STITCH — Slate-950 depth ── */
  --bg-primary: #020617;
  --bg-secondary: #0f172a;
  --bg-tertiary: #1e293b;
  --bg-card: rgba(15,23,42,0.6);
  --bg-glass: rgba(15,23,42,0.85);
  --border: rgba(255,255,255,0.06);
  --border-hover: rgba(255,255,255,0.12);
  --text-primary: #f8fafc;
  --text-secondary: rgba(248,250,252,0.7);
  --text-muted: rgba(248,250,252,0.4);
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  /* ── HERENCIA YL-TECH (Brand Colors) ── */
  --brand-blue: #0d93f2;
  --brand-pink: #ec4899;
  --brand-teal: #14b8a6;
  /* ── GAMIFICACIÓN ── */
  --gold: #f59e0b;
  --silver: #94a3b8;
  --bronze: #d97706;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --sidebar-w: 260px;
  --topbar-h: 64px;
  --transition: all 0.2s cubic-bezier(0.4,0,0.2,1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-font-smoothing: antialiased; scroll-behavior: smooth; }
body { font-family: 'Inter', sans-serif; background: var(--bg-primary); color: var(--text-primary); min-height: 100vh; overflow-x: hidden; }
a { color: var(--accent); text-decoration: none; }
button { cursor: pointer; font-family: inherit; }
img { max-width: 100%; display: block; }

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg-tertiary); border-radius: 3px; }

/* ── MICRO-ANIMATIONS ── */
@keyframes fadeInUp { from { opacity:0; transform:translateY(16px); } to { opacity:1; transform:translateY(0); } }
@keyframes fadeIn { from { opacity:0; } to { opacity:1; } }
@keyframes slideInLeft { from { opacity:0; transform:translateX(-20px); } to { opacity:1; transform:translateX(0); } }
@keyframes shimmer { 0%{background-position:-200% 0} 100%{background-position:200% 0} }
@keyframes scaleIn { from { opacity:0; transform:scale(0.95); } to { opacity:1; transform:scale(1); } }

.content { animation: fadeIn 0.3s ease; }
.card, .module-card, .feed-post, .schedule-item, .resource-card, .student-row {
  animation: fadeInUp 0.4s ease backwards;
}
.grid-4 > :nth-child(1) { animation-delay: 0s; }
.grid-4 > :nth-child(2) { animation-delay: 0.05s; }
.grid-4 > :nth-child(3) { animation-delay: 0.1s; }
.grid-4 > :nth-child(4) { animation-delay: 0.15s; }
.grid-3 > :nth-child(1) { animation-delay: 0s; }
.grid-3 > :nth-child(2) { animation-delay: 0.06s; }
.grid-3 > :nth-child(3) { animation-delay: 0.12s; }
.grid-2 > :nth-child(1) { animation-delay: 0s; }
.grid-2 > :nth-child(2) { animation-delay: 0.06s; }
.sidebar-nav li { animation: slideInLeft 0.3s ease backwards; }
.sidebar-nav li:nth-child(1) { animation-delay: 0.05s; }
.sidebar-nav li:nth-child(2) { animation-delay: 0.1s; }
.sidebar-nav li:nth-child(3) { animation-delay: 0.15s; }
.sidebar-nav li:nth-child(4) { animation-delay: 0.2s; }

/* ── LOGIN PAGE ── */
.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at 30% 20%, rgba(168,85,247,0.08) 0%, transparent 50%),
              radial-gradient(ellipse at 70% 80%, rgba(59,130,246,0.06) 0%, transparent 50%),
              var(--bg-primary);
  padding: 20px; position: relative; overflow: hidden;
}
.login-bg-grid {
  position: absolute; inset: 0; opacity: 0.03;
  background-image: linear-gradient(var(--text-muted) 1px, transparent 1px),
                    linear-gradient(90deg, var(--text-muted) 1px, transparent 1px);
  background-size: 60px 60px;
}
.login-card {
  width: 100%; max-width: 420px; position: relative; z-index: 1;
  background: var(--bg-glass); backdrop-filter: blur(20px);
  border: 1px solid var(--border); border-radius: var(--radius-xl);
  padding: 48px 36px; text-align: center;
  box-shadow: 0 24px 64px rgba(0,0,0,0.4);
}
.login-logo {
  width: 56px; height: 56px; margin: 0 auto 20px;
  background: linear-gradient(135deg, var(--accent), #7c3aed);
  border-radius: 14px; display: flex; align-items: center; justify-content: center;
  font-family: 'Plus Jakarta Sans', sans-serif; font-weight: 800; font-size: 18px; color: #fff;
  box-shadow: 0 8px 24px var(--accent-glow);
}
.login-title {
  font-family: 'Plus Jakarta Sans', sans-serif; font-size: 24px; font-weight: 800;
  letter-spacing: -0.03em; margin-bottom: 8px;
}
.login-subtitle { font-size: 14px; color: var(--text-secondary); margin-bottom: 32px; line-height: 1.5; }
.login-divider {
  display: flex; align-items: center; gap: 12px; margin: 20px 0;
  font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.1em;
}
.login-divider::before, .login-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }

.input-group { margin-bottom: 16px; text-align: left; }
.input-group label { display: block; font-size: 12px; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; }
.input-group input {
  width: 100%; padding: 12px 16px; border-radius: var(--radius-md);
  border: 1px solid var(--border); background: var(--bg-tertiary);
  color: var(--text-primary); font-size: 14px; transition: var(--transition);
  outline: none;
}
.input-group input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }

.btn {
  width: 100%; padding: 14px 20px; border-radius: var(--radius-md);
  font-size: 14px; font-weight: 600; border: none; transition: var(--transition);
  display: flex; align-items: center; justify-content: center; gap: 10px;
}
.btn-primary { background: linear-gradient(135deg, var(--accent), var(--accent-hover)); color: #fff; box-shadow: 0 4px 16px var(--accent-glow); }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 8px 24px var(--accent-glow); }
.btn-oauth {
  background: var(--bg-tertiary); color: var(--text-primary); border: 1px solid var(--border);
  margin-bottom: 10px;
}
.btn-oauth:hover { background: var(--bg-card); border-color: var(--border-hover); }
.btn-oauth img { width: 20px; height: 20px; }

/* ── APP LAYOUT ── */
.app { display: flex; min-height: 100vh; }

/* ── SIDEBAR ── */
.sidebar {
  width: var(--sidebar-w); height: 100vh; position: fixed; left: 0; top: 0; z-index: 100;
  background: var(--bg-secondary); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 20px 0; overflow-y: auto;
  transition: transform 0.3s;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 12px; padding: 0 20px; margin-bottom: 28px;
}
.sidebar-brand-icon {
  width: 36px; height: 36px; border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), #7c3aed);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 12px; color: #fff;
  box-shadow: 0 4px 12px var(--accent-glow);
}
.sidebar-brand-text { font-family: 'Plus Jakarta Sans', sans-serif; font-size: 14px; font-weight: 700; }
.sidebar-label {
  font-size: 10px; font-weight: 700; letter-spacing: 0.15em; text-transform: uppercase;
  color: var(--text-muted); padding: 20px 20px 8px; margin-top: 4px;
}
.sidebar-nav { list-style: none; }
.sidebar-nav li a {
  display: flex; align-items: center; gap: 12px; padding: 10px 20px;
  font-size: 13px; font-weight: 500; color: var(--text-secondary);
  transition: var(--transition); border-left: 3px solid transparent;
}
.sidebar-nav li a:hover { color: var(--text-primary); background: var(--accent-soft); }
.sidebar-nav li a.active {
  color: var(--accent); background: var(--accent-soft); border-left-color: var(--accent); font-weight: 600;
}
.sidebar-nav li a .nav-icon { font-size: 18px; width: 20px; text-align: center; }
.sidebar-nav li a .nav-badge {
  margin-left: auto; background: var(--accent); color: #fff; font-size: 10px; font-weight: 700;
  padding: 2px 7px; border-radius: 10px;
}
.sidebar-user {
  margin-top: auto; padding: 16px 20px; border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
}
.sidebar-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #7c3aed);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: #fff; flex-shrink: 0;
}
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-role { font-size: 11px; color: var(--text-muted); }

/* ── MAIN ── */
.main { flex: 1; margin-left: var(--sidebar-w); min-height: 100vh; }
.topbar {
  height: var(--topbar-h); display: flex; align-items: center; justify-content: space-between;
  padding: 0 28px; border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 50;
  background: rgba(9,9,11,0.85); backdrop-filter: blur(12px);
}
.topbar-title { font-family: 'Plus Jakarta Sans', sans-serif; font-size: 18px; font-weight: 700; }
.topbar-right { display: flex; align-items: center; gap: 16px; }
.topbar-search {
  display: flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: var(--radius-md);
  background: var(--bg-tertiary); border: 1px solid var(--border); color: var(--text-muted); font-size: 13px;
  min-width: 200px;
}
.topbar-search input {
  background: none; border: none; color: var(--text-primary); font-size: 13px; outline: none; width: 100%;
}
.topbar-notif {
  width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--border);
  background: var(--bg-tertiary); display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary); font-size: 16px; position: relative; transition: var(--transition);
}
.topbar-notif:hover { border-color: var(--border-hover); color: var(--text-primary); }
.notif-dot {
  position: absolute; top: 6px; right: 6px; width: 8px; height: 8px;
  background: var(--accent); border-radius: 50%; border: 2px solid var(--bg-primary);
}

.content { padding: 28px; }

/* ── CARDS GRID ── */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }

.card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 24px; transition: var(--transition); position: relative; overflow: hidden;
}
.card:hover { border-color: var(--border-hover); transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,0.3); }
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.card-icon {
  width: 44px; height: 44px; border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center; font-size: 20px;
}
.card-label { font-size: 12px; font-weight: 600; color: var(--text-secondary); margin-bottom: 4px; }
.card-value { font-family: 'Plus Jakarta Sans', sans-serif; font-size: 28px; font-weight: 800; letter-spacing: -0.03em; }
.card-footer { font-size: 12px; color: var(--text-muted); margin-top: 12px; display: flex; align-items: center; gap: 6px; }
.card-footer .up { color: var(--success); }

/* ── MODULE CARDS ── */
.module-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg);
  overflow: hidden; transition: var(--transition); cursor: pointer;
}
.module-card:hover { border-color: var(--border-hover); transform: translateY(-3px); box-shadow: 0 12px 32px rgba(0,0,0,0.4); }
.module-thumb {
  width: 100%; height: 180px; background: var(--bg-tertiary);
  display: flex; align-items: center; justify-content: center; position: relative; overflow: hidden;
}
.module-thumb img { width: 100%; height: 100%; object-fit: cover; }
.module-thumb-overlay {
  position: absolute; inset: 0; background: linear-gradient(to top, rgba(0,0,0,0.7), transparent);
  display: flex; align-items: flex-end; padding: 16px;
}
.module-play {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%);
  width: 48px; height: 48px; border-radius: 50%;
  background: rgba(168,85,247,0.9); display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 20px; box-shadow: 0 4px 16px var(--accent-glow);
  opacity: 0; transition: var(--transition);
}
.module-card:hover .module-play { opacity: 1; }
.module-placeholder {
  width: 100%; height: 100%; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 8px; color: var(--text-muted);
}
.module-placeholder .icon { font-size: 32px; opacity: 0.5; }
.module-placeholder .text { font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em; }
.module-body { padding: 20px; }
.module-week { font-size: 10px; font-weight: 700; letter-spacing: 0.15em; text-transform: uppercase; color: var(--accent); margin-bottom: 6px; }
.module-title { font-family: 'Plus Jakarta Sans', sans-serif; font-size: 16px; font-weight: 700; margin-bottom: 8px; line-height: 1.3; }
.module-desc { font-size: 13px; color: var(--text-secondary); line-height: 1.5; margin-bottom: 12px; }
.module-meta { display: flex; align-items: center; gap: 16px; font-size: 11px; color: var(--text-muted); }
.module-meta span { display: flex; align-items: center; gap: 4px; }

/* ── STATUS BADGES ── */
.badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px;
  border-radius: 50px; font-size: 11px; font-weight: 600;
}
.badge-live { background: rgba(239,68,68,0.15); color: #ef4444; }
.badge-new { background: var(--accent-soft); color: var(--accent); }
.badge-done { background: rgba(34,197,94,0.15); color: var(--success); }
.badge-locked { background: rgba(255,255,255,0.05); color: var(--text-muted); }

/* ── PROGRESS BAR ── */
.progress-bar { width: 100%; height: 6px; background: var(--bg-tertiary); border-radius: 3px; overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--accent), #7c3aed); border-radius: 3px; transition: width 0.6s; }

/* ── COMMUNITY FEED ── */
.feed-post {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 20px; margin-bottom: 16px; transition: var(--transition);
}
.feed-post:hover { border-color: var(--border-hover); }
.feed-header { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.feed-avatar {
  width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; color: #fff;
}
.feed-author { font-size: 14px; font-weight: 600; }
.feed-time { font-size: 12px; color: var(--text-muted); }
.feed-text { font-size: 14px; color: var(--text-secondary); line-height: 1.65; margin-bottom: 14px; }
.feed-actions { display: flex; gap: 16px; }
.feed-action {
  display: flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: var(--radius-sm);
  font-size: 12px; color: var(--text-muted); background: none; border: none; transition: var(--transition);
}
.feed-action:hover { color: var(--text-primary); background: var(--accent-soft); }

/* ── SCHEDULE ── */
.schedule-item {
  display: flex; align-items: center; gap: 16px; padding: 14px 16px;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-md);
  margin-bottom: 8px; transition: var(--transition);
}
.schedule-item:hover { border-color: var(--border-hover); }
.schedule-time {
  min-width: 56px; font-size: 12px; font-weight: 700; color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.schedule-title { font-size: 13px; font-weight: 600; }
.schedule-host { font-size: 11px; color: var(--text-muted); }
.schedule-status { margin-left: auto; }

/* ── RESOURCE CARDS ── */
.resource-card {
  display: flex; align-items: center; gap: 14px; padding: 16px;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-md);
  transition: var(--transition); cursor: pointer;
}
.resource-card:hover { border-color: var(--border-hover); transform: translateX(4px); }
.resource-icon {
  width: 42px; height: 42px; border-radius: var(--radius-sm); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 18px;
}
.resource-name { font-size: 14px; font-weight: 600; margin-bottom: 2px; }
.resource-desc { font-size: 12px; color: var(--text-muted); }
.resource-arrow { margin-left: auto; color: var(--text-muted); font-size: 14px; }

/* ── SECTION HEADERS ── */
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.section-title { font-family: 'Plus Jakarta Sans', sans-serif; font-size: 20px; font-weight: 700; }
.section-action { font-size: 13px; font-weight: 600; color: var(--accent); }
.section-action:hover { text-decoration: underline; }

/* ── MOBILE ── */
.mobile-menu-btn { display: none; background: none; border: none; color: var(--text-primary); font-size: 22px; }
.sidebar-overlay { display:none; position:fixed; inset:0; background:rgba(0,0,0,0.6); z-index:150; }

/* ── BOTTOM NAV (Mobile) ── */
.bottom-nav {
  display: none; position: fixed; bottom: 0; left: 0; right: 0; z-index: 120;
  background: var(--bg-secondary); border-top: 1px solid var(--border);
  padding: 6px 0 env(safe-area-inset-bottom, 8px); backdrop-filter: blur(12px);
}
.bottom-nav-inner {
  display: flex; align-items: center; justify-content: space-around; max-width: 500px; margin: 0 auto;
}
.bottom-nav-item {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 6px 12px; border-radius: var(--radius-md); background: none; border: none;
  color: var(--text-muted); font-size: 10px; font-weight: 600; transition: var(--transition);
  font-family: inherit; position: relative;
}
.bottom-nav-item i { font-size: 22px; }
.bottom-nav-item.active { color: var(--accent); }
.bottom-nav-item .nav-dot {
  position: absolute; top: 4px; right: 8px; width: 6px; height: 6px;
  background: var(--accent); border-radius: 50%;
}

/* ── ELI CHAT ── */
.eli-fab {
  position: fixed; bottom: 24px; right: 24px; z-index: 110;
  width: 56px; height: 56px; border-radius: 50%; border: none;
  background: linear-gradient(135deg, var(--accent), #7c3aed);
  color: #fff; font-size: 24px; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 28px var(--accent-glow); transition: var(--transition);
  animation: eli-pulse 3s infinite;
}
.eli-fab:hover { transform: scale(1.08); box-shadow: 0 12px 36px var(--accent-glow); }
@keyframes eli-pulse { 0%,100%{box-shadow:0 8px 28px var(--accent-glow)} 50%{box-shadow:0 8px 40px rgba(168,85,247,0.45)} }

.eli-chat {
  display: none; position: fixed; z-index: 130; background: var(--bg-secondary);
  border: 1px solid var(--border); border-radius: var(--radius-xl);
  box-shadow: 0 20px 60px rgba(0,0,0,0.5); overflow: hidden;
  flex-direction: column;
  bottom: 88px; right: 24px; width: 380px; height: 520px;
}
.eli-chat.open { display: flex; }
.eli-chat-header {
  display: flex; align-items: center; gap: 10px; padding: 14px 16px;
  border-bottom: 1px solid var(--border); background: var(--bg-tertiary);
}
.eli-chat-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #7c3aed);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: #fff;
}
.eli-chat-info { flex: 1; }
.eli-chat-name { font-size: 14px; font-weight: 600; }
.eli-chat-status { font-size: 11px; color: var(--success); }
.eli-chat-close { background: none; border: none; color: var(--text-muted); font-size: 18px; padding: 4px; }
.eli-chat-body { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.eli-msg {
  max-width: 85%; padding: 10px 14px; border-radius: 14px; font-size: 13px; line-height: 1.5;
}
.eli-msg.bot { background: var(--bg-tertiary); color: var(--text-secondary); align-self: flex-start; border-bottom-left-radius: 4px; }
.eli-msg.user { background: var(--accent); color: #fff; align-self: flex-end; border-bottom-right-radius: 4px; }
.eli-chat-input {
  display: flex; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--border);
}
.eli-chat-input input {
  flex: 1; padding: 10px 14px; border-radius: 50px; border: 1px solid var(--border);
  background: var(--bg-tertiary); color: var(--text-primary); font-size: 13px; outline: none;
}
.eli-chat-input input:focus { border-color: var(--accent); }
.eli-chat-input button {
  width: 38px; height: 38px; border-radius: 50%; border: none;
  background: linear-gradient(135deg, var(--accent), #7c3aed);
  color: #fff; font-size: 16px; display: flex; align-items: center; justify-content: center;
}

/* ── LANGUAGE TOGGLE ── */
.lang-toggle-btn {
  display: inline-flex; align-items: center; gap: 2px;
  background: var(--bg-tertiary); border: 1px solid var(--border);
  border-radius: 50px; padding: 4px 6px; font-size: 11px;
  font-weight: 700; cursor: pointer; transition: var(--transition);
  font-family: 'Plus Jakarta Sans', sans-serif;
}
.lang-toggle-btn:hover { border-color: var(--accent); }
.lang-active {
  background: var(--accent); color: #fff; padding: 3px 8px;
  border-radius: 50px; font-size: 11px; letter-spacing: 0.02em;
}
.lang-inactive {
  color: var(--text-muted); padding: 3px 8px;
  font-size: 11px; letter-spacing: 0.02em;
}

@media(max-width: 1024px) {
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}
@media(max-width: 768px) {
  .sidebar { transform: translateX(-100%); z-index: 200; }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.open { display: block; }
  .main { margin-left: 0; }
  .mobile-menu-btn { display: block; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .content { padding: 16px; padding-bottom: 80px; }
  .topbar { padding: 0 16px; }
  .topbar-search { display: none; }
  .login-card { padding: 32px 24px; }
  .bottom-nav { display: block; }
  .eli-fab { bottom: 76px; right: 16px; width: 48px; height: 48px; font-size: 20px; }
  .eli-chat { bottom: 0; right: 0; left: 0; width: 100%; height: 85vh; border-radius: var(--radius-xl) var(--radius-xl) 0 0; }
  #community-layout { grid-template-columns: 1fr !important; }
  .leaderboard-grid { grid-template-columns: 1fr !important; }
  .members-grid { grid-template-columns: 1fr !important; }
  .map-container { height: 350px !important; }
  .map-stats { flex-direction: column; }
  .calendar-grid { font-size: 12px; }
}

/* ══════════════════════════════════════════════════════════════
   MAP — LEAFLET.JS COMMUNITY MAP
   ══════════════════════════════════════════════════════════════ */
.map-wrapper {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg-secondary);
}
.map-container {
  height: 500px;
  width: 100%;
  z-index: 1;
}
.map-stats {
  display: flex;
  gap: 16px;
  padding: 16px 20px;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
}
.map-stat {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
}
.map-stat-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent-glow);
}
.map-stat strong {
  color: var(--text-primary);
  font-weight: 700;
}
.map-privacy {
  position: absolute;
  bottom: 60px;
  left: 12px;
  z-index: 10;
  background: rgba(2,6,23,0.85);
  backdrop-filter: blur(8px);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 11px;
  color: var(--text-muted);
  border: 1px solid var(--border);
}
/* Custom Leaflet pin */
.yl-pin {
  width: 18px; height: 18px;
  background: radial-gradient(circle, var(--accent), var(--brand-blue));
  border-radius: 50%;
  border: 2.5px solid rgba(16,185,129,0.35);
  box-shadow: 0 0 14px rgba(16,185,129,0.5);
  animation: pulse-pin 2.5s infinite;
}
@keyframes pulse-pin {
  0%   { box-shadow: 0 0 0 0 rgba(16,185,129,0.45); }
  70%  { box-shadow: 0 0 0 12px rgba(16,185,129,0); }
  100% { box-shadow: 0 0 0 0 rgba(16,185,129,0); }
}
/* Leaflet popup custom */
.leaflet-popup-content-wrapper {
  background: var(--bg-secondary) !important;
  color: var(--text-primary) !important;
  border-radius: var(--radius-sm) !important;
  border: 1px solid var(--border) !important;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5) !important;
}
.leaflet-popup-tip { background: var(--bg-secondary) !important; }
.leaflet-popup-content { font-family: 'Plus Jakarta Sans', sans-serif !important; font-size: 13px !important; }

/* ══════════════════════════════════════════════════════════════
   LEADERBOARD — GAMIFICATION
   ══════════════════════════════════════════════════════════════ */
.leaderboard-hero {
  background: linear-gradient(135deg, var(--bg-secondary), rgba(16,185,129,0.05));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 24px;
}
.lb-avatar-lg {
  width: 72px; height: 72px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--brand-blue));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
  position: relative;
}
.lb-avatar-lg .lb-badge {
  position: absolute;
  bottom: -4px;
  right: -4px;
  width: 24px; height: 24px;
  background: var(--bg-primary);
  border: 2px solid var(--accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
}
.lb-info h3 { font-size: 18px; font-weight: 700; }
.lb-info .lb-level-name { color: var(--accent); font-size: 13px; font-weight: 600; margin-top: 2px; }
.lb-progress-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
  font-size: 12px;
  color: var(--text-muted);
}
.lb-progress {
  flex: 1;
  height: 6px;
  background: var(--bg-tertiary);
  border-radius: 3px;
  overflow: hidden;
}
.lb-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--brand-teal));
  border-radius: 3px;
  transition: width 0.5s ease;
}
.lb-ranking-text {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
}
.leaderboard-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.lb-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  backdrop-filter: blur(12px);
}
.lb-card-title {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--text-secondary);
}
.lb-entry {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
}
.lb-rank {
  width: 24px; height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
  flex-shrink: 0;
}
.lb-rank.gold   { background: rgba(245,158,11,0.2); color: var(--gold); }
.lb-rank.silver { background: rgba(148,163,184,0.2); color: var(--silver); }
.lb-rank.bronze { background: rgba(217,119,6,0.2);   color: var(--bronze); }
.lb-rank.normal { background: var(--bg-tertiary);     color: var(--text-muted); }
.lb-user-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--brand-blue));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}
.lb-user-name {
  flex: 1;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lb-score {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
}
/* Levels sidebar */
.levels-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  backdrop-filter: blur(12px);
}
.level-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  font-size: 13px;
}
.level-num {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 800;
  flex-shrink: 0;
}
.level-name { flex: 1; font-weight: 600; }
.level-pct { color: var(--text-muted); font-size: 12px; }
/* How to earn */
.earn-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-top: 16px;
  backdrop-filter: blur(12px);
}
.earn-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 13px;
  color: var(--text-secondary);
}
.earn-pts {
  color: var(--accent);
  font-weight: 700;
}

/* ══════════════════════════════════════════════════════════════
   MEMBERS GRID
   ══════════════════════════════════════════════════════════════ */
.members-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.members-filter {
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.members-filter.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.members-search {
  flex: 1;
  min-width: 200px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 13px;
}
.members-search::placeholder { color: var(--text-muted); }
.members-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.member-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  transition: all 0.2s;
  backdrop-filter: blur(12px);
}
.member-card:hover {
  border-color: var(--accent);
  background: rgba(16,185,129,0.04);
  transform: translateY(-1px);
}
.member-avatar {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--brand-blue));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  position: relative;
}
.member-online-dot {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--success);
  border: 2px solid var(--bg-primary);
}
.member-info { flex: 1; min-width: 0; }
.member-name {
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.member-bio {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.member-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
  font-size: 11px;
  color: var(--text-muted);
}
.member-status {
  display: flex;
  align-items: center;
  gap: 4px;
}
.member-status .dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--success);
}

/* ══════════════════════════════════════════════════════════════
   CALENDAR
   ══════════════════════════════════════════════════════════════ */
.calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.calendar-nav {
  display: flex;
  align-items: center;
  gap: 12px;
}
.calendar-nav button {
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.calendar-nav button:hover { border-color: var(--accent); color: var(--accent); }
.calendar-month { font-size: 20px; font-weight: 700; }
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.calendar-day-header {
  padding: 10px 4px;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
}
.calendar-day {
  min-height: 90px;
  padding: 8px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-secondary);
  transition: background 0.2s;
}
.calendar-day:hover { background: rgba(16,185,129,0.03); }
.calendar-day:nth-child(7n) { border-right: none; }
.calendar-day .day-num { font-weight: 700; margin-bottom: 4px; }
.calendar-day.today .day-num {
  background: var(--accent);
  color: #fff;
  width: 24px; height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
}
.calendar-day.other-month { color: var(--text-muted); opacity: 0.4; }
.calendar-event {
  font-size: 11px;
  padding: 3px 6px;
  border-radius: 4px;
  margin-top: 4px;
  cursor: pointer;
  line-height: 1.3;
}
.calendar-event.session { background: rgba(16,185,129,0.15); color: var(--accent); }
.calendar-event.deadline { background: rgba(13,147,242,0.15); color: var(--brand-blue); }
.calendar-event.special { background: rgba(236,72,153,0.15); color: var(--brand-pink); }

/* ══════════════════════════════════════════════════════════════
   MODULE CARDS — PREMIUM EXPERIENCE
   ══════════════════════════════════════════════════════════════ */

@keyframes cardFloat { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
@keyframes glowPulse { 0%,100% { box-shadow: 0 0 20px rgba(245,158,11,0.08); } 50% { box-shadow: 0 0 30px rgba(245,158,11,0.18); } }
@keyframes shimmerSlide { 0% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }

.module-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  transition: all 0.35s cubic-bezier(0.4,0,0.2,1);
  position: relative;
}
.module-card::before {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(16,185,129,0.04), transparent 60%);
  opacity: 0;
  transition: opacity 0.35s ease;
  z-index: 0;
  pointer-events: none;
}
.module-card:hover {
  border-color: var(--accent);
  transform: translateY(-6px) scale(1.01);
  box-shadow: 0 20px 48px rgba(0,0,0,0.3), 0 0 0 1px var(--accent-glow);
}
.module-card:hover::before { opacity: 1; }

/* Bonus card special styling */
.module-card:has(.module-week[style*="245,158,11"]) {
  border-color: rgba(245,158,11,0.2);
  animation: glowPulse 3s ease-in-out infinite;
}
.module-card:has(.module-week[style*="245,158,11"]):hover {
  border-color: #f59e0b;
  box-shadow: 0 20px 48px rgba(0,0,0,0.3), 0 0 40px rgba(245,158,11,0.15);
}

.module-thumb {
  position: relative;
  height: 140px;
  overflow: hidden;
}
.module-placeholder {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, var(--bg-secondary), var(--bg-tertiary));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  position: relative;
}
.module-placeholder::after {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 50%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.03), transparent);
  animation: shimmerSlide 3s ease-in-out infinite;
}
.module-placeholder .icon {
  font-size: 28px;
  color: var(--text-muted);
  transition: var(--transition);
}
.module-card:hover .module-placeholder .icon {
  color: var(--accent);
  transform: scale(1.15);
}
.module-placeholder .text {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

.module-play {
  position: absolute;
  right: 12px;
  bottom: 12px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 14px;
  box-shadow: 0 4px 16px var(--accent-glow);
  transition: all 0.3s ease;
  opacity: 0;
  transform: scale(0.8);
}
.module-card:hover .module-play {
  opacity: 1;
  transform: scale(1);
}

.module-body {
  padding: 16px;
  position: relative;
  z-index: 1;
}
.module-week {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 3px 10px;
  border-radius: 20px;
  background: var(--accent-soft);
  color: var(--accent);
  margin-bottom: 8px;
}
.module-title {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 6px;
  letter-spacing: -0.01em;
}
.module-desc {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 12px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.module-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
}
.module-meta i { margin-right: 4px; }

/* Staggered card entry */
.grid-3 > .module-card:nth-child(n) { animation: fadeInUp 0.5s ease backwards; }
.grid-3 > .module-card:nth-child(1) { animation-delay: 0s; }
.grid-3 > .module-card:nth-child(2) { animation-delay: 0.06s; }
.grid-3 > .module-card:nth-child(3) { animation-delay: 0.12s; }
.grid-3 > .module-card:nth-child(4) { animation-delay: 0.18s; }
.grid-3 > .module-card:nth-child(5) { animation-delay: 0.24s; }
.grid-3 > .module-card:nth-child(6) { animation-delay: 0.30s; }
.grid-3 > .module-card:nth-child(7) { animation-delay: 0.36s; }
.grid-3 > .module-card:nth-child(8) { animation-delay: 0.42s; }
.grid-3 > .module-card:nth-child(9) { animation-delay: 0.48s; }
.grid-3 > .module-card:nth-child(10) { animation-delay: 0.54s; }
.grid-3 > .module-card:nth-child(11) { animation-delay: 0.60s; }
.grid-3 > .module-card:nth-child(12) { animation-delay: 0.66s; }
.grid-3 > .module-card:nth-child(13) { animation-delay: 0.72s; }
.grid-3 > .module-card:nth-child(14) { animation-delay: 0.78s; }
.grid-3 > .module-card:nth-child(15) { animation-delay: 0.84s; }
.grid-3 > .module-card:nth-child(16) { animation-delay: 0.90s; }

