:root {
  --bg:      #080612;
  --bg2:     #0E0A1F;
  --bg3:     #130F2A;
  --purple:  #8B31E0;
  --pl:      #A855F7;
  --blue:    #3B82F6;
  --grad:    linear-gradient(135deg, #8B31E0, #1D4ED8);
  --border:  rgba(139,49,224,0.22);
  --text:    #F0EEFF;
  --muted:   #9E96C0;
  --success: #22C55E;
  --danger:  #EF4444;
  --warn:    #F59E0B;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Outfit', sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; display: flex; }
a { text-decoration: none; color: inherit; }

/* ===== LOGIN ===== */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: radial-gradient(ellipse 80% 60% at 50% 0%, rgba(139,49,224,0.2) 0%, transparent 70%), var(--bg); }
.login-card { background: var(--bg3); border: 1px solid var(--border); border-radius: 16px; padding: 48px 40px; width: 100%; max-width: 400px; text-align: center; }
.login-logo { margin-bottom: 16px; display: flex; justify-content: center; }
.login-title { font-size: 2rem; font-weight: 800; letter-spacing: 0.12em; background: var(--grad); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.login-sub { color: var(--muted); font-size: 0.88rem; margin-bottom: 32px; }
.field { margin-bottom: 18px; text-align: left; }
.field label { display: block; font-size: 0.78rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 8px; }
.field input, .field textarea, .field select { width: 100%; padding: 12px 14px; background: var(--bg); border: 1.5px solid var(--border); border-radius: 8px; color: var(--text); font-size: 0.95rem; font-family: inherit; outline: none; transition: border-color 0.25s; }
.field input:focus, .field textarea:focus { border-color: var(--pl); box-shadow: 0 0 0 3px rgba(168,85,247,0.12); }
.field textarea { resize: vertical; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.btn-login { display: block; width: 100%; padding: 13px; background: var(--grad); color: #fff; border: none; border-radius: 50px; font-size: 1rem; font-weight: 700; cursor: pointer; margin-top: 8px; transition: all 0.25s; font-family: inherit; }
.btn-login:hover { opacity: 0.9; transform: translateY(-1px); box-shadow: 0 6px 20px rgba(139,49,224,0.4); }
.back-link { display: inline-block; margin-top: 20px; font-size: 0.85rem; color: var(--muted); transition: color 0.2s; }
.back-link:hover { color: var(--text); }

/* ===== LAYOUT ===== */
.admin-sidebar {
  width: 240px; min-height: 100vh; background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: fixed; left: 0; top: 0; bottom: 0;
  z-index: 100;
}
.sidebar-logo { display: flex; align-items: center; gap: 12px; padding: 24px 20px; border-bottom: 1px solid var(--border); }
.sidebar-brand { font-size: 1.1rem; font-weight: 800; letter-spacing: 0.1em; background: var(--grad); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; line-height: 1; }
.sidebar-sub { font-size: 0.6rem; color: var(--muted); letter-spacing: 0.12em; text-transform: uppercase; }
.sidebar-nav { list-style: none; padding: 16px 12px; flex: 1; display: flex; flex-direction: column; gap: 4px; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 8px; font-size: 0.9rem; color: var(--muted); transition: all 0.2s; }
.nav-item:hover { background: rgba(139,49,224,0.1); color: var(--text); }
.nav-item.active { background: rgba(139,49,224,0.15); color: var(--text); font-weight: 600; border: 1px solid var(--border); }
.nav-badge { background: var(--purple); color: #fff; font-size: 0.65rem; font-weight: 700; padding: 2px 7px; border-radius: 20px; }
.sidebar-footer { padding: 16px 20px; border-top: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; font-size: 0.82rem; color: var(--muted); }
.logout-btn { color: var(--muted); font-size: 0.82rem; transition: color 0.2s; }
.logout-btn:hover { color: var(--danger); }

.admin-main { margin-left: 240px; flex: 1; padding: 32px 40px; min-height: 100vh; }
.admin-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 32px; }
.admin-header h1 { font-size: 1.7rem; font-weight: 800; display: flex; align-items: center; gap: 12px; }

/* ===== STATS ===== */
.stats-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; margin-bottom: 32px; }
.stat-box { background: var(--bg3); border: 1px solid var(--border); border-radius: 12px; padding: 24px; text-align: center; transition: all 0.25s; }
.stat-box:hover { transform: translateY(-3px); border-color: rgba(168,85,247,0.4); }
.stat-box.featured { border-color: var(--purple); background: linear-gradient(135deg, rgba(139,49,224,0.1), rgba(29,78,216,0.1)); }
.stat-box-icon { font-size: 1.8rem; margin-bottom: 10px; }
.stat-box-num { font-size: 2rem; font-weight: 800; background: var(--grad); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; line-height: 1; margin-bottom: 6px; }
.stat-box-label { font-size: 0.8rem; color: var(--muted); }

/* ===== CARDS ===== */
.section-card { background: var(--bg3); border: 1px solid var(--border); border-radius: 12px; padding: 28px; }
.section-card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.section-card-header h2 { font-size: 1.1rem; font-weight: 700; }
.form-section-title { font-size: 1rem; font-weight: 700; color: var(--pl); margin-bottom: 20px; letter-spacing: 0.04em; text-transform: uppercase; font-size: 0.82rem; }

/* ===== TABLE ===== */
.admin-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.admin-table th { text-align: left; padding: 10px 14px; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); border-bottom: 1px solid var(--border); }
.admin-table td { padding: 14px 14px; border-bottom: 1px solid rgba(139,49,224,0.08); vertical-align: top; }
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: rgba(139,49,224,0.04); }
.row-unread td { background: rgba(139,49,224,0.04); }
.row-unread td:first-child { border-left: 3px solid var(--purple); }
.empty { text-align: center; color: var(--muted); padding: 40px !important; }
.actions-cell { display: flex; gap: 8px; align-items: center; }

/* ===== BADGES ===== */
.badge { display: inline-block; padding: 3px 10px; border-radius: 50px; font-size: 0.72rem; font-weight: 700; }
.badge-unread { background: rgba(139,49,224,0.2); border: 1px solid rgba(139,49,224,0.4); color: var(--pl); }
.badge-read { background: rgba(100,116,139,0.15); border: 1px solid rgba(100,116,139,0.3); color: var(--muted); }

/* ===== BUTTONS ===== */
.btn-sm { padding: 7px 16px; background: rgba(139,49,224,0.12); border: 1px solid var(--border); border-radius: 6px; font-size: 0.82rem; color: var(--pl); transition: all 0.2s; }
.btn-sm:hover { background: rgba(139,49,224,0.2); }
.action-btn { padding: 4px 10px; border-radius: 6px; font-size: 0.78rem; background: rgba(139,49,224,0.1); border: 1px solid var(--border); color: var(--pl); cursor: pointer; transition: all 0.2s; }
.action-btn:hover { background: rgba(139,49,224,0.2); }
.action-btn.danger { background: rgba(239,68,68,0.1); border-color: rgba(239,68,68,0.3); color: #fca5a5; }
.action-btn.danger:hover { background: rgba(239,68,68,0.2); }
.btn-danger { display: inline-block; padding: 10px 24px; background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.4); border-radius: 8px; color: #fca5a5; font-size: 0.9rem; cursor: pointer; transition: all 0.2s; }
.btn-danger:hover { background: rgba(239,68,68,0.2); }

/* ===== ALERTS ===== */
.alert { padding: 13px 16px; border-radius: 8px; font-size: 0.9rem; margin-bottom: 20px; }
.alert-error { background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.3); color: #fca5a5; }
.alert-warn  { background: rgba(245,158,11,0.1); border: 1px solid rgba(245,158,11,0.3); color: #fcd34d; }
.alert-success { background: rgba(34,197,94,0.1); border: 1px solid rgba(34,197,94,0.3); color: #86efac; }

/* ===== MESSAGE DETAIL ===== */
.message-detail-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 16px; }
.message-detail-header h2 { font-size: 1.3rem; font-weight: 700; margin-bottom: 4px; }
.message-detail-header small { color: var(--muted); }
.message-meta { display: flex; gap: 20px; font-size: 0.82rem; color: var(--muted); margin-bottom: 20px; padding-bottom: 20px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.message-body { font-size: 0.95rem; line-height: 1.8; color: var(--text); padding: 20px 0; white-space: pre-wrap; }
.message-actions { display: flex; gap: 12px; align-items: center; padding-top: 20px; border-top: 1px solid var(--border); }

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
  .admin-sidebar { width: 200px; }
  .admin-main { margin-left: 200px; padding: 24px; }
  .stats-row { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .admin-sidebar { display: none; }
  .admin-main { margin-left: 0; padding: 16px; }
  .stats-row { grid-template-columns: 1fr 1fr; }
  .field-row { grid-template-columns: 1fr; }
}
