/* ============================================================
   SOUITRO ADMIN — design tokens & shared layout
   Same brand palette/type as the public site, translated into
   functional chrome (sidebar, tables, forms) instead of the
   marketing site's canvas/parallax treatment.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Syne:wght@600;700;800&family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;0,9..40,600;1,9..40,400&display=swap');

:root {
  /* brand */
  --navy: #03045E;
  --navy-mid: #023E8A;
  --navy-light: #0077B6;
  --cyan: #00B4D8;
  --cyan-light: #90E0EF;
  --cyan-pale: #CAF0F8;

  /* surface */
  --bg: #04051f;
  --panel: #0a0c33;
  --panel-raised: #10133f;
  --border: rgba(0, 180, 216, 0.16);
  --border-hover: rgba(0, 180, 216, 0.35);

  /* text */
  --text: #f0f8ff;
  --text-muted: rgba(240, 248, 255, 0.60);
  --text-faint: rgba(240, 248, 255, 0.34);

  /* status */
  --ok: #2dd4bf;
  --ok-bg: rgba(45, 212, 191, 0.12);
  --warn: #fbbf24;
  --warn-bg: rgba(251, 191, 36, 0.12);
  --danger: #f87171;
  --danger-bg: rgba(248, 113, 113, 0.12);

  --radius-sm: 8px;
  --radius: 12px;
  --sidebar-w: 232px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

h1, h2, h3, .brand-mark {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0;
}

a { color: var(--cyan-light); text-decoration: none; }
a:hover { color: var(--cyan-pale); }

button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }

:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}

/* ---------- app shell ---------- */

.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--panel);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar .brand-mark {
  font-size: 1.1rem;
  color: var(--text);
  padding: 6px 10px 22px;
  display: block;
}
.sidebar .brand-mark span { color: var(--cyan); }

.nav-group { display: flex; flex-direction: column; gap: 2px; flex: 1; }

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.92rem;
  font-weight: 500;
  transition: background 0.15s ease, color 0.15s ease;
}
.nav-link:hover { background: rgba(0, 180, 216, 0.08); color: var(--text); }
.nav-link.active { background: rgba(0, 180, 216, 0.14); color: var(--cyan-light); }
.nav-link .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: 0.5; }

.sidebar-foot {
  border-top: 1px solid var(--border);
  padding-top: 12px;
  margin-top: 12px;
}
.sidebar-user { padding: 6px 10px 10px; font-size: 0.82rem; color: var(--text-faint); }
.sidebar-user strong { color: var(--text-muted); display: block; font-weight: 500; }

.logout-btn {
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  color: var(--text-muted);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.92rem;
}
.logout-btn:hover { background: rgba(248, 113, 113, 0.1); color: var(--danger); }

.main {
  flex: 1;
  min-width: 0;
  padding: 32px 40px 60px;
}

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.page-head h1 { font-size: 1.5rem; }
.page-head p { color: var(--text-muted); margin: 4px 0 0; font-size: 0.92rem; }

/* ---------- buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  transition: filter 0.15s ease, background 0.15s ease;
}
.btn-primary { background: var(--cyan); color: var(--navy); }
.btn-primary:hover { filter: brightness(1.08); }
.btn-secondary { background: var(--panel-raised); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { border-color: var(--border-hover); }
.btn-ghost { background: none; color: var(--text-muted); }
.btn-ghost:hover { color: var(--text); }
.btn-danger { background: var(--danger-bg); color: var(--danger); }
.btn-danger:hover { filter: brightness(1.15); }
.btn-sm { padding: 6px 11px; font-size: 0.8rem; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

/* ---------- cards / panels ---------- */

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 28px;
}
.stat-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
}
.stat-card .num { font-family: 'Syne', sans-serif; font-size: 1.9rem; font-weight: 700; }
.stat-card .label { color: var(--text-muted); font-size: 0.82rem; margin-top: 4px; }

/* ---------- table ---------- */

.table-wrap {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
table { width: 100%; border-collapse: collapse; }
thead th {
  text-align: left;
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-faint);
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
tbody td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 0.88rem;
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: rgba(0, 180, 216, 0.04); }
td.name-cell { font-weight: 600; }
td.muted { color: var(--text-muted); }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }

.empty-state {
  padding: 48px 20px;
  text-align: center;
  color: var(--text-muted);
}
.empty-state h3 { margin-bottom: 6px; color: var(--text); }

/* ---------- badges/pills ---------- */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 600;
}
.pill-published { background: var(--ok-bg); color: var(--ok); }
.pill-draft { background: var(--warn-bg); color: var(--warn); }
.pill-featured { background: rgba(0, 180, 216, 0.14); color: var(--cyan-light); }

