:root {
  --deep-green: #1e3a2f;
  --terracotta: #c2714f;
  --sage: #6b8f71;
  --gold: #d4a853;
  --cream: #faf6f0;
  --white: #fff;
  --text: #2c2c2c;
  --muted: #777;
  --border: #ddd5c8;
  --sidebar: 68px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
}

body {
  font-family: "Lato", sans-serif;
  background: var(--cream);
  color: var(--text);
  min-height: 100vh;
}

/* ── TOP NAV ── */
.topnav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: var(--sidebar);
  background: var(--deep-green);
  border-bottom: 2px solid var(--terracotta);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  gap: 16px;
}

.topnav-brand {
  font-family: "Playfair Display", serif;
  color: var(--white);
  font-size: 1rem;
  font-weight: 700;
  white-space: nowrap;
}

.topnav-brand span {
  color: var(--gold);
}

.topnav-right {
  display: flex;
  align-items: center;
  gap: 20px;
}

.user-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.88rem;
}

.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--gold);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.btn-signout {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.7);
  padding: 7px 16px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.8rem;
  font-family: "Lato", sans-serif;
  transition: background 0.2s;
}

.btn-signout:hover {
  background: rgba(255, 255, 255, 0.18);
}

/* ── MAIN ── */
.main {
  padding-top: var(--sidebar);
  min-height: 100vh;
}

/* ── HERO BANNER ── */
.courses-hero {
  background: linear-gradient(135deg, var(--deep-green), #2d5240);
  padding: 50px 5% 40px;
  position: relative;
  overflow: hidden;
}

.courses-hero::after {
  content: "✝";
  position: absolute;
  right: 3%;
  top: 50%;
  transform: translateY(-50%);
  font-size: 16rem;
  color: rgba(200, 146, 42, 0.05);
  pointer-events: none;
  line-height: 1;
}

.courses-hero h1 {
  font-family: "Playfair Display", serif;
  color: var(--white);
  font-size: clamp(1.7rem, 3vw, 2.6rem);
  font-weight: 800;
  margin-bottom: 8px;
}

.courses-hero h1 em {
  color: var(--gold);
  font-style: italic;
}

.courses-hero p {
  color: rgba(255, 255, 255, 0.65);
  font-size: 1rem;
  max-width: 560px;
}

/* ── TOOLBAR ── */
.courses-toolbar {
  padding: 24px 5%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  background: var(--white);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: var(--sidebar);
  z-index: 50;
}

.filter-group {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.filter-btn {
  padding: 8px 18px;
  border-radius: 100px;
  border: 1.5px solid var(--border);
  background: transparent;
  font-family: "Lato", sans-serif;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.18s;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.filter-btn.active,
.filter-btn:hover {
  background: var(--deep-green);
  color: var(--white);
  border-color: var(--navy);
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1.5px solid var(--border);
  border-radius: 4px;
  padding: 8px 14px;
  background: var(--cream);
}

.search-box input {
  border: none;
  background: transparent;
  outline: none;
  font-family: "Lato", sans-serif;
  font-size: 0.9rem;
  color: var(--text);
  width: 200px;
}

.search-box span {
  color: var(--muted);
}

/* ── GRID ── */
.courses-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 28px;
  padding: 36px 5%;
  max-width: 1400px;
}

/* ── COURSE CARD ── */
.course-card {
  background: var(--white);
  border-radius: 8px;
  border: 1px solid var(--border);
  overflow: hidden;
  transition: transform 0.22s, box-shadow 0.22s;
  cursor: pointer;
  display: flex;
  flex-direction: column;
}

.course-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 16px 48px rgba(13, 34, 85, 0.12);
}

.course-card.locked {
  cursor: default;
  opacity: 0.6;
  filter: grayscale(30%);
}

.course-card.locked:hover {
  transform: none;
  box-shadow: none;
}

.card-thumb {
  height: 160px;
  background: var(--navy);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  position: relative;
  overflow: hidden;
}

.card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-thumb-placeholder {
  font-size: 3.5rem;
}

.card-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 4px 12px;
  border-radius: 100px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.badge-access {
  background: var(--gold);
  color: var(--white);
}

.badge-locked {
  background: rgba(0, 0, 0, 0.55);
  color: rgba(255, 255, 255, 0.8);
}

.card-body {
  padding: 22px 22px 18px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.card-category {
  font-size: 0.7rem;
  color: var(--gold);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 8px;
}

.card-title {
  font-family: "Playfair Display", serif;
  color: var(--navy);
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 10px;
  line-height: 1.3;
}

.card-desc {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.65;
  flex: 1;
}

.card-meta {
  display: flex;
  gap: 16px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.card-meta-item {
  font-size: 0.78rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 5px;
}

.btn-card {
  margin-top: 16px;
  width: 100%;
  padding: 11px;
  border-radius: 4px;
  border: none;
  cursor: pointer;
  font-family: "Lato", sans-serif;
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transition: background 0.2s;
}

.btn-start {
  background: var(--terracotta);
  color: var(--white);
}

.btn-start:hover {
  background: var(--deep-green);
}

.btn-locked {
  background: var(--cream);
  color: var(--muted);
  cursor: not-allowed;
  border: 1px solid var(--border);
}

/* ── EMPTY / LOADING ── */
.state-box {
  grid-column: 1/-1;
  text-align: center;
  padding: 80px 20px;
  color: var(--muted);
}

.state-box .icon {
  font-size: 3rem;
  margin-bottom: 18px;
}

.state-box h3 {
  font-family: "Playfair Display", serif;
  color: var(--navy);
  font-size: 1.4rem;
  margin-bottom: 10px;
}

.state-box p {
  max-width: 400px;
  margin: 0 auto;
  line-height: 1.75;
}

.skeleton {
  background: linear-gradient(90deg, #eee 25%, #f8f8f8 50%, #eee 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: 4px;
}

@keyframes shimmer {
  to {
    background-position: -200% 0;
  }
}

.sk-card {
  background: var(--white);
  border-radius: 8px;
  border: 1px solid var(--border);
  overflow: hidden;
}

.sk-thumb {
  height: 160px;
}

.sk-line {
  height: 12px;
  margin: 8px 20px;
}

.sk-title {
  height: 18px;
  margin: 16px 20px 8px;
}

/* ── LOCKED MODAL ── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(13, 34, 85, 0.7);
  backdrop-filter: blur(4px);
  align-items: center;
  justify-content: center;
}

.modal-overlay.open {
  display: flex;
}

.modal {
  background: var(--white);
  border-radius: 10px;
  max-width: 440px;
  width: 90%;
  padding: 44px 40px;
  text-align: center;
  position: relative;
}

.modal-icon {
  font-size: 3rem;
  margin-bottom: 18px;
}

.modal h3 {
  font-family: "Playfair Display", serif;
  color: var(--navy);
  font-size: 1.5rem;
  margin-bottom: 12px;
}

.modal p {
  color: var(--muted);
  line-height: 1.75;
  margin-bottom: 28px;
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 20px;
  background: none;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
  color: var(--muted);
}

.btn-modal {
  padding: 13px 32px;
  background: var(--navy);
  color: var(--white);
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-family: "Lato", sans-serif;
  font-weight: 700;
  font-size: 0.85rem;
}

.btn-complete {
  background: #16a34a;
  color: white;
  cursor: not-allowed;
  opacity: 0.8;
}
