/* =================================================================
   home.css  –  Landing page / Index dashboard styles
   Components: continue-banner, stats-row, filter chips (enhanced),
   compact exam cards, section headers
   ================================================================= */

/* ── 1. Page shell ────────────────────────────────────────────── */
.home-main {
  padding: 20px 20px 80px;
  max-width: var(--content-max-width, 1200px);
  margin: 0 auto;
}

/* ── 2. Page header ──────────────────────────────────────────── */
.home-header {
  margin-bottom: 20px;
}
.home-header-title {
  font-size: var(--fs-2xl);
  font-weight: 700;
  color: var(--text);
  margin: 0 0 2px;
  line-height: var(--lh-tight);
}
.home-header-sub {
  font-size: var(--fs-sm);
  color: var(--text-secondary);
  margin: 0;
}

/* ── 3. Continue Learning Banner ─────────────────────────────── */
.continue-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  margin-bottom: var(--section-gap);
  box-shadow: var(--shadow-xs);
  text-decoration: none;
  color: inherit;
  transition: box-shadow var(--dur-fast) var(--ease-out),
              border-color var(--dur-fast) var(--ease-out);
}
.continue-banner:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--primary);
}

.continue-banner-icon {
  width: 36px; height: 36px;
  border-radius: var(--radius-md);
  background: var(--primary-surface);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--primary);
}
.continue-banner-icon svg {
  width: 18px; height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.continue-banner-body {
  flex: 1;
  min-width: 0;
}
.continue-banner-label {
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  display: block;
  margin-bottom: 2px;
}
.continue-banner-title {
  font-size: var(--fs-md);
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}
.continue-banner-progress {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 5px;
}
.continue-progress-bar {
  flex: 1;
  height: 3px;
  background: var(--ring-track);
  border-radius: 2px;
  overflow: hidden;
  max-width: 200px;
}
.continue-progress-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 2px;
  transition: width 0.6s var(--ease-out);
}
.continue-progress-pct {
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
}

.continue-banner-cta {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 7px 14px;
  background: var(--primary);
  color: #fff;
  font-size: var(--fs-sm);
  font-weight: 600;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  transition: opacity var(--dur-fast) var(--ease-out);
}
.continue-banner-cta:hover { opacity: 0.88; }
.continue-banner-cta svg {
  width: 14px; height: 14px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ── 4. Stats Row ────────────────────────────────────────────── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: var(--section-gap);
}

.stat-card {
  background: var(--bg-secondary);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow-xs);
  transition: box-shadow var(--dur-fast) var(--ease-out);
}
.stat-card:hover { box-shadow: var(--shadow-sm); }

.stat-icon {
  width: 32px; height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}
.stat-icon.streak  { background: rgba(251,191,36,0.12); }
.stat-icon.goal    { background: rgba(99,179,237,0.12); }
.stat-icon.tests   { background: rgba(74,222,128,0.12); }
.stat-icon.score   { background: rgba(167,139,250,0.12); }

.stat-body { min-width: 0; }
.stat-value {
  font-size: var(--fs-lg);
  font-weight: 700;
  color: var(--text);
  line-height: var(--lh-tight);
  display: block;
}
.stat-label {
  font-size: var(--fs-xs);
  color: var(--text-secondary);
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── 5. Section Row ──────────────────────────────────────────── */
.home-section-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.home-section-title {
  font-size: var(--fs-md);
  font-weight: 600;
  color: var(--text);
  margin: 0;
}
.home-section-link {
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--primary);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 3px;
  white-space: nowrap;
}
.home-section-link:hover { text-decoration: underline; }
.home-section-link svg {
  width: 13px; height: 13px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ── 6. Filter Chips (enhanced) ──────────────────────────────── */
.filter-chips {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding: 0 0 2px;
  margin-bottom: var(--section-gap);
}
.filter-chips::-webkit-scrollbar { display: none; }

.filter-chip {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 14px;
  border-radius: var(--radius-full);
  border: 1px solid var(--card-border);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-size: var(--fs-sm);
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
  transition: background var(--dur-fast) var(--ease-out),
              color    var(--dur-fast) var(--ease-out),
              border-color var(--dur-fast) var(--ease-out);
}
.filter-chip:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-surface);
}
.filter-chip.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.filter-chip .chip-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.6;
  flex-shrink: 0;
}
.filter-chip.active .chip-dot { opacity: 1; background: rgba(255,255,255,0.7); }

/* ── 7. Exam Cards Grid (compact premium) ────────────────────── */
.exam-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}

.exam-card {
  --card-accent: var(--primary);
  display: flex;
  flex-direction: column;
  background: var(--bg-secondary);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow-xs);
  transition: box-shadow var(--dur-fast) var(--ease-out),
              border-color var(--dur-fast) var(--ease-out),
              transform var(--dur-fast) var(--ease-out);
  position: relative;
}
.exam-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--card-accent);
  transform: translateY(-2px);
}

