/* ============================================================
   Trivio CMS - Admin Panel Stylesheet
   ============================================================ */
:root {
  --bg: #0c0e1a;
  --sidebar-bg: #070910;
  --surface: #111425;
  --surface2: #1a1e30;
  --border: rgba(255,255,255,0.07);
  --primary: #3d7fff;
  --accent: #00e5b0;
  --danger: #ff4d6a;
  --warning: #fbbf24;
  --success: #00e5b0;
  --text: #e8ecff;
  --muted: #6b73a0;
  --sidebar-w: 260px;
  --header-h: 64px;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { background: var(--bg); color: var(--text); font-family: 'DM Sans', sans-serif; font-size: 14px; line-height: 1.6; }

/* ===== LAYOUT ===== */
.admin-wrapper { display: flex; min-height: 100vh; }

/* ===== SIDEBAR ===== */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  position: fixed;
  top: 0; left: 0; bottom: 0;
  overflow-y: auto;
  z-index: 50;
  display: flex;
  flex-direction: column;
  transition: transform 0.3s;
}
.sidebar-logo {
  padding: 24px 24px 20px;
  border-bottom: 1px solid var(--border);
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: 1.3rem;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.sidebar-logo .dot { color: var(--primary); }
.sidebar-logo .badge { font-size: 0.65rem; background: rgba(61,127,255,0.15); color: #90b8ff; border-radius: 4px; padding: 2px 7px; font-weight: 600; letter-spacing: 0.05em; }
.sidebar-nav { padding: 16px 12px; flex: 1; }
.nav-section-label { font-size: 0.68rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); padding: 12px 12px 8px; }
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 8px;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.18s;
  margin-bottom: 2px;
}
.sidebar-nav a:hover { background: var(--surface2); color: var(--text); }
.sidebar-nav a.active { background: rgba(61,127,255,0.15); color: var(--primary); }
.sidebar-nav a .icon { font-size: 1rem; width: 20px; text-align: center; flex-shrink: 0; }
.sidebar-nav a .count { margin-left: auto; background: var(--danger); color: #fff; font-size: 0.7rem; padding: 1px 7px; border-radius: 100px; font-weight: 700; }
.sidebar-footer { padding: 16px; border-top: 1px solid var(--border); }
.sidebar-footer a { display: flex; align-items: center; gap: 8px; color: var(--muted); text-decoration: none; font-size: 0.85rem; padding: 8px 12px; border-radius: 8px; transition: all 0.2s; }
.sidebar-footer a:hover { color: var(--text); background: var(--surface2); }

/* ===== MAIN AREA ===== */
.admin-main {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ===== TOP BAR ===== */
.admin-topbar {
  height: var(--header-h);
  background: var(--sidebar-bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(16px);
}
.topbar-title { font-family: 'Syne', sans-serif; font-size: 1rem; font-weight: 700; }
.topbar-right { display: flex; align-items: center; gap: 16px; }
.topbar-right a { color: var(--muted); text-decoration: none; font-size: 0.85rem; display: flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 8px; border: 1px solid var(--border); transition: all 0.2s; }
.topbar-right a:hover { color: var(--text); border-color: rgba(255,255,255,0.15); }
.admin-avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--primary); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.85rem; color: #fff; }

/* ===== CONTENT ===== */
.admin-content { padding: 32px; flex: 1; }
.page-title { font-family: 'Syne', sans-serif; font-size: 1.5rem; font-weight: 700; margin-bottom: 6px; }
.page-subtitle { color: var(--muted); font-size: 0.88rem; margin-bottom: 28px; }

/* ===== STAT CARDS ===== */
.stat-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 28px; }
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 22px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: border-color 0.2s;
}
.stat-card:hover { border-color: rgba(61,127,255,0.25); }
.stat-card-icon { width: 44px; height: 44px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 1.3rem; flex-shrink: 0; }
.stat-card-num { font-family: 'Syne', sans-serif; font-size: 1.7rem; font-weight: 800; line-height: 1; }
.stat-card-label { font-size: 0.8rem; color: var(--muted); margin-top: 4px; }

