@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* ── ROOT ── */
:root {
  --bg:       #0d0d0f;
  --bg2:      #141417;
  --bg3:      #1a1a1f;
  --bord:     rgba(255,255,255,.08);
  --bord2:    rgba(255,255,255,.14);
  --text:     #f0f0f5;
  --muted:    #8b8b9e;
  --acc:      #e8342a;
  --acc2:     #ff6b35;
  --success:  #22c55e;
  --warn:     #f59e0b;
  --danger:   #ef4444;
  --radius:   12px;
  --radius-s: 8px;
  --shadow:   0 4px 24px rgba(0,0,0,.5);
  --sidebar:  240px;
  --font:     'Inter', sans-serif;
  --transition: .2s ease;
}

/* ── RESET ── */
*,*::before,*::after { box-sizing:border-box; margin:0; padding:0; }
html { font-size:15px; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
}

a { color: var(--acc); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font-family: inherit; }
img { max-width:100%; }

/* ── SIDEBAR ── */
.admin-sidebar {
  width: var(--sidebar);
  background: var(--bg2);
  border-right: 1px solid var(--bord);
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0; top: 0; bottom: 0;
  z-index: 100;
  overflow-y: auto;
  transition: transform var(--transition);
}
.sidebar-logo {
  padding: 1.5rem 1.25rem 1rem;
  border-bottom: 1px solid var(--bord);
  display: flex; align-items: center; gap: .75rem;
}
.sidebar-logo .logo-icon {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--acc), var(--acc2));
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; color: #fff; font-weight: 700;
  flex-shrink: 0;
}
.sidebar-logo .logo-text { font-size: .85rem; font-weight: 600; color: var(--text); line-height: 1.3; }
.sidebar-logo .logo-sub  { font-size: .7rem; color: var(--muted); }
.sidebar-nav { padding: 1rem 0; flex: 1; }
.nav-label {
  padding: .4rem 1.25rem .2rem;
  font-size: .65rem; font-weight: 600;
  letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted);
}
.nav-item {
  display: flex; align-items: center; gap: .75rem;
  padding: .65rem 1.25rem;
  color: var(--muted);
  font-size: .875rem; font-weight: 500;
  border-left: 3px solid transparent;
  transition: all var(--transition);
  cursor: pointer; text-decoration: none;
}
.nav-item:hover { color: var(--text); background: rgba(255,255,255,.04); text-decoration: none; }
.nav-item.active {
  color: var(--acc);
  background: rgba(232,52,42,.08);
  border-left-color: var(--acc);
}
.nav-item i { font-size: 1.1rem; width: 20px; flex-shrink: 0; }
.nav-badge {
  margin-left: auto;
  background: var(--acc);
  color: #fff; font-size: .65rem; font-weight: 700;
  padding: .1rem .4rem; border-radius: 20px;
  min-width: 18px; text-align: center;
}
.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--bord);
  font-size: .78rem; color: var(--muted);
}
.sidebar-footer a { color: var(--muted); }
.sidebar-footer a:hover { color: var(--danger); }

/* ── MAIN CONTENT ── */
.admin-main {
  margin-left: var(--sidebar);
  flex: 1;
  display: flex; flex-direction: column;
  min-height: 100vh;
}
.admin-topbar {
  height: 60px;
  background: var(--bg2);
  border-bottom: 1px solid var(--bord);
  display: flex; align-items: center;
  padding: 0 1.75rem;
  position: sticky; top: 0; z-index: 50;
  gap: 1rem;
}
.topbar-title { font-size: 1rem; font-weight: 600; flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: .75rem; }
.admin-content { padding: 1.75rem; flex: 1; }

/* ── CARDS ── */
.card {
  background: var(--bg2);
  border: 1px solid var(--bord);
  border-radius: var(--radius);
  overflow: hidden;
}
.card-header {
  padding: 1.1rem 1.5rem;
  border-bottom: 1px solid var(--bord);
  display: flex; align-items: center; gap: .75rem;
}
.card-header h2 { font-size: .95rem; font-weight: 600; flex: 1; }
.card-body { padding: 1.5rem; }

