/* EDBMS application shell — reuses the public site's visual system (Section 2)
   applied to an application shell rather than a marketing layout. Colors/fonts
   are the same CSS custom properties, driven by the active theme (Section 19.1).
   Theme color/font values below are just the fallback defaults — when a theme
   is active in the database, layouts/app.blade.php and auth/login.blade.php
   inject an inline <style> override with the live values (see
   app/Support/ActiveTheme.php). This file also carries the same shadow/hover
   language as the public site's style.css (--shadow-card, hover-lift, etc.)
   so the two apps read as one product, not two different tools. */
:root {
  --color-primary: #2A1B3D;
  --color-primary-dark: #1C1129;
  --color-accent: #7C4DFF;
  --color-accent-dark: #6636E0;
  --color-bg: #F7F6FA;
  --color-surface: #FFFFFF;
  --color-border: #E6E3EF;
  --color-text-muted: #6B6B6B;
  --font-heading: 'Sora', sans-serif;
  --font-body: 'Inter', sans-serif;
  --radius-card: 12px;
  --radius-pill: 20px;
  --radius-input: 8px;
  --shadow-card: 0 4px 16px rgba(42, 27, 61, 0.08);
  --shadow-card-hover: 0 10px 28px rgba(42, 27, 61, 0.14);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--color-bg);
  color: #1C1129;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { font-family: var(--font-heading); font-weight: 700; color: var(--color-primary); margin: 0 0 8px; }
a { text-decoration: none; }

/* ---- Shell layout ---- */
.app-shell { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; }

.sidebar {
  background: linear-gradient(180deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
  color: #E9E4F5;
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
}
.sidebar .brand {
  color: #fff;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.05rem;
  padding: 6px 12px 22px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar .brand img {
  height: 32px;
  width: 32px;
  object-fit: contain;
  border-radius: 8px;
  background: #fff;
  padding: 3px;
}
.sidebar nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-pill);
  color: #C9B8E8;
  font-size: 0.92rem;
  font-weight: 500;
  transition: background .15s ease, color .15s ease, transform .15s ease;
}
.sidebar nav a:hover { background: rgba(255,255,255,0.08); color: #fff; transform: translateX(2px); }
.sidebar nav a.active {
  background: rgba(255,255,255,0.12);
  color: #fff;
  box-shadow: inset 3px 0 0 var(--color-accent);
}

.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  padding: 14px 28px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar form input[type="search"] {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-input);
  padding: 8px 12px;
  font-family: var(--font-body);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.topbar form input[type="search"]:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(124,77,255,.15);
}
.topbar .user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.88rem;
}
.topbar .user-chip .avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--color-accent);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.8rem;
}
.content { padding: 28px; }

/* ---- Cards, grids, stats ---- */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  padding: 20px;
  box-shadow: var(--shadow-card);
  transition: box-shadow .2s ease, transform .2s ease;
}
.card:hover { box-shadow: var(--shadow-card-hover); }
.card.stat { transition: box-shadow .2s ease, transform .2s ease; }
.card.stat:hover { box-shadow: var(--shadow-card-hover); transform: translateY(-2px); }

.grid { display: grid; gap: 18px; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.stat strong { display: block; font-family: var(--font-heading); font-size: 1.6rem; color: var(--color-primary); }
.stat span { color: var(--color-text-muted); font-size: 0.85rem; }

/* ---- Tables ---- */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--color-border); font-size: 0.9rem; }
th { color: var(--color-text-muted); font-weight: 600; text-transform: uppercase; font-size: 0.75rem; letter-spacing: .04em; }
tbody tr { transition: background .12s ease; }
tbody tr:hover { background: rgba(124,77,255,0.04); }

