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

:root {
  --navy: #0D2B7A; --navy-dark: #071B52; --navy-light: #1A3D9E;
  --red: #C91F1F; --red-dark: #A51515;
  --bg: #F0F2F8; --card: #FFFFFF; --sidebar: #071B52;
  --border: rgba(0,0,0,0.07); --border-2: rgba(0,0,0,0.12);
  --text: #0A1628; --text-2: #4B5563; --text-3: #9CA3AF;
  --shadow: 0 2px 12px rgba(13,43,122,0.08);
  --font: 'Sora', sans-serif; --mono: 'Space Mono', monospace;
  --radius: 12px; --transition: 0.22s cubic-bezier(0.4,0,0.2,1);
  --green: #16a34a; --amber: #d97706;
}
[data-theme="dark"] {
  --bg: #080D1A; --card: #0E1525; --sidebar: #050A14;
  --border: rgba(255,255,255,0.06); --border-2: rgba(255,255,255,0.1);
  --text: #F0F4FF; --text-2: #9CA3AF; --text-3: #4A5568;
}

*,*::before,*::after { box-sizing: border-box; margin:0; padding:0; }
html { font-size:16px; }
body { font-family: var(--font); background: var(--bg); color: var(--text); line-height:1.6; overflow-x:hidden; }
img { max-width:100%; display:block; }
button { cursor:pointer; font-family:var(--font); }
input,textarea,select { font-family:var(--font); }
a { color:inherit; text-decoration:none; }

::-webkit-scrollbar { width:5px; height:5px; }
::-webkit-scrollbar-track { background:var(--bg); }
::-webkit-scrollbar-thumb { background:var(--navy); border-radius:3px; }

@keyframes spin { from{transform:rotate(0)} to{transform:rotate(360deg)} }
@keyframes fadeUp { from{opacity:0;transform:translateY(16px)} to{opacity:1;transform:translateY(0)} }
@keyframes pulse { 0%,100%{opacity:1;transform:scale(1)} 50%{opacity:.5;transform:scale(1.2)} }

/* ── LOGIN PAGE ──────────────────────────────── */
#login-page {
  min-height:100vh; display:flex; align-items:center; justify-content:center;
  background: linear-gradient(135deg, var(--navy-dark) 0%, #0a1628 60%, #0D2B7A 100%);
  position:relative; overflow:hidden;
}
.login-bg-dots {
  position:absolute; inset:0;
  background-image: radial-gradient(rgba(255,255,255,0.04) 1px, transparent 1px);
  background-size:32px 32px;
}
.login-glow { position:absolute; border-radius:50%; filter:blur(80px); opacity:.1; }
.login-glow-1 { width:500px; height:500px; background:var(--red); right:-100px; top:-100px; }
.login-glow-2 { width:300px; height:300px; background:var(--navy-light); left:-50px; bottom:-50px; }
.login-box {
  background:var(--card); border-radius:24px; padding:2.5rem;
  width:100%; max-width:420px; position:relative; z-index:2;
  box-shadow:0 24px 80px rgba(0,0,0,0.4); border:1px solid rgba(255,255,255,0.06);
  animation: fadeUp .5s ease both;
}
.login-logo { text-align:center; margin-bottom:2rem; }
.login-badge {
  display:inline-flex; align-items:center; gap:6px;
  background:rgba(201,31,31,.12); border:1px solid rgba(201,31,31,.3);
  color:#FF8888; font-size:11px; font-weight:700; letter-spacing:1.5px; text-transform:uppercase;
  padding:5px 14px; border-radius:100px; margin-bottom:1rem;
}
.login-badge-dot { width:6px; height:6px; border-radius:50%; background:var(--red); animation:pulse 2s infinite; }
.login-box h1 { font-size:1.6rem; font-weight:800; color:var(--text); margin-bottom:.4rem; }
.login-box p { font-size:.88rem; color:var(--text-2); margin-bottom:1.75rem; }
.login-field { margin-bottom:1.1rem; }
.login-field label { display:block; font-size:11px; font-weight:700; text-transform:uppercase; letter-spacing:.8px; color:var(--text-2); margin-bottom:7px; }
.login-field input {
  width:100%; padding:13px 16px; border-radius:10px; border:1.5px solid var(--border-2);
  background:var(--bg); color:var(--text); font-size:14px; outline:none;
  transition:border-color var(--transition);
}
.login-field input:focus { border-color:var(--navy); box-shadow:0 0 0 3px rgba(13,43,122,.1); }
.login-err { font-size:12px; color:var(--red); margin-top:.5rem; display:none; }
.login-btn {
  width:100%; padding:14px; background:var(--navy-dark); color:white;
  border:none; border-radius:11px; font-size:15px; font-weight:700;
  transition:all var(--transition); margin-top:.5rem; display:flex; align-items:center; justify-content:center; gap:8px;
}
.login-btn:hover { background:var(--navy-light); transform:translateY(-1px); box-shadow:0 6px 24px rgba(13,43,122,.35); }
.login-btn:disabled { opacity:.7; cursor:not-allowed; transform:none; }
.login-meta { text-align:center; font-size:12px; color:var(--text-3); margin-top:1.25rem; }