/* ── STAT CARDS ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem; margin-bottom: 1.5rem;
}
.stat-card {
  background: var(--bg2);
  border: 1px solid var(--bord);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  display: flex; flex-direction: column; gap: .5rem;
  position: relative; overflow: hidden;
  transition: border-color var(--transition);
}
.stat-card:hover { border-color: var(--bord2); }
.stat-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0;
  height: 3px;
}
.stat-card.red::before    { background: linear-gradient(90deg, var(--acc), var(--acc2)); }
.stat-card.green::before  { background: linear-gradient(90deg, #22c55e, #16a34a); }
.stat-card.amber::before  { background: linear-gradient(90deg, #f59e0b, #d97706); }
.stat-card.blue::before   { background: linear-gradient(90deg, #3b82f6, #1d4ed8); }
.stat-label { font-size: .78rem; color: var(--muted); font-weight: 500; }
.stat-value { font-size: 2rem; font-weight: 700; line-height: 1; }
.stat-icon  {
  position: absolute; right: 1rem; top: 50%;
  transform: translateY(-50%);
  font-size: 2.5rem; opacity: .07;
}

/* ── TABLES ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .875rem; }
thead th {
  padding: .75rem 1rem;
  text-align: left; font-size: .72rem; font-weight: 600;
  letter-spacing: .06em; text-transform: uppercase;
  color: var(--muted); border-bottom: 1px solid var(--bord);
  white-space: nowrap;
}
tbody td {
  padding: .9rem 1rem;
  border-bottom: 1px solid var(--bord);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: rgba(255,255,255,.025); }

/* ── BADGES ── */
.badge {
  display: inline-flex; align-items: center;
  padding: .2rem .55rem; border-radius: 20px;
  font-size: .72rem; font-weight: 600;
}
.badge-success { background: rgba(34,197,94,.15); color: #22c55e; }
.badge-warn    { background: rgba(245,158,11,.15); color: #f59e0b; }
.badge-danger  { background: rgba(239,68,68,.15);  color: #ef4444; }
.badge-muted   { background: rgba(139,139,158,.12); color: var(--muted); }

/* ── BUTTONS ── */
.btn {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .55rem 1.1rem;
  border-radius: var(--radius-s);
  font-size: .85rem; font-weight: 600;
  cursor: pointer; border: none;
  transition: all var(--transition);
  text-decoration: none; white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--acc); color: #fff; }
.btn-primary:hover { background: #c9281f; color: #fff; }
.btn-secondary { background: var(--bg3); color: var(--text); border: 1px solid var(--bord); }
.btn-secondary:hover { border-color: var(--bord2); color: var(--text); }
.btn-danger { background: rgba(239,68,68,.15); color: var(--danger); border: 1px solid rgba(239,68,68,.2); }
.btn-danger:hover { background: rgba(239,68,68,.25); }
.btn-success { background: rgba(34,197,94,.15); color: #22c55e; border: 1px solid rgba(34,197,94,.2); }
.btn-success:hover { background: rgba(34,197,94,.25); }
.btn-sm { padding: .35rem .75rem; font-size: .78rem; }
.btn-icon { padding: .45rem; width: 34px; height: 34px; justify-content: center; }

/* ── FORMS ── */
.form-group { margin-bottom: 1.25rem; }
.form-label {
  display: block; margin-bottom: .45rem;
  font-size: .82rem; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: .04em;
}
.form-control {
  width: 100%; padding: .7rem 1rem;
  background: var(--bg3); border: 1px solid var(--bord);
  border-radius: var(--radius-s);
  color: var(--text); font-size: .9rem;
  transition: border-color var(--transition);
  outline: none;
}
.form-control:focus { border-color: var(--acc); }
.form-control::placeholder { color: var(--muted); }
textarea.form-control { resize: vertical; min-height: 120px; }
select.form-control { cursor: pointer; }
.form-hint { font-size: .75rem; color: var(--muted); margin-top: .35rem; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1rem; }

/* ── FLASH MESSAGES ── */
.flash {
  padding: .85rem 1.1rem;
  border-radius: var(--radius-s);
  margin-bottom: 1.25rem;
  font-size: .875rem; font-weight: 500;
  display: flex; align-items: center; gap: .6rem;
}
.flash-success { background: rgba(34,197,94,.12); border: 1px solid rgba(34,197,94,.25); color: #22c55e; }
.flash-error   { background: rgba(239,68,68,.12);  border: 1px solid rgba(239,68,68,.25);  color: #ef4444; }

/* ── SEARCH BAR ── */
.search-wrap { position: relative; }
.search-wrap i { position: absolute; left: .85rem; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search-input {
  width: 100%; padding: .6rem 1rem .6rem 2.4rem;
  background: var(--bg3); border: 1px solid var(--bord);
  border-radius: var(--radius-s); color: var(--text);
  font-size: .875rem; outline: none; font-family: inherit;
}
.search-input:focus { border-color: var(--acc); }
.search-input::placeholder { color: var(--muted); }

/* ── TOOLBAR ── */
.toolbar {
  display: flex; align-items: center; gap: .75rem;
  margin-bottom: 1.25rem; flex-wrap: wrap;
}
.toolbar .search-wrap { flex: 1; min-width: 200px; }

/* ── FILTER TABS ── */
.filter-tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--bord); margin-bottom: 1.25rem; }
.filter-tab {
  padding: .6rem 1rem; font-size: .825rem; font-weight: 500;
  color: var(--muted); cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all var(--transition); text-decoration: none;
}
.filter-tab:hover { color: var(--text); text-decoration: none; }
.filter-tab.active { color: var(--acc); border-bottom-color: var(--acc); }

/* ── MODAL ── */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.7); backdrop-filter: blur(4px);
  z-index: 1000; align-items: center; justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--bg2); border: 1px solid var(--bord2);
  border-radius: var(--radius); max-width: 560px; width: 90%;
  max-height: 80vh; overflow-y: auto;
  animation: modalIn .2s ease;
}
@keyframes modalIn { from { opacity:0; transform: scale(.96) translateY(-8px); } }
.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--bord);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-header h3 { font-size: .95rem; font-weight: 600; }
.modal-body { padding: 1.5rem; }
.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--bord);
  display: flex; gap: .75rem; justify-content: flex-end;
}

