:root {
  --bg: #07111f;
  --panel: rgba(11, 22, 38, 0.88);
  --panel-2: rgba(17, 30, 51, 0.95);
  --card: rgba(15, 24, 40, 0.95);
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(79, 209, 255, 0.28);
  --text: #f5f7fb;
  --muted: #9aa8bf;
  --cyan: #44d9ff;
  --cyan-2: #22b8ff;
  --violet: #7c5cff;
  --success: #33d17a;
  --warning: #ffb84d;
  --danger: #ff6b81;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 16px;
  --radius-sm: 12px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  font-family: Inter, Arial, Helvetica, sans-serif;
  background:
    radial-gradient(circle at top left, rgba(68, 217, 255, 0.12), transparent 28%),
    radial-gradient(circle at top right, rgba(124, 92, 255, 0.12), transparent 26%),
    linear-gradient(180deg, #06101b 0%, #07111f 50%, #050c16 100%);
  color: var(--text);
  min-height: 100vh;
}

a {
  text-decoration: none;
  color: inherit;
}

.admin-layout {
  position: relative;
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  z-index: 20;
  border-right: 1px solid var(--border);
  background: rgba(4, 10, 18, 0.75);
  backdrop-filter: blur(18px);
  padding: 22px 14px 18px;
  scrollbar-width: none;
}

.sidebar::-webkit-scrollbar {
  display: none;
}

.sidebar__brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 28px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.03);
}

.sidebar__brand h2 {
  margin: 0;
  font-size: 1rem;
}

.sidebar__brand p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.sidebar__logo {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--cyan), var(--violet));
  color: #04111d;
  font-weight: 800;
}

.sidebar__nav {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sidebar__link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 11px;
  border-radius: 10px;
  color: var(--muted);
  border: 1px solid transparent;
  font-size: 13px;
  transition: color 0.18s ease, background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.sidebar__link:hover {
  color: var(--text);
  border-color: var(--border);
  background: rgba(255, 255, 255, 0.04);
}

.sidebar__link.active {
  color: var(--text);
  background: rgba(68, 217, 255, 0.1);
  border-color: var(--border-strong);
  box-shadow: inset 3px 0 0 var(--cyan);
}

.main-content {
  position: relative;
  z-index: 1;
  min-width: 0;
  padding: 32px;
}

.page-header {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 28px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--cyan);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.75rem;
  font-weight: 700;
}

.page-header h1 {
  margin: 0;
  font-size: clamp(2rem, 3vw, 3rem);
  line-height: 1.05;
}

.page-description {
  margin: 14px 0 0;
  max-width: 800px;
  color: var(--muted);
  line-height: 1.7;
}

.header-actions {
  position: relative;
  z-index: 10;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.btn {
  position: relative;
  z-index: 10;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 18px;
  border-radius: 14px;
  font-weight: 700;
  border: 1px solid transparent;
  transition: 0.25s ease;
  cursor: pointer;
}

.btn.is-loading,
.btn-card.is-loading {
  opacity: 0.72;
  cursor: wait;
}

.btn-primary {
  background: linear-gradient(135deg, var(--cyan), var(--cyan-2));
  color: #04101d;
  box-shadow: 0 12px 35px rgba(34, 184, 255, 0.22);
}

.btn-primary:hover {
  transform: translateY(-1px);
  filter: brightness(1.04);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  border-color: var(--border);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.08);
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 24px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.search-box {
  flex: 1;
}

.search-box input,
.toolbar select {
  width: 100%;
  min-height: 48px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  outline: none;
  padding: 0 14px;
}

.search-box input::placeholder {
  color: #7e8ca3;
}

.toolbar-actions {
  display: flex;
  gap: 12px;
  min-width: 520px;
}

.toolbar-actions select {
  min-width: 160px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 28px;
}

.stat-card {
  padding: 22px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  border-top-width: 2px;
  background: var(--panel-2);
  box-shadow: var(--shadow);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.4);
}

.stats-grid .stat-card:nth-child(1) { border-top-color: var(--cyan); }
.stats-grid .stat-card:nth-child(2) { border-top-color: var(--success); }
.stats-grid .stat-card:nth-child(3) { border-top-color: var(--warning); }
.stats-grid .stat-card:nth-child(4) { border-top-color: var(--violet); }

.stats-grid .stat-card:nth-child(1) .stat-value { color: var(--cyan); }
.stats-grid .stat-card:nth-child(2) .stat-value { color: var(--success); }
.stats-grid .stat-card:nth-child(3) .stat-value { color: var(--warning); }
.stats-grid .stat-card:nth-child(4) .stat-value { color: var(--violet); }