/* ---- Badges & buttons ---- */
.badge { display: inline-block; padding: 3px 10px; border-radius: var(--radius-pill); background: rgba(124,77,255,0.12); color: var(--color-accent); font-size: 0.75rem; font-weight: 700; }
.badge--success { background: rgba(46,160,90,0.12); color: #1E7A45; }
.badge--warning { background: rgba(230,160,30,0.14); color: #9A6A00; }
.badge--danger { background: rgba(219,58,58,0.12); color: #B3261E; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: var(--radius-pill);
  background: var(--color-accent);
  color: #fff;
  border: none;
  font-weight: 700;
  font-family: var(--font-heading);
  font-size: 0.88rem;
  text-decoration: none;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
.btn:hover { transform: translateY(-2px); background: var(--color-accent-dark); box-shadow: 0 8px 20px rgba(124,77,255,.3); }
.btn-outline { background: transparent; color: var(--color-primary); border: 2px solid var(--color-primary); }
.btn-outline:hover { background: var(--color-primary); color: #fff; box-shadow: none; }
.btn--small { padding: 4px 12px; font-size: 0.75rem; }

/* ---- Forms ---- */
.form-field { margin-bottom: 16px; }
.form-field label { display: block; font-weight: 600; font-size: 0.85rem; margin-bottom: 6px; color: var(--color-primary); }
.form-field input, .form-field select, .form-field textarea {
  width: 100%;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-input);
  padding: 10px 12px;
  background: var(--color-bg);
  font-family: var(--font-body);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.form-field input:focus, .form-field select:focus, .form-field textarea:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(124,77,255,.15);
  background: var(--color-surface);
}

/* ---- Auth screen ---- */
.auth-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at top left, rgba(124,77,255,0.10), transparent 45%), var(--color-bg);
}
.auth-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  padding: 40px;
  width: 380px;
  text-align: center;
  box-shadow: var(--shadow-card-hover);
}
.auth-card .auth-logo {
  height: 52px;
  width: 52px;
  object-fit: contain;
  border-radius: 12px;
  margin: 0 auto 16px;
  display: block;
}

@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

/* ---- Progressive-disclosure manage panels (course/blog edit, etc.) ---- */
details > summary { list-style: none; }
details > summary::-webkit-details-marker { display: none; }
details > summary:hover { text-decoration: underline; }
details[open] > summary { margin-bottom: 4px; }

/* ---- Media picker (pick existing or upload inline — Section: media-upload gap) ---- */
.media-picker { margin-bottom: 14px; }
.media-picker__select { margin-bottom: 8px; }
.media-picker__preview { margin-bottom: 8px; }
.media-picker__preview-img {
  max-width: 160px;
  max-height: 90px;
  object-fit: contain;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-input);
  padding: 4px;
}
.media-picker__upload { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.media-picker__file { font-size: 0.82rem; }
.media-picker__status { font-size: 0.78rem; color: var(--color-text-muted); }

/* ---- Theme builder live preview (Section: theme-builder gaps #2/#3) ---- */
.theme-preview {
  --p-primary: #2A1B3D; --p-primary-dark: #1C1129; --p-accent: #7C4DFF;
  --p-bg: #F7F6FA; --p-surface: #FFFFFF; --p-border: #E6E3EF; --p-muted: #6B6B6B;
  --p-heading-font: 'Sora'; --p-body-font: 'Inter';
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  overflow: hidden;
}
.theme-preview__header { padding: 16px 18px; background: var(--p-primary); }
.theme-preview__header .theme-preview__heading { color: #fff; }
.theme-preview__body { padding: 18px; background: var(--p-bg); }
.theme-preview__card { padding: 14px; border-radius: 10px; margin-bottom: 14px; background: var(--p-surface); border: 1px solid var(--p-border); }
.theme-preview__button { border: none; padding: 10px 20px; border-radius: 999px; font-weight: 700; cursor: default; background: var(--p-accent); color: #fff; font-family: var(--p-body-font), sans-serif; }
.theme-preview__heading { font-family: var(--p-heading-font), sans-serif; font-weight: 700; color: var(--p-primary); margin: 0; }
.theme-preview__body-text { font-family: var(--p-body-font), sans-serif; color: var(--p-muted); margin: 0; }