/* ---------- forms / modal ---------- */

.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.field input[type="text"],
.field input[type="number"],
.field input[type="url"],
.field input[type="date"],
.field input[type="email"],
.field input[type="password"],
.field textarea,
.field select {
  width: 100%;
  background: var(--panel-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  color: var(--text);
}
.field textarea { min-height: 90px; resize: vertical; }
.field input:focus, .field textarea:focus, .field select:focus {
  border-color: var(--cyan);
}
.field-hint { font-size: 0.76rem; color: var(--text-faint); margin-top: 5px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.checkbox-row { display: flex; align-items: center; gap: 8px; }
.checkbox-row label { margin: 0; }

.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(2, 3, 20, 0.72);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 40px 20px;
  overflow-y: auto;
  z-index: 100;
}
.modal {
  background: var(--panel);
  border: 1px solid var(--border-hover);
  border-radius: var(--radius);
  width: 100%;
  max-width: 560px;
  padding: 24px;
}
.modal-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 18px;
}
.modal-close { background: none; border: none; color: var(--text-muted); font-size: 1.2rem; cursor: pointer; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }

/* ---------- toast ---------- */

#toast-root {
  position: fixed;
  bottom: 24px; right: 24px;
  display: flex; flex-direction: column; gap: 10px;
  z-index: 200;
}
.toast {
  background: var(--panel-raised);
  border: 1px solid var(--border-hover);
  border-left: 3px solid var(--cyan);
  color: var(--text);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.86rem;
  min-width: 220px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.35);
  animation: toast-in 0.18s ease;
}
.toast.error { border-left-color: var(--danger); }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- login page ---------- */

.login-screen {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(560px 400px at 15% 10%, rgba(0,180,216,0.10), transparent 60%),
    radial-gradient(500px 380px at 85% 90%, rgba(3,4,94,0.35), transparent 60%),
    var(--bg);
  padding: 20px;
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 34px 30px;
}
.login-card .brand-mark {
  font-size: 1.3rem;
  margin-bottom: 4px;
}
.login-card .brand-mark span { color: var(--cyan); }
.login-sub { color: var(--text-muted); font-size: 0.86rem; margin: 0 0 26px; }
.login-error {
  background: var(--danger-bg); color: var(--danger);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 0.82rem;
  margin-bottom: 16px;
  display: none;
}
.login-error.show { display: block; }
.login-foot { margin-top: 18px; text-align: center; font-size: 0.82rem; }
.login-foot a { color: var(--text-faint); }
.login-foot a:hover { color: var(--cyan-light); }

/* ---------- responsive ---------- */

@media (max-width: 860px) {
  .app-shell { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; flex-direction: row; align-items: center; padding: 12px 16px; overflow-x: auto; }
  .sidebar .brand-mark { padding: 0 16px 0 0; white-space: nowrap; }
  .nav-group { flex-direction: row; }
  .nav-link { white-space: nowrap; }
  .sidebar-foot { display: none; }
  .main { padding: 20px; }
  .field-row { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .toast { animation: none; }
}

/* ---------- media library ---------- */

.upload-bar {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.upload-bar select {
  background: var(--panel-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  color: var(--text);
}

.category-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.category-tab {
  padding: 6px 13px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text-muted);
  font-size: 0.8rem;
  cursor: pointer;
}
.category-tab.active {
  background: rgba(0, 180, 216, 0.14);
  color: var(--cyan-light);
  border-color: var(--border-hover);
}

.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
}
.media-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.media-thumb {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  display: block;
  background: var(--panel-raised);
}
.media-meta { padding: 10px 12px 4px; }
.media-meta .fname {
  font-size: 0.78rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.media-meta .fsize { font-size: 0.72rem; color: var(--text-faint); margin-top: 2px; }
.media-actions { display: flex; gap: 6px; padding: 8px 12px 12px; }
.media-actions .btn { flex: 1; }

/* ---------- dynamic image rows (Projects form) ---------- */

.image-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}
.image-row input { flex: 1; }
.image-row input.alt-input { flex: 0 0 140px; }
.image-row .remove-row-btn {
  flex: 0 0 auto;
  background: var(--danger-bg);
  color: var(--danger);
  border: none;
  border-radius: var(--radius-sm);
  width: 34px;
  height: 34px;
  cursor: pointer;
  font-size: 0.9rem;
}
.image-row .remove-row-btn:hover { filter: brightness(1.15); }
