/* ================================================================
   Admin Panel — CSS
   Design: dark sidebar + light content area
   Colors match main site palette (terracotta accent, slate blue)
================================================================ */

/* ── Reset & base ───────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --sidebar-w:    240px;
  --header-h:     56px;

  --c-sidebar:    #1a1f2e;
  --c-sidebar-2:  #242b3e;
  --c-sidebar-t:  #8fa0bc;
  --c-sidebar-ta: #ffffff;
  --c-accent:     #E87040;
  --c-accent-h:   #d4602e;
  --c-bg:         #f4f5f7;
  --c-card:       #ffffff;
  --c-border:     #e2e4e9;
  --c-text:       #2c3e50;
  --c-text-2:     #6b7280;
  --c-success:    #22c55e;
  --c-warning:    #f59e0b;
  --c-danger:     #ef4444;
  --c-info:       #3b82f6;

  --radius:       8px;
  --radius-sm:    4px;
  --shadow:       0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md:    0 4px 12px rgba(0,0,0,.10);

  --font:         'Inter', system-ui, -apple-system, sans-serif;
  --font-mono:    'JetBrains Mono', 'Fira Code', monospace;
}

html, body { height: 100%; }
body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--c-text);
  background: var(--c-bg);
  display: flex;
}

a { color: var(--c-accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Layout ─────────────────────────────────────────────────── */
.layout {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

/* ── Sidebar ─────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--c-sidebar);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar__logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 20px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  text-decoration: none;
}
.sidebar__logo-mark {
  width: 32px; height: 32px; border-radius: 8px;
  background: var(--c-accent);
  display: grid; place-items: center;
  font-weight: 800; font-size: 16px; color: #fff;
}
.sidebar__logo-text { color: #fff; font-weight: 700; font-size: 15px; line-height: 1.2; }
.sidebar__logo-sub  { color: var(--c-sidebar-t); font-size: 11px; }

.nav { flex: 1; padding: 12px 0; }
.nav__section { padding: 8px 20px 4px; font-size: 10px; font-weight: 600;
  letter-spacing: .08em; text-transform: uppercase; color: var(--c-sidebar-t); }
.nav__link {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 20px; color: var(--c-sidebar-t);
  font-size: 13.5px; font-weight: 500; border-radius: 0;
  transition: background .15s, color .15s;
  text-decoration: none;
}
.nav__link:hover { background: var(--c-sidebar-2); color: var(--c-sidebar-ta); text-decoration: none; }
.nav__link--active { background: var(--c-sidebar-2); color: #fff; }
.nav__link--active .nav__ico { color: var(--c-accent); }
.nav__ico { width: 18px; height: 18px; flex-shrink: 0; opacity: .8; }
.nav__link--active .nav__ico { opacity: 1; }

.sidebar__footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,.06);
  color: var(--c-sidebar-t); font-size: 12px;
}
.sidebar__footer a { color: var(--c-sidebar-t); }
.sidebar__footer a:hover { color: #fff; }

/* ── Main content ────────────────────────────────────────────── */
.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: var(--header-h);
  background: var(--c-card);
  border-bottom: 1px solid var(--c-border);
  display: flex; align-items: center;
  padding: 0 28px; gap: 12px;
  position: sticky; top: 0; z-index: 10;
}
.topbar__title { font-size: 16px; font-weight: 600; flex: 1; }
.topbar__actions { display: flex; align-items: center; gap: 8px; }

.content { padding: 28px; flex: 1; }

/* ── Page header ─────────────────────────────────────────────── */
.page-head { margin-bottom: 24px; display: flex; align-items: flex-start; gap: 16px; }
.page-head__copy { flex: 1; }
.page-head h1 { font-size: 22px; font-weight: 700; margin-bottom: 4px; }
.page-head p  { color: var(--c-text-2); font-size: 14px; }
.page-head__actions { display: flex; gap: 8px; flex-shrink: 0; align-self: center; }

/* ── Cards ───────────────────────────────────────────────────── */
.card {
  background: var(--c-card);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card__head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--c-border);
  display: flex; align-items: center; gap: 8px;
}
.card__title { font-size: 15px; font-weight: 600; flex: 1; }
.card__body  { padding: 20px; }
.card__foot  { padding: 12px 20px; border-top: 1px solid var(--c-border);
  display: flex; align-items: center; gap: 8px; justify-content: flex-end; }