/* ── TOGGLE SWITCH ── */
.toggle-wrap { display: flex; align-items: center; gap: .6rem; }
.toggle { position: relative; width: 40px; height: 22px; cursor: pointer; }
.toggle input { opacity:0; width:0; height:0; }
.toggle-slider {
  position: absolute; inset: 0;
  background: var(--bg3); border: 1px solid var(--bord);
  border-radius: 20px; transition: all .2s;
}
.toggle-slider::before {
  content:''; position: absolute;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--muted); top: 2px; left: 2px;
  transition: all .2s;
}
.toggle input:checked + .toggle-slider { background: rgba(34,197,94,.2); border-color: #22c55e; }
.toggle input:checked + .toggle-slider::before { background: #22c55e; transform: translateX(18px); }

/* ── STAR RATING ── */
.stars { color: #f59e0b; font-size: .9rem; letter-spacing: .05em; }

/* ── EMPTY STATE ── */
.empty-state {
  text-align: center; padding: 4rem 2rem; color: var(--muted);
}
.empty-state i { font-size: 3rem; display: block; margin-bottom: 1rem; opacity:.4; }
.empty-state p { font-size: .9rem; }

/* ── UNREAD ROW ── */
tbody tr.unread td:first-child { border-left: 3px solid var(--acc); }

/* ── ACTION BUTTONS IN ROWS ── */
.row-actions { display: flex; gap: .35rem; align-items: center; }

/* ── PAGE HEADER ── */
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1.5rem; gap: 1rem;
}
.page-header h1 { font-size: 1.25rem; font-weight: 700; }
.page-header p  { font-size: .82rem; color: var(--muted); margin-top: .2rem; }

/* ── LOGIN PAGE ── */
body.login-page {
  display: flex; align-items: center; justify-content: center;
  background: var(--bg);
  background-image: radial-gradient(ellipse at 20% 20%, rgba(232,52,42,.08) 0%, transparent 60%),
                    radial-gradient(ellipse at 80% 80%, rgba(255,107,53,.05) 0%, transparent 60%);
}
.login-card {
  width: 100%; max-width: 380px;
  background: var(--bg2); border: 1px solid var(--bord);
  border-radius: 18px; padding: 2.5rem;
  box-shadow: var(--shadow);
}
.login-logo { text-align: center; margin-bottom: 2rem; }
.login-logo .logo-icon {
  width: 52px; height: 52px;
  background: linear-gradient(135deg, var(--acc), var(--acc2));
  border-radius: 14px; display: inline-flex;
  align-items: center; justify-content: center;
  font-size: 1.5rem; color: #fff; font-weight: 700;
  margin-bottom: .75rem;
}
.login-logo h1 { font-size: 1.2rem; font-weight: 700; }
.login-logo p  { font-size: .8rem; color: var(--muted); }

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  .admin-sidebar { transform: translateX(-100%); }
  .admin-sidebar.open { transform: translateX(0); }
  .admin-main { margin-left: 0; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}

/* ── QUILL EDITOR OVERRIDES ── */
.ql-toolbar { background: var(--bg3); border: 1px solid var(--bord) !important; border-radius: var(--radius-s) var(--radius-s) 0 0 !important; }
.ql-container { background: var(--bg3); border: 1px solid var(--bord) !important; border-top: none !important; border-radius: 0 0 var(--radius-s) var(--radius-s) !important; min-height: 300px; }
.ql-editor { color: var(--text); font-family: var(--font); font-size: .9rem; }
.ql-toolbar .ql-stroke { stroke: var(--muted); }
.ql-toolbar .ql-fill { fill: var(--muted); }
.ql-toolbar button:hover .ql-stroke, .ql-toolbar button.ql-active .ql-stroke { stroke: var(--acc); }
.ql-toolbar button:hover .ql-fill, .ql-toolbar button.ql-active .ql-fill { fill: var(--acc); }
.ql-toolbar .ql-picker { color: var(--muted); }
.ql-toolbar .ql-picker-options { background: var(--bg2); border-color: var(--bord); }