/* ===== TABLE ===== */
.table-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.table-header { padding: 18px 24px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.table-header h3 { font-family: 'Syne', sans-serif; font-size: 1rem; font-weight: 700; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { padding: 12px 20px; text-align: left; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; color: var(--muted); border-bottom: 1px solid var(--border); background: var(--sidebar-bg); }
.data-table td { padding: 14px 20px; border-bottom: 1px solid var(--border); font-size: 0.875rem; vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr { transition: background 0.15s; }
.data-table tbody tr:hover { background: var(--surface2); }
.table-actions { display: flex; gap: 8px; }

/* ===== BADGES ===== */
.badge { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 100px; font-size: 0.72rem; font-weight: 700; white-space: nowrap; }
.badge-active, .badge-published, .badge-completed { background: rgba(0,229,176,0.1); color: var(--success); }
.badge-inactive, .badge-draft { background: rgba(255,255,255,0.06); color: var(--muted); }
.badge-new { background: rgba(61,127,255,0.15); color: #90b8ff; }
.badge-reviewing { background: rgba(251,191,36,0.1); color: var(--warning); }
.badge-danger { background: rgba(255,77,106,0.1); color: var(--danger); }

/* ===== BUTTONS ===== */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: 8px; font-size: 0.85rem; font-weight: 600; cursor: pointer; border: none; font-family: inherit; text-decoration: none; transition: all 0.2s; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: #5590ff; }
.btn-danger { background: rgba(255,77,106,0.15); color: var(--danger); border: 1px solid rgba(255,77,106,0.3); }
.btn-danger:hover { background: rgba(255,77,106,0.25); }
.btn-secondary { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { border-color: rgba(255,255,255,0.15); }
.btn-success { background: rgba(0,229,176,0.1); color: var(--success); border: 1px solid rgba(0,229,176,0.3); }
.btn-sm { padding: 5px 12px; font-size: 0.78rem; }
.btn-icon { width: 32px; height: 32px; padding: 0; justify-content: center; }
.btn-full { width: 100%; justify-content: center; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ===== FORM ===== */
.admin-form { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 28px; }
.admin-form + .admin-form { margin-top: 20px; }
.admin-form h3 { font-family: 'Syne', sans-serif; font-size: 1rem; font-weight: 700; margin-bottom: 20px; padding-bottom: 14px; border-bottom: 1px solid var(--border); }
.form-group { margin-bottom: 18px; }
.form-label { display: block; font-size: 0.82rem; font-weight: 600; margin-bottom: 6px; color: var(--text); }
.form-label .req { color: var(--primary); }
.form-control {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.875rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(61,127,255,0.1); }
.form-control::placeholder { color: var(--muted); }
textarea.form-control { resize: vertical; min-height: 100px; }
select.form-control { cursor: pointer; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-hint { font-size: 0.78rem; color: var(--muted); margin-top: 5px; }
.form-actions { display: flex; gap: 12px; align-items: center; padding-top: 20px; border-top: 1px solid var(--border); margin-top: 20px; }

/* ===== SEARCH ===== */
.search-bar { position: relative; }
.search-bar input { background: var(--surface2); border: 1px solid var(--border); border-radius: 8px; padding: 8px 14px 8px 36px; color: var(--text); font-size: 0.85rem; outline: none; width: 240px; font-family: inherit; transition: border-color 0.2s; }
.search-bar input:focus { border-color: var(--primary); }
.search-bar::before { content: '🔍'; position: absolute; left: 12px; top: 50%; transform: translateY(-50%); font-size: 0.8rem; }

/* ===== SWITCH TOGGLE ===== */
.toggle { position: relative; display: inline-block; width: 40px; height: 22px; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider { position: absolute; inset: 0; background: var(--surface2); border: 1px solid var(--border); border-radius: 100px; cursor: pointer; transition: 0.3s; }
.toggle-slider::before { content: ''; position: absolute; width: 16px; height: 16px; background: var(--muted); border-radius: 50%; top: 2px; left: 2px; transition: 0.3s; }
.toggle input:checked + .toggle-slider { background: rgba(0,229,176,0.15); border-color: var(--success); }
.toggle input:checked + .toggle-slider::before { background: var(--success); transform: translateX(18px); }

/* ===== ALERTS ===== */
.alert { padding: 14px 18px; border-radius: 8px; font-size: 0.875rem; margin-bottom: 16px; display: flex; align-items: center; gap: 10px; }
.alert-success { background: rgba(0,229,176,0.08); border: 1px solid rgba(0,229,176,0.2); color: var(--success); }
.alert-danger  { background: rgba(255,77,106,0.08); border: 1px solid rgba(255,77,106,0.2); color: var(--danger); }
.alert-info    { background: rgba(61,127,255,0.08); border: 1px solid rgba(61,127,255,0.2); color: #90b8ff; }
.alert-warning { background: rgba(251,191,36,0.08); border: 1px solid rgba(251,191,36,0.2); color: var(--warning); }

/* ===== MODAL ===== */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.7); z-index: 200; display: flex; align-items: center; justify-content: center; opacity: 0; pointer-events: none; transition: opacity 0.25s; }
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; width: 90%; max-width: 560px; max-height: 90vh; overflow-y: auto; transform: translateY(20px); transition: transform 0.25s; }
.modal-overlay.open .modal { transform: translateY(0); }
.modal-header { padding: 22px 24px 18px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.modal-header h3 { font-family: 'Syne', sans-serif; font-weight: 700; font-size: 1rem; }
.modal-close { background: none; border: none; color: var(--muted); font-size: 1.2rem; cursor: pointer; transition: color 0.2s; }
.modal-close:hover { color: var(--text); }
.modal-body { padding: 24px; }
.modal-footer { padding: 18px 24px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }

/* ===== MISC ===== */
.divider { border: none; border-top: 1px solid var(--border); margin: 24px 0; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--muted); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.mt-1{margin-top:8px} .mt-2{margin-top:16px} .mt-3{margin-top:24px} .mt-4{margin-top:32px}
.mb-1{margin-bottom:8px} .mb-2{margin-bottom:16px} .mb-3{margin-bottom:24px}
.gap-2{gap:16px} .flex{display:flex} .items-center{align-items:center} .justify-between{justify-content:space-between}
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 200px; }
.color-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; }
.empty-state { padding: 60px 24px; text-align: center; color: var(--muted); }
.empty-state .icon { font-size: 3rem; margin-bottom: 12px; }

/* ===== TABS ===== */
.tabs { display: flex; gap: 0; border-bottom: 1px solid var(--border); margin-bottom: 24px; }
.tab-btn { padding: 10px 20px; border: none; background: none; color: var(--muted); font-family: inherit; font-size: 0.875rem; font-weight: 600; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; transition: all 0.2s; }
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .admin-main { margin-left: 0; }
  .stat-cards { grid-template-columns: 1fr 1fr; }
  .form-row { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .stat-cards { grid-template-columns: 1fr; }
  .admin-content { padding: 20px 16px; }
}

/* Drag sort */
.drag-handle { cursor: grab; color: var(--muted); }
.drag-handle:active { cursor: grabbing; }
.sortable-ghost { opacity: 0.4; }
