/* ========================================================
   Admin / CMS dashboard styles
   ======================================================== */

:root {
  --font:         'Inter', system-ui, sans-serif;
  --sidebar-w:    240px;
  --topbar-h:     60px;

  --bg:           #f5f4f0;
  --surface:      #ffffff;
  --border:       #e5e4df;
  --accent:       #6c63ff;
  --accent-dark:  #5a52d5;
  --danger:       #ef4444;
  --success:      #22c55e;

  --text-primary:   #1a1a1a;
  --text-secondary: #555;
  --text-muted:     #888;

  --radius-sm:    8px;
  --radius:       12px;
  --shadow:       0 1px 8px rgba(0,0,0,.08), 0 0 1px rgba(0,0,0,.04);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text-primary);
  height: 100vh;
  overflow: hidden;
}

a { color: inherit; text-decoration: none; }

/* ── Screen helpers ─────────────────────────────────────── */
.screen { display: flex; width: 100%; height: 100vh; }
.screen--hidden { display: none !important; }

/* ── Login ──────────────────────────────────────────────── */
#login-screen {
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #f0ede8 0%, #e8d5ff 100%);
}

.login-box {
  background: var(--surface);
  border-radius: 20px;
  padding: 44px 40px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 8px 40px rgba(0,0,0,.10);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.login-logo {
  font-size: 2.5rem;
  text-align: center;
  line-height: 1;
}

.login-box h1 {
  font-size: 1.5rem;
  font-weight: 700;
  text-align: center;
}

.login-sub {
  font-size: .83rem;
  color: var(--text-muted);
  text-align: center;
}

.login-hint {
  font-size: .78rem;
  color: var(--text-muted);
  text-align: center;
}

.login-hint code {
  font-family: monospace;
  background: var(--bg);
  padding: 1px 5px;
  border-radius: 4px;
}

#login-error {
  color: var(--danger);
  min-height: 1em;
}

/* ── Sidebar ─────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 20px 0;
  overflow-y: auto;
}

.sidebar__logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: .95rem;
  padding: 0 20px 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}

.sidebar__logo span { color: var(--text-primary); }

.sidebar__nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 10px;
  flex: 1;
}

.nav-item {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-size: .84rem;
  font-family: var(--font);
  color: var(--text-secondary);
  cursor: pointer;
  transition: background .15s, color .15s;
}

.nav-item:hover { background: var(--bg); color: var(--text-primary); }
.nav-item--active { background: #ede9ff; color: var(--accent); font-weight: 600; }

.sidebar__footer {
  padding: 16px 12px 0;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ── Dashboard main ─────────────────────────────────────── */
.dashboard-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ── Topbar ─────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.topbar__title {
  font-size: 1.05rem;
  font-weight: 600;
}

.topbar__actions { display: flex; gap: 10px; }

/* ── Toast ──────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 28px;
  right: 28px;
  background: var(--text-primary);
  color: #fff;
  font-size: .83rem;
  font-weight: 500;
  padding: 10px 20px;
  border-radius: 999px;
  box-shadow: 0 4px 20px rgba(0,0,0,.2);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .25s, transform .25s;
  pointer-events: none;
  z-index: 9999;
}

.toast--visible {
  opacity: 1;
  transform: translateY(0);
}

/* ── Panels ─────────────────────────────────────────────── */
.panels {
  flex: 1;
  overflow-y: auto;
  padding: 28px;
}

.panel { display: none; }
.panel--active { display: block; }

.panel__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.panel__sub-heading {
  font-size: .9rem;
  font-weight: 600;
  margin-bottom: 14px;
  margin-top: 24px;
  color: var(--text-secondary);
}

.panel__sub-heading:first-child { margin-top: 0; }

/* ── Form elements ──────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group--full { grid-column: 1 / -1; }

.field-label {
  font-size: .78rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: .06em;
}

.field-input,
.field-textarea {
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-size: .88rem;
  font-family: var(--font);
  color: var(--text-primary);
  background: var(--surface);
  transition: border-color .15s, box-shadow .15s;
  resize: vertical;
  width: 100%;
}

.field-input:focus,
.field-textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(108,99,255,.15);
}

.field-input--sm { max-width: 90px; }

.field-hint {
  font-size: .75rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.field-hint code {
  font-family: monospace;
  background: var(--bg);
  padding: 0 4px;
  border-radius: 3px;
}

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: none;
  border-radius: var(--radius-sm);
  padding: 9px 16px;
  font-size: .84rem;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: background .15s, color .15s, box-shadow .15s;
  white-space: nowrap;
}

.btn--primary {
  background: var(--accent);
  color: #fff;
}
.btn--primary:hover { background: var(--accent-dark); }

.btn--outline {
  background: transparent;
  border: 1.5px solid var(--border);
  color: var(--text-secondary);
}
.btn--outline:hover { background: var(--bg); border-color: #ccc; }

.btn--ghost {
  background: transparent;
  color: var(--text-secondary);
}
.btn--ghost:hover { background: var(--bg); }

.btn--sm { padding: 6px 12px; font-size: .78rem; }
.btn--full { width: 100%; justify-content: center; }

/* ── Scrollbar ───────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #ccc; border-radius: 3px; }

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 680px) {
  body { overflow: auto; }
  .screen { flex-direction: column; height: auto; }
  .sidebar { width: 100%; border-right: none; border-bottom: 1px solid var(--border); }
  .sidebar__nav { flex-direction: row; flex-wrap: wrap; }
  .dashboard-main { overflow: visible; }
  .panels { overflow: visible; }
  .panel__grid { grid-template-columns: 1fr; }
  .form-group--full { grid-column: 1; }
}