.stat-label {
  display: block;
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 10px;
}

.stat-value {
  font-size: 2rem;
  font-weight: 800;
}

.courses-section {
  padding: 24px;
  border-radius: var(--radius-xl);
  border: 1px solid var(--border);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 24px;
}

.section-head h2 {
  margin: 0;
  font-size: 1.35rem;
}

.section-head p {
  margin: 0;
  color: var(--muted);
}

.courses-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.course-card {
  border: 1px solid var(--border);
  border-radius: 22px;
  background: var(--card);
  overflow: hidden;
  transition: transform 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease;
}

.course-card:hover {
  transform: translateY(-3px);
  border-color: var(--border-strong);
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.32), 0 0 0 1px rgba(68, 217, 255, 0.08);
}

.course-card:has(.badge--published) {
  border-top: 2px solid rgba(51, 209, 122, 0.4);
}

.course-card:has(.badge--draft) {
  border-top: 2px solid rgba(255, 184, 77, 0.35);
}

.course-card__top {
  padding: 22px 22px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.course-card__readiness {
  margin-bottom: 14px;
}

.course-card__readiness-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.course-card__readiness-head strong {
  font-size: 0.84rem;
  color: var(--muted);
}

.readiness-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 58px;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 800;
}

.readiness-badge.is-ready {
  color: #7ef0b3;
  background: rgba(51, 209, 122, 0.14);
  border: 1px solid rgba(126, 240, 179, 0.24);
}

.readiness-badge.is-pending {
  color: #ffd18b;
  background: rgba(255, 184, 77, 0.14);
  border: 1px solid rgba(255, 209, 139, 0.2);
}

.readiness-meter {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.readiness-meter span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--warning), var(--cyan));
}

.course-card__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
}

.badge--published {
  background: rgba(51, 209, 122, 0.14);
  color: #74f0aa;
}

.badge--draft {
  background: rgba(255, 184, 77, 0.14);
  color: #ffd18b;
}

.level {
  color: var(--muted);
  font-size: 0.9rem;
}

.course-card h3 {
  margin: 0 0 10px;
  font-size: 1.2rem;
}

.course-card__desc {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
  min-height: 78px;
}

.course-card__body {
  padding: 18px 22px;
}

.course-card__stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.course-mini-stat {
  padding: 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.course-mini-stat span {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  margin-bottom: 6px;
}

.course-mini-stat strong {
  font-size: 1rem;
}

.course-card__actions {
  display: flex;
  gap: 10px;
  padding: 0 22px 22px;
  flex-wrap: wrap;
}

.btn-card {
  appearance: none;
  font: inherit;
  color: inherit;
  cursor: pointer;
  flex: 1;
  min-width: 120px;
  text-align: center;
  padding: 12px 14px;
  border-radius: 12px;
  font-weight: 700;
  border: 1px solid var(--border);
  transition: 0.25s ease;
}

.btn-card:disabled {
  opacity: 0.72;
  cursor: wait;
}

.overlay,
.sidebar::before,
.sidebar::after {
  pointer-events: none;
}

.btn-card--primary {
  background: rgba(68, 217, 255, 0.12);
  color: var(--cyan);
  border-color: rgba(68, 217, 255, 0.22);
}

.btn-card--primary:hover {
  background: rgba(68, 217, 255, 0.18);
}

.btn-card--secondary {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
}

.btn-card--secondary:hover {
  background: rgba(255, 255, 255, 0.08);
}

.empty-state {
  margin-top: 12px;
  padding: 40px 20px;
  border: 1px dashed var(--border);
  border-radius: 20px;
  text-align: center;
  background: rgba(255, 255, 255, 0.02);
}

.empty-state h3 {
  margin: 0 0 10px;
}

.empty-state p {
  margin: 0;
  color: var(--muted);
}

.hidden {
  display: none !important;
}

@media (max-width: 1200px) {
  .courses-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 980px) {
  .admin-layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: relative;
    height: auto;
    overflow-y: visible;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .page-header,
  .toolbar,
  .section-head {
    flex-direction: column;
    align-items: stretch;
  }

  .toolbar-actions {
    min-width: auto;
    width: 100%;
    flex-direction: column;
  }

  .toolbar-actions select {
    width: 100%;
  }
}

@media (max-width: 680px) {
  .main-content {
    padding: 18px;
  }

  .courses-grid,
  .stats-grid,
  .course-card__stats {
    grid-template-columns: 1fr;
  }

  .course-card__actions {
    flex-direction: column;
  }
}