/* ── ADMIN LAYOUT ─────────────────────────────── */
#admin-app { display:none; height:100vh; }
.admin-layout { display:flex; height:100vh; }

/* Sidebar */
.sidebar {
  width:240px; background:var(--sidebar); flex-shrink:0;
  display:flex; flex-direction:column;
  border-right:1px solid rgba(255,255,255,0.05);
  transition:width var(--transition);
  overflow:hidden;
}
.sidebar-logo { padding:1.5rem 1.25rem 1rem; border-bottom:1px solid rgba(255,255,255,.05); }
.sidebar-logo svg { width:120px; height:auto; }
.sidebar-admin { display:flex; align-items:center; gap:10px; padding:.85rem 1.25rem; border-bottom:1px solid rgba(255,255,255,.05); }
.sidebar-avatar { width:34px; height:34px; border-radius:10px; background:linear-gradient(135deg,var(--red-dark),var(--red)); display:flex; align-items:center; justify-content:center; color:white; font-weight:700; font-size:14px; flex-shrink:0; }
.sidebar-admin-name { font-size:13px; font-weight:600; color:white; }
.sidebar-admin-role { font-size:11px; color:rgba(255,255,255,.4); }
.sidebar-nav { flex:1; padding:.75rem 0; overflow-y:auto; }
.nav-section-label { font-size:10px; font-weight:700; letter-spacing:2px; text-transform:uppercase; color:rgba(255,255,255,.25); padding:.5rem 1.25rem .25rem; }
.sidebar-link {
  display:flex; align-items:center; gap:10px; padding:.7rem 1.25rem;
  color:rgba(255,255,255,.55); font-size:13px; font-weight:500;
  transition:all var(--transition); cursor:pointer; position:relative;
}
.sidebar-link:hover { color:white; background:rgba(255,255,255,.05); }
.sidebar-link.active { color:white; background:rgba(13,43,122,.5); }
.sidebar-link.active::before { content:''; position:absolute; left:0; top:4px; bottom:4px; width:3px; background:var(--red); border-radius:0 3px 3px 0; }
.sidebar-link i { width:18px; text-align:center; font-size:14px; }
.sidebar-badge { margin-left:auto; background:var(--red); color:white; font-size:10px; font-weight:700; padding:2px 7px; border-radius:100px; }
.sidebar-bottom { padding:.75rem; border-top:1px solid rgba(255,255,255,.05); display:flex; gap:.5rem; }
.sidebar-bottom-btn { flex:1; padding:9px; border-radius:9px; border:none; background:rgba(255,255,255,.06); color:rgba(255,255,255,.55); font-size:12px; font-weight:600; display:flex; align-items:center; justify-content:center; gap:6px; transition:all var(--transition); }
.sidebar-bottom-btn:hover { background:rgba(255,255,255,.1); color:white; }
.sidebar-bottom-btn.logout-btn:hover { background:rgba(201,31,31,.2); color:#FF8888; }

/* Main content */
.admin-main { flex:1; display:flex; flex-direction:column; overflow:hidden; }
.admin-topbar {
  height:60px; padding:0 1.75rem; background:var(--card); border-bottom:1px solid var(--border);
  display:flex; align-items:center; justify-content:space-between; flex-shrink:0;
}
.admin-topbar-title { font-size:1rem; font-weight:700; color:var(--text); }
.topbar-right { display:flex; align-items:center; gap:.75rem; }
.topbar-btn { width:36px; height:36px; border-radius:9px; border:1px solid var(--border-2); background:transparent; color:var(--text-2); display:flex; align-items:center; justify-content:center; font-size:14px; transition:all var(--transition); }
.topbar-btn:hover { background:var(--bg); border-color:var(--border-2); color:var(--text); }
.admin-content { flex:1; overflow-y:auto; padding:1.75rem; }

/* ── PANELS ──────────────────────────────────── */
.panel { display:none; animation:fadeUp .35s ease both; }
.panel.active { display:block; }

/* Stats row */
.stats-row { display:grid; grid-template-columns:repeat(5,1fr); gap:1rem; margin-bottom:1.75rem; }
.stat-card { background:var(--card); border-radius:var(--radius); padding:1.25rem; border:1px solid var(--border); transition:all var(--transition); }
.stat-card:hover { box-shadow:var(--shadow); }
.stat-card-top { display:flex; justify-content:space-between; align-items:flex-start; margin-bottom:.75rem; }
.stat-icon { width:40px; height:40px; border-radius:10px; display:flex; align-items:center; justify-content:center; font-size:17px; }
.stat-icon.blue { background:rgba(13,43,122,.1); color:var(--navy); }
.stat-icon.red { background:rgba(201,31,31,.1); color:var(--red); }
.stat-icon.green { background:rgba(22,163,74,.1); color:var(--green); }
.stat-icon.amber { background:rgba(217,119,6,.1); color:var(--amber); }
.stat-num { font-family:var(--mono); font-size:2rem; font-weight:700; color:var(--text); line-height:1; }
.stat-label { font-size:12px; color:var(--text-2); font-weight:500; margin-top:4px; }

/* Section header */
.section-head { display:flex; justify-content:space-between; align-items:center; margin-bottom:1.25rem; }
.section-head-title { font-size:1rem; font-weight:700; color:var(--text); }
.section-head-sub { font-size:12px; color:var(--text-3); margin-top:2px; }

/* Buttons */
.btn { display:inline-flex; align-items:center; gap:7px; padding:9px 20px; border-radius:9px; border:none; font-size:13px; font-weight:600; transition:all var(--transition); white-space:nowrap; }
.btn-primary { background:var(--navy-dark); color:white; }
.btn-primary:hover { background:var(--navy-light); transform:translateY(-1px); }
.btn-red { background:var(--red); color:white; }
.btn-red:hover { background:var(--red-dark); }
.btn-outline { background:transparent; color:var(--text); border:1.5px solid var(--border-2); }
.btn-outline:hover { border-color:var(--navy); color:var(--navy); }
.btn-ghost { background:transparent; color:var(--text-2); border:none; padding:8px 12px; }
.btn-ghost:hover { background:var(--bg); color:var(--text); }
.btn-sm { padding:6px 14px; font-size:12px; border-radius:7px; }
.btn-icon { width:34px; height:34px; padding:0; border-radius:8px; display:flex; align-items:center; justify-content:center; }

/* Cards */
.card { background:var(--card); border-radius:var(--radius); border:1px solid var(--border); }
.card-pad { padding:1.5rem; }

/* Grid */
.admin-grid { display:grid; grid-template-columns:1fr 1.6fr; gap:1.5rem; }

/* Form card */
.form-card { background:var(--card); border-radius:var(--radius); border:1px solid var(--border); padding:1.5rem; height:fit-content; }
.form-card h3 { font-size:.95rem; font-weight:700; color:var(--text); margin-bottom:1.25rem; display:flex; align-items:center; gap:8px; }
.form-card h3 .dot { width:8px; height:8px; border-radius:50%; background:var(--red); }
.form-label { font-size:11px; font-weight:700; text-transform:uppercase; letter-spacing:.8px; color:var(--text-2); display:block; margin-bottom:6px; }
.form-input {
  width:100%; padding:10px 14px; border-radius:9px; border:1.5px solid var(--border-2);
  background:var(--bg); color:var(--text); font-size:13.5px; outline:none;
  transition:border-color var(--transition); margin-bottom:1rem;
}
.form-input:focus { border-color:var(--navy); background:var(--card); box-shadow:0 0 0 3px rgba(13,43,122,.08); }
textarea.form-input { resize:vertical; min-height:90px; }
.form-row-2 { display:grid; grid-template-columns:1fr 1fr; gap:.75rem; }
.form-hint { font-size:11px; color:var(--text-3); margin-top:-0.75rem; margin-bottom:1rem; }

/* Banner upload */
.banner-drop {
  width:100%; height:110px; border-radius:10px;
  border:2px dashed var(--border-2); background:var(--bg);
  display:flex; flex-direction:column; align-items:center; justify-content:center;
  gap:6px; cursor:pointer; transition:all var(--transition); margin-bottom:1rem;
  position:relative; overflow:hidden;
}
.banner-drop:hover { border-color:var(--navy); background:rgba(13,43,122,.04); }
.banner-drop i { font-size:1.6rem; color:var(--text-3); }
.banner-drop span { font-size:12px; color:var(--text-3); font-weight:500; }
.banner-drop img { position:absolute; inset:0; width:100%; height:100%; object-fit:cover; border-radius:8px; }

/* List card */
.list-card { background:var(--card); border-radius:var(--radius); border:1px solid var(--border); }
.list-head { padding:1.25rem 1.5rem; border-bottom:1px solid var(--border); display:flex; justify-content:space-between; align-items:center; }
.list-search { padding:8px 14px; border-radius:8px; border:1.5px solid var(--border-2); background:var(--bg); color:var(--text); font-size:13px; outline:none; width:200px; }
.list-search:focus { border-color:var(--navy); }
.list-body { padding:.75rem; }
.list-item {
  display:flex; align-items:center; gap:12px; padding:.85rem 1rem;
  border-radius:10px; border:1px solid transparent; transition:all var(--transition);
}
.list-item:hover { background:var(--bg); border-color:var(--border); }
.list-item-thumb { width:46px; height:46px; border-radius:10px; overflow:hidden; flex-shrink:0; }
.list-item-thumb img { width:100%; height:100%; object-fit:cover; }
.list-item-icon { width:46px; height:46px; border-radius:10px; background:linear-gradient(135deg,var(--navy),var(--navy-light)); display:flex; align-items:center; justify-content:center; color:white; font-size:18px; flex-shrink:0; }
.list-item-info { flex:1; min-width:0; }
.list-item-name { font-size:13.5px; font-weight:700; color:var(--text); }
.list-item-sub { font-size:12px; color:var(--text-3); margin-top:2px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.list-actions { display:flex; gap:6px; }
.edit-btn { padding:6px 12px; border-radius:7px; border:1.5px solid var(--border-2); background:transparent; font-size:12px; font-weight:600; color:var(--navy); transition:all var(--transition); display:flex; align-items:center; gap:5px; }
.edit-btn:hover { background:var(--navy-dark); color:white; border-color:var(--navy-dark); }
.del-btn { padding:6px 12px; border-radius:7px; border:1.5px solid rgba(201,31,31,.2); background:rgba(201,31,31,.05); font-size:12px; font-weight:600; color:var(--red); transition:all var(--transition); display:flex; align-items:center; gap:5px; }
.del-btn:hover { background:var(--red); color:white; border-color:var(--red); }

/* Badges */
.badge { font-size:10px; font-weight:700; padding:3px 9px; border-radius:100px; letter-spacing:.5px; }
.badge-active { background:rgba(22,163,74,.1); color:#15803d; }
.badge-inactive { background:rgba(0,0,0,.06); color:var(--text-3); }
[data-theme="dark"] .badge-inactive { background:rgba(255,255,255,.06); }
.badge-unread { background:rgba(201,31,31,.12); color:var(--red); }
.badge-read { background:rgba(22,163,74,.1); color:#15803d; }

/* Messages */
.msg-card { background:var(--card); border-radius:var(--radius); border:1px solid var(--border); margin-bottom:1rem; transition:all var(--transition); overflow:hidden; }
.msg-card.unread { border-left:3px solid var(--red); }
.msg-head { padding:1rem 1.25rem; display:flex; justify-content:space-between; align-items:flex-start; cursor:pointer; }
.msg-name { font-size:.95rem; font-weight:700; color:var(--text); }
.msg-meta { font-size:12px; color:var(--text-3); margin-top:3px; }
.msg-date { font-size:11px; color:var(--text-3); flex-shrink:0; }
.msg-body { padding:0 1.25rem 1.25rem; border-top:1px solid var(--border); display:none; }
.msg-body.open { display:block; padding-top:1rem; }
.msg-text { font-size:.88rem; color:var(--text-2); line-height:1.7; background:var(--bg); border-radius:8px; padding:1rem; }
.msg-details { display:grid; grid-template-columns:repeat(2,1fr); gap:.75rem; margin-top:.75rem; }
.msg-detail { background:var(--bg); border-radius:8px; padding:.75rem 1rem; }
.msg-detail-label { font-size:10px; font-weight:700; text-transform:uppercase; letter-spacing:1px; color:var(--text-3); margin-bottom:3px; }
.msg-detail-val { font-size:13px; font-weight:600; color:var(--text); }
.msg-actions { display:flex; gap:.5rem; margin-top:.75rem; }

/* Settings */
.settings-grid { display:grid; grid-template-columns:1fr 1fr; gap:1.5rem; }
.settings-card { background:var(--card); border-radius:var(--radius); border:1px solid var(--border); padding:1.5rem; }
.settings-card h3 { font-size:.95rem; font-weight:700; color:var(--text); margin-bottom:1.25rem; display:flex; align-items:center; gap:8px; }
.settings-card h3 i { color:var(--navy); font-size:15px; }

/* Modal */
.modal-overlay { display:none; position:fixed; inset:0; background:rgba(0,0,0,.55); backdrop-filter:blur(5px); z-index:2000; align-items:center; justify-content:center; padding:1rem; }
.modal-overlay.open { display:flex; }
.modal-box { background:var(--card); border-radius:20px; padding:2rem; width:100%; max-width:480px; animation:fadeUp .25s ease; border:1px solid var(--border-2); }
.modal-title { font-size:1.1rem; font-weight:700; color:var(--text); margin-bottom:.5rem; }
.modal-sub { font-size:.88rem; color:var(--text-2); margin-bottom:1.5rem; }
.modal-btns { display:flex; gap:.75rem; margin-top:1.25rem; }
.modal-cancel { flex:1; padding:11px; border-radius:9px; border:1.5px solid var(--border-2); background:transparent; font-family:var(--font); font-size:14px; font-weight:600; color:var(--text); transition:all var(--transition); }
.modal-cancel:hover { background:var(--bg); }
.modal-confirm { flex:1; padding:11px; border-radius:9px; border:none; background:var(--red); color:white; font-family:var(--font); font-size:14px; font-weight:700; transition:all var(--transition); }
.modal-confirm:hover { background:var(--red-dark); }

/* Toast */
#a-toast { position:fixed; bottom:2rem; right:2rem; z-index:9999; background:var(--sidebar); color:white; padding:13px 20px; border-radius:12px; font-size:13.5px; font-weight:600; border-left:3px solid var(--red); box-shadow:0 8px 32px rgba(0,0,0,.4); transform:translateY(80px); opacity:0; transition:all .3s ease; max-width:320px; }
#a-toast.show { transform:translateY(0); opacity:1; }
#a-toast.success { border-left-color:#22c55e; }

/* Loader */
.loader { display:flex; align-items:center; justify-content:center; padding:3rem; }
.loader-spin { width:32px; height:32px; border:3px solid var(--border); border-top-color:var(--navy); border-radius:50%; animation:spin .7s linear infinite; }
.empty { text-align:center; padding:3rem; color:var(--text-3); }
.empty i { font-size:2.5rem; margin-bottom:.75rem; opacity:.2; display:block; }
.empty p { font-size:13px; }

/* Color picker row */
.color-row { display:flex; gap:.5rem; flex-wrap:wrap; margin-bottom:1rem; }
.color-swatch { width:32px; height:32px; border-radius:8px; border:2px solid transparent; cursor:pointer; transition:all var(--transition); }
.color-swatch.selected { border-color:var(--text); transform:scale(1.1); }

/* Tabs */
.tabs { display:flex; gap:.5rem; background:var(--bg); padding:4px; border-radius:10px; border:1px solid var(--border); margin-bottom:1.5rem; }
.tab-btn { flex:1; padding:8px 16px; border-radius:7px; border:none; font-family:var(--font); font-size:13px; font-weight:600; background:transparent; color:var(--text-2); transition:all var(--transition); }
.tab-btn.active { background:var(--navy-dark); color:white; }

/* Dark mode toggle in topbar */
.theme-toggle { width:36px; height:36px; border-radius:9px; border:1px solid var(--border-2); background:transparent; color:var(--text-2); display:flex; align-items:center; justify-content:center; font-size:14px; transition:all var(--transition); }
.theme-toggle:hover { background:var(--bg); color:var(--text); }

/* Responsive */
@media (max-width:768px) {
  .admin-layout { flex-direction:column; }
  .sidebar { width:100%; height:auto; flex-direction:row; overflow-x:auto; }
  .sidebar-nav { flex-direction:row; padding:.5rem; }
  .sidebar-link span { display:none; }
  .stats-row { grid-template-columns:1fr 1fr; }
  .admin-grid { grid-template-columns:1fr; }
  .settings-grid { grid-template-columns:1fr; }
}
