/* css/home.css */

/* ════════════════════════════════════════════════
   HOME TAB SHELL
   ════════════════════════════════════════════════ */
.home-tab {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--dark);
  overflow: hidden;
}

.home-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 12px 14px 32px;
}

/* ── Loading / empty ── */
.home-loading {
  display: flex;
  justify-content: center;
  padding: 40px 0;
}

.home-spinner {
  width: 28px; height: 28px;
  border: 3px solid rgba(255,255,255,0.1);
  border-top-color: #6366f1;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.home-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 24px;
  text-align: center;
  gap: 10px;
}

.home-empty-icon { font-size: 56px; }

.home-empty h3 {
  font-family: 'Sora', sans-serif;
  font-size: 19px; font-weight: 800;
  margin: 0;
}

.home-empty p {
  font-size: 14px;
  color: var(--muted);
  margin: 0;
}

.home-change-lang-btn {
  margin-top: 8px;
  padding: 10px 24px;
  background: linear-gradient(135deg,#6366f1,#3b82f6);
  border: none; border-radius: 100px;
  color: #fff;
  font-family: 'Sora',sans-serif;
  font-size: 14px; font-weight: 700;
  cursor: pointer;
}

.home-no-course {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
  margin-bottom: 12px;
}

/* ════════════════════════════════════════════════
   NAVBAR (hn-)
   ════════════════════════════════════════════════ */
.hn-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  background: var(--dark);
  border-bottom: 1px solid var(--border);
}

.hn-btn {
  width: 34px; height: 34px;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background 0.15s;
  flex-shrink: 0;
}