/* Top accent strip */
.exam-card::before {
  content: "";
  display: block;
  height: 3px;
  background: var(--card-accent);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

/* Disabled / coming soon */
.exam-card.coming-soon {
  opacity: 0.55;
  pointer-events: none;
}

.exam-card-body {
  padding: 14px 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Header row: icon + title + badge */
.exam-card-header {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.exam-card-icon {
  width: 36px; height: 36px;
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--card-accent) 12%, transparent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.exam-card-icon svg {
  width: 18px; height: 18px;
  stroke: var(--card-accent);
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.exam-card-title-group { flex: 1; min-width: 0; }
.exam-card-title {
  font-size: var(--fs-md);
  font-weight: 700;
  color: var(--text);
  line-height: var(--lh-tight);
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.exam-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  margin-top: 3px;
}
.exam-card-tag {
  font-size: var(--fs-xs);
  font-weight: 600;
  padding: 1px 7px;
  border-radius: var(--radius-full);
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  border: 1px solid var(--card-border);
}

/* Status badge */
.exam-card-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--fs-xs);
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  white-space: nowrap;
  flex-shrink: 0;
}
.exam-card-status.active {
  background: var(--badge-completed-bg);
  color: var(--badge-completed);
}
.exam-card-status.soon {
  background: var(--bg-tertiary);
  color: var(--text-muted);
}
.exam-card-status .status-dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: currentColor;
}

/* Stats row inside card */
.exam-card-stats {
  display: flex;
  gap: 14px;
}
.exam-stat {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.exam-stat-num {
  font-size: var(--fs-md);
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}
.exam-stat-lbl {
  font-size: var(--fs-xs);
  color: var(--text-muted);
}

/* Progress bar inside card */
.exam-card-progress {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.exam-progress-bar {
  height: 4px;
  background: var(--ring-track);
  border-radius: 2px;
  overflow: hidden;
}
.exam-progress-fill {
  height: 100%;
  background: var(--card-accent);
  border-radius: 2px;
  transition: width 0.6s var(--ease-out);
}
.exam-progress-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.exam-progress-label {
  font-size: var(--fs-xs);
  color: var(--text-secondary);
}
.exam-progress-pct {
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--text-secondary);
}

/* Card footer CTA */
.exam-card-footer {
  border-top: 1px solid var(--card-border);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.exam-card-cta {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--card-accent);
  display: flex;
  align-items: center;
  gap: 4px;
}
.exam-card-cta svg {
  width: 13px; height: 13px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.exam-card-last {
  font-size: var(--fs-xs);
  color: var(--text-muted);
}

/* Coming soon overlay text */
.exam-card-coming {
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ── 8. No Results ───────────────────────────────────────────── */
.no-results {
  display: none;
  grid-column: 1 / -1;
  text-align: center;
  color: var(--text-secondary);
  padding: 32px 0;
  font-size: var(--fs-md);
}

/* ── 9. Responsive ───────────────────────────────────────────── */
@media (max-width: 768px) {
  .stats-row {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
  .stat-value { font-size: var(--fs-md); }
  .exam-grid {
    grid-template-columns: 1fr;
  }
  .continue-banner-cta { display: none; }
  .home-main { padding: 16px 12px 80px; }
}

@media (max-width: 480px) {
  .stats-row {
    grid-template-columns: repeat(2, 1fr);
  }
  .stat-card { padding: 10px 12px; gap: 8px; }
  .stat-icon { width: 28px; height: 28px; font-size: 14px; }
}

/* ── 10. Guest Hero (logged-out landing) ─────────────────────── */
#hero-guest {
  padding: 40px 0 32px;
  text-align: center;
}

.guest-eyebrow {
  display: inline-block;
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--primary);
  background: var(--primary-surface);
  border: 1px solid color-mix(in srgb, var(--primary) 20%, transparent);
  border-radius: var(--radius-full);
  padding: 4px 14px;
  margin-bottom: 20px;
}

.guest-headline {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
  margin: 0 0 16px;
}

.guest-sub {
  font-size: var(--fs-md);
  color: var(--text-secondary);
  min-height: calc(1.7em * 2);
  line-height: 1.7;
  max-width: 540px;
  margin: 0 auto 28px;
}

#hero-stat-line {
  display: block;
  opacity: 0;
  transition: opacity 0.4s ease;
}

.guest-ctas {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 28px;
}

.guest-cta-primary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 12px 24px;
  background: var(--primary);
  color: #fff;
  font-size: var(--fs-md);
  font-weight: 600;
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: opacity var(--dur-fast) var(--ease-out),
              transform var(--dur-fast) var(--ease-out);
}
.guest-cta-primary:hover { opacity: 0.88; transform: translateY(-1px); }
.guest-cta-primary svg {
  width: 15px; height: 15px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.guest-cta-secondary {
  display: inline-flex;
  align-items: center;
  padding: 12px 24px;
  background: transparent;
  color: var(--text);
  font-size: var(--fs-md);
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid var(--card-border);
  text-decoration: none;
  transition: border-color var(--dur-fast) var(--ease-out),
              color var(--dur-fast) var(--ease-out);
}
.guest-cta-secondary:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.guest-features {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px 20px;
}

.guest-feature {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-sm);
  color: var(--text-secondary);
  font-weight: 500;
}

.gf-icon {
  font-size: 14px;
  line-height: 1;
}

/* ── 11. Logged-in hero greeting ────────────────────────────── */
.user-greeting {
  font-size: var(--fs-lg);
  font-weight: 600;
  color: var(--text);
  margin: 0 0 16px;
}

/* ── Guest/user hero responsive ────────────────────────────── */
@media (max-width: 600px) {
  #hero-guest { padding: 28px 0 24px; }
  .guest-sub { font-size: var(--fs-sm); }
  .guest-cta-primary,
  .guest-cta-secondary { padding: 10px 18px; font-size: var(--fs-sm); }
  .guest-features { gap: 6px 14px; }
  .user-greeting { font-size: var(--fs-md); }
}

/* ── 12. Adjust home padding when sidebar is collapsed (desktop) ── */
@media (min-width: 1024px) {
  /* Keep the home content visually balanced when the sidebar collapses */
  body.sidebar-collapsed .home-main {
    /* Preserve top/right/bottom paddings from the default rule */
    padding-top: 20px;
    padding-right: 20px;
    padding-bottom: 80px;
    /* Simple, consistent left gutter when sidebar is collapsed. Adjust
       this value if you want more/less space. */
    padding-left: 20px;
  }
}