/* ── Stats row ───────────────────────────────────────────────── */
.stats-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.stat-card {
  background: var(--c-card); border: 1px solid var(--c-border);
  border-radius: var(--radius); padding: 20px;
  display: flex; flex-direction: column; gap: 4px;
}
.stat-card__label { font-size: 12px; font-weight: 600; color: var(--c-text-2);
  text-transform: uppercase; letter-spacing: .05em; }
.stat-card__value { font-size: 28px; font-weight: 700; color: var(--c-text); }
.stat-card__sub   { font-size: 12px; color: var(--c-text-2); }

/* ── Tables ──────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
thead th {
  text-align: left; padding: 10px 14px;
  background: var(--c-bg); border-bottom: 1px solid var(--c-border);
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .05em; color: var(--c-text-2);
}
tbody td { padding: 10px 14px; border-bottom: 1px solid var(--c-border); }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: #fafbfc; }

/* ── Forms ───────────────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }
.form-row    { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
label        { display: block; font-size: 13px; font-weight: 500; margin-bottom: 5px; color: var(--c-text); }
label .hint  { font-weight: 400; color: var(--c-text-2); margin-left: 4px; }

input[type="text"], input[type="url"], input[type="email"],
input[type="number"], input[type="password"], input[type="tel"],
textarea, select {
  width: 100%; padding: 8px 12px;
  border: 1px solid var(--c-border); border-radius: var(--radius-sm);
  font-family: var(--font); font-size: 14px; color: var(--c-text);
  background: #fff; outline: none; transition: border-color .15s;
}
input:focus, textarea:focus, select:focus { border-color: var(--c-accent); }
textarea { resize: vertical; min-height: 80px; }
.char-count { font-size: 11px; color: var(--c-text-2); text-align: right; margin-top: 3px; }

/* Toggle switch */
.toggle { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.toggle__input { width: 40px; height: 22px; appearance: none; -webkit-appearance: none;
  background: #c7cdd6; border-radius: 11px; position: relative; cursor: pointer; transition: background .2s; }
.toggle__input:checked { background: var(--c-accent); }
.toggle__input::after  { content: ''; position: absolute; width: 18px; height: 18px;
  border-radius: 50%; background: #fff; top: 2px; left: 2px; transition: left .2s;
  box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.toggle__input:checked::after { left: 20px; }
.toggle__label { font-size: 14px; }

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: var(--radius-sm);
  font-family: var(--font); font-size: 13.5px; font-weight: 500;
  border: 1px solid transparent; cursor: pointer;
  transition: background .15s, opacity .15s;
  text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.btn--primary  { background: var(--c-accent); color: #fff; }
.btn--primary:hover { background: var(--c-accent-h); }
.btn--secondary { background: #1a1f2e; color: #fff; }
.btn--secondary:hover { background: #242b3e; }
.btn--ghost    { background: transparent; border-color: var(--c-border); color: var(--c-text); }
.btn--ghost:hover { background: var(--c-bg); }
.btn--danger   { background: var(--c-danger); color: #fff; }
.btn--danger:hover { background: #dc2626; }
.btn--lg { padding: 10px 20px; font-size: 15px; }
.btn--sm { padding: 5px 10px; font-size: 12px; }
.btn--full { width: 100%; justify-content: center; }

/* ── Deploy button ───────────────────────────────────────────── */
.deploy-btn {
  background: var(--c-accent); color: #fff;
  padding: 12px 28px; font-size: 15px; font-weight: 600;
  border-radius: var(--radius); border: none; cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px;
  box-shadow: 0 2px 8px rgba(232,112,64,.35);
  transition: background .15s, transform .1s;
}
.deploy-btn:hover  { background: var(--c-accent-h); }
.deploy-btn:active { transform: scale(.98); }
.deploy-btn:disabled { opacity: .6; cursor: not-allowed; transform: none; }

/* ── Badges ──────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center;
  padding: 3px 8px; border-radius: 20px;
  font-size: 11px; font-weight: 600; letter-spacing: .03em;
}
.badge--success { background: #dcfce7; color: #15803d; }
.badge--warning { background: #fef9c3; color: #854d0e; }
.badge--danger  { background: #fee2e2; color: #991b1b; }
.badge--neutral { background: #f1f5f9; color: #64748b; }
.badge--info    { background: #dbeafe; color: #1d4ed8; }

/* ── Spinner ─────────────────────────────────────────────────── */
.spinner {
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.35);
  border-top-color: #fff;
  animation: spin .6s linear infinite; display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Toast notifications ─────────────────────────────────────── */
.toast {
  position: fixed; bottom: 24px; right: 24px; z-index: 9999;
  display: flex; align-items: center; gap: 10px;
  max-width: 380px; padding: 12px 16px;
  background: #fff; border-radius: var(--radius);
  box-shadow: var(--shadow-md); border-left: 4px solid var(--c-text-2);
  opacity: 0; transform: translateY(8px);
  transition: opacity .25s, transform .25s;
  pointer-events: none;
}
.toast--visible { opacity: 1; transform: translateY(0); pointer-events: auto; }
.toast--success { border-left-color: var(--c-success); }
.toast--error   { border-left-color: var(--c-danger); }
.toast--info    { border-left-color: var(--c-info); }
.toast__msg  { flex: 1; font-size: 14px; }
.toast__close { background: none; border: none; font-size: 18px; cursor: pointer;
  color: var(--c-text-2); padding: 0 0 0 4px; line-height: 1; }

/* ── Modal ───────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 9000;
  display: grid; place-items: center;
}
.modal {
  background: #fff; border-radius: var(--radius); padding: 28px;
  max-width: 400px; width: 90%; box-shadow: var(--shadow-md);
}
.modal__msg     { font-size: 15px; margin-bottom: 20px; line-height: 1.5; }
.modal__actions { display: flex; justify-content: flex-end; gap: 8px; }

/* ── Deploy status block ─────────────────────────────────────── */
.deploy-status {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px; background: var(--c-bg);
  border: 1px solid var(--c-border); border-radius: var(--radius);
  font-size: 13px;
}
.deploy-status__label  { font-weight: 600; color: var(--c-text-2); }
.deploy-status__detail { color: var(--c-text-2); margin-left: auto; font-family: var(--font-mono); font-size: 12px; }

/* ── Code / monospace ────────────────────────────────────────── */
code, pre {
  font-family: var(--font-mono); font-size: 12.5px;
  background: #f8f9fa; border-radius: var(--radius-sm);
  padding: 2px 5px; color: #374151;
}
pre { padding: 12px; overflow-x: auto; }

/* ── Quick nav grid (dashboard) ─────────────────────────────── */
.quick-nav { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 24px; }
.quick-card {
  background: var(--c-card); border: 1px solid var(--c-border); border-radius: var(--radius);
  padding: 18px 20px; display: flex; flex-direction: column; gap: 6px;
  text-decoration: none; transition: box-shadow .15s, border-color .15s;
}
.quick-card:hover { box-shadow: var(--shadow-md); border-color: var(--c-accent); text-decoration: none; }
.quick-card__ico  { font-size: 22px; line-height: 1; }
.quick-card__t    { font-weight: 600; font-size: 14px; color: var(--c-text); }
.quick-card__sub  { font-size: 12px; color: var(--c-text-2); }

/* ── Empty state ─────────────────────────────────────────────── */
.empty { text-align: center; padding: 48px 24px; color: var(--c-text-2); }
.empty__ico { font-size: 36px; margin-bottom: 12px; }
.empty__t   { font-size: 16px; font-weight: 600; color: var(--c-text); margin-bottom: 6px; }

/* ── Alert banner ────────────────────────────────────────────── */
.alert {
  padding: 12px 16px; border-radius: var(--radius-sm);
  display: flex; align-items: flex-start; gap: 10px; font-size: 14px;
  margin-bottom: 16px;
}
.alert--info    { background: #eff6ff; border-left: 4px solid var(--c-info); color: #1d4ed8; }
.alert--warning { background: #fffbeb; border-left: 4px solid var(--c-warning); color: #92400e; }
.alert--danger  { background: #fef2f2; border-left: 4px solid var(--c-danger); color: #991b1b; }

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 900px) {
  .sidebar { width: 64px; }
  .sidebar__logo-text, .sidebar__logo-sub, .nav__link span,
  .nav__section, .sidebar__footer { display: none; }
  .nav__link { justify-content: center; padding: 10px; }
  .stats-row { grid-template-columns: 1fr 1fr; }
  .quick-nav { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 600px) {
  .stats-row { grid-template-columns: 1fr; }
  .quick-nav { grid-template-columns: 1fr; }
  .form-row  { grid-template-columns: 1fr; }
}