.hn-btn svg { width: 18px; height: 18px; stroke: #9aa5cc; }
.hn-btn:hover { background: rgba(255,255,255,0.1); }

.hn-btn-streak {
  display: flex; align-items: center;
  gap: 3px;
  padding: 0 8px;
  width: auto;
}

.hn-streak-icon { font-size: 16px; }
.hn-streak-num  { font-size: 13px; font-weight: 700; color: #fb923c; }

.hn-btn-settings svg { stroke: #9aa5cc; }

.hn-energy {
  flex: 1;
  display: flex; align-items: center; gap: 6px;
}

.hn-energy-icon { font-size: 14px; }

.hn-energy-track {
  flex: 1;
  height: 6px;
  background: rgba(255,255,255,0.08);
  border-radius: 3px;
  overflow: hidden;
}

.hn-energy-fill {
  height: 100%;
  background: linear-gradient(90deg,#6366f1,#3b82f6);
  border-radius: 3px;
  transition: width 0.4s;
}

.hn-energy-num {
  font-size: 12px; font-weight: 700;
  color: #818cf8;
  min-width: 20px;
  text-align: right;
}

/* ════════════════════════════════════════════════
   ACTIVE LEVEL CARD (hl-)
   ════════════════════════════════════════════════ */
.hl-level-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: linear-gradient(135deg, #5E5CE6, rgba(94,92,230,0.75));
  border-radius: 20px;
  padding: 18px;
  margin-bottom: 18px;
  box-shadow: 0 6px 18px rgba(94,92,230,0.30);
}

.hl-level-circle {
  width: 52px; height: 52px;
  border-radius: 50%;
  background: rgba(255,255,255,0.20);
  display: flex; align-items: center; justify-content: center;
  font-family: 'Sora',sans-serif;
  font-size: 16px; font-weight: 900;
  color: #fff;
  letter-spacing: -0.5px;
  flex-shrink: 0;
}

.hl-level-text { flex: 1; }

.hl-level-sub {
  font-size: 12px; font-weight: 500;
  color: rgba(255,255,255,0.80);
  letter-spacing: 0.5px;
  margin-bottom: 3px;
}

.hl-level-name {
  font-family: 'Sora',sans-serif;
  font-size: 18px; font-weight: 800;
  color: #fff;
  letter-spacing: -0.3px;
}

.hl-change-btn {
  display: flex; align-items: center; gap: 5px;
  background: rgba(255,255,255,0.22);
  border: 1px solid rgba(255,255,255,0.40);
  border-radius: 12px;
  padding: 8px 12px;
  color: #fff;
  font-family: 'Sora',sans-serif;
  font-size: 12px; font-weight: 700;
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
}

.hl-change-btn:hover { background: rgba(255,255,255,0.30); }
.hl-change-btn svg   { opacity: 0.9; }

.home-layer-switch {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}

.home-layer-btn {
  flex: 1;
  min-width: 135px;
  padding: 12px 14px;
  border: none;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  color: #fff;
  font-family: 'Sora',sans-serif;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, transform 0.15s;
}

.home-layer-btn:hover {
  background: rgba(255,255,255,0.14);
}

.home-layer-btn.active {
  background: linear-gradient(135deg,#6366f1,#3b82f6);
  box-shadow: 0 14px 28px rgba(99,102,241,0.18);
}

.home-online-layer {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 22px;
  margin-top: 8px;
}

.home-online-title {
  margin: 0 0 10px;
  font-family: 'Sora',sans-serif;
  font-size: 18px;
  font-weight: 800;
  color: #fff;
}

.home-online-description {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.65;
}

.home-online-card .hl-change-btn {
  width: auto;
}

/* ════════════════════════════════════════════════
   LEVEL PICKER SHEET ROWS
   ════════════════════════════════════════════════ */
.hl-level-picker-list { display: flex; flex-direction: column; gap: 4px; }

.hl-level-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 14px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.15s;
}

.hl-level-row:hover { background: rgba(255,255,255,0.08); }

.hl-level-row-active {
  background: rgba(94,92,230,0.12) !important;
  border-color: rgba(94,92,230,0.35) !important;
}

.hl-level-row-locked { opacity: 0.55; cursor: default; }

.hl-level-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.hl-level-row-label {
  flex: 1;
  font-size: 15px;
  font-weight: 500;
}

.hl-level-row-active .hl-level-row-label { font-weight: 700; }

.hl-level-check { flex-shrink: 0; }
.hl-level-lock  { font-size: 14px; flex-shrink: 0; }

/* Sheet subtitle */
.lang-sheet-sub {
  font-size: 13px;
  color: var(--muted);
  text-align: center;
  padding: 0 16px 12px;
  line-height: 1.5;
}

/* ════════════════════════════════════════════════
   COURSE PROGRESS BAR (hl-)
   ════════════════════════════════════════════════ */
.hl-progress-wrap { margin-bottom: 12px; }

.hl-progress-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 5px;
}

.hl-progress-label {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
}

.hl-progress-pct {
  font-size: 12px;
  font-weight: 700;
}

.hl-progress-track {
  height: 6px;
  background: rgba(94,92,230,0.12);
  border-radius: 4px;
  overflow: hidden;
}

.hl-progress-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.5s ease;
}

/* ── Course description ── */
.hl-course-desc {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.4;
  margin-bottom: 10px;
}

/* ════════════════════════════════════════════════
   NEXT LEVEL TEASER
   ════════════════════════════════════════════════ */
.hl-teaser {
  display: flex;
  align-items: center;
  gap: 14px;
  background: rgba(94,92,230,0.06);
  border: 1.5px solid rgba(94,92,230,0.20);
  border-radius: 16px;
  padding: 16px;
  cursor: pointer;
  transition: background 0.15s;
}

.hl-teaser:hover { background: rgba(94,92,230,0.10); }

.hl-teaser-icon {
  width: 44px; height: 44px;
  background: rgba(94,92,230,0.10);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.hl-teaser-body { flex: 1; }

.hl-teaser-title {
  font-size: 15px; font-weight: 700;
  color: rgba(94,92,230,0.85);
  margin-bottom: 3px;
}

.hl-teaser-sub {
  font-size: 12px;
  color: var(--muted);
}

/* ════════════════════════════════════════════════
   LESSON CARDS (lc-)
   ════════════════════════════════════════════════ */
.lesson-list { display: flex; flex-direction: column; gap: 0; }

.lesson-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 12px 14px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: all 0.18s;
}

.lesson-card.locked { opacity: 0.5; cursor: default; }

.lesson-card.completed {
  border-color: rgba(34,197,94,0.4);
  background: rgba(34,197,94,0.04);
}

.lesson-card:not(.locked):hover {
  background: rgba(255,255,255,0.08);
  transform: translateY(-1px);
}

.lc-icon-wrap {
  width: 44px; height: 44px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.lc-icon { font-size: 20px; }

.lc-body { flex: 1; min-width: 0; }

.lc-title {
  font-size: 15px; font-weight: 700;
  color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-bottom: 5px;
}

.lc-tags { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

.lc-tag {
  font-size: 11px; font-weight: 600;
  border-radius: 6px;
  padding: 3px 8px;
}

.completed-tag {
  color: #22c55e;
  font-weight: 600;
  font-size: 11px;
}

.lc-locked-msg {
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
}

.lc-arrow {
  color: rgba(255,255,255,0.25);
  flex-shrink: 0;
}

/* ════════════════════════════════════════════════
   COURSE SECTION HEADER (legacy, kept for compat)
   ════════════════════════════════════════════════ */
.course-section { margin-bottom: 24px; }

.course-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.course-title {
  font-family: 'Sora', sans-serif;
  font-size: 18px; font-weight: 800;
  margin: 0 0 4px;
}

.course-desc {
  font-size: 13px;
  color: var(--muted);
  margin: 0;
  line-height: 1.4;
}

.streak-badge {
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(251,146,60,0.15);
  border: 1px solid rgba(251,146,60,0.3);
  border-radius: 100px;
  padding: 5px 10px;
  font-size: 12px; font-weight: 700;
  color: #fb923c;
  white-space: nowrap;
  flex-shrink: 0;
}

.no-lessons {
  color: var(--muted);
  font-size: 14px;
  padding: 12px 0;
}

/* ── Responsive ── */
@media (max-width: 380px) {
  .hl-level-card { padding: 14px; }
  .hl-level-circle { width: 44px; height: 44px; font-size: 13px; }
  .hl-level-name { font-size: 15px; }
  .hl-change-btn { padding: 6px 9px; font-size: 11px; }
}

/* ════════════════════════════════════════════════
   BOTTOM SHEET (lang-sheet) — used by level picker
   and language selector. Must be present in home.css
   since those sheets are triggered from the home tab.
   ════════════════════════════════════════════════ */
.lang-sheet-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 1000;
  display: flex; align-items: flex-end;
  opacity: 0;
  transition: opacity 0.25s;
  pointer-events: none;
}

.lang-sheet-overlay.show {
  opacity: 1;
  pointer-events: all;
}

.lang-sheet {
  width: 100%;
  background: #1a1a2e;
  border-radius: 20px 20px 0 0;
  padding: 12px 16px 32px;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.34,1.2,0.64,1);
  max-height: 80vh;
  overflow-y: auto;
}

.lang-sheet-overlay.show .lang-sheet {
  transform: translateY(0);
}

.lang-sheet-handle {
  width: 36px; height: 4px;
  background: rgba(255,255,255,0.2);
  border-radius: 2px;
  margin: 0 auto 16px;
}

.lang-sheet-title {
  font-family: 'Sora', sans-serif;
  font-size: 17px; font-weight: 800;
  text-align: center;
  margin-bottom: 6px;
}

.lang-sheet-cancel {
  display: block;
  width: 100%;
  margin-top: 12px;
  padding: 14px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 14px;
  color: var(--muted);
  font-family: 'DM Sans', sans-serif;
  font-size: 15px; font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.lang-sheet-cancel:hover { background: rgba(255,255,255,0.09); }