/* ============================================================
   The 50 States Times — Admin Panel CSS
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@300;400;500;600;700&family=IBM+Plex+Mono:wght@400;500&display=swap');

:root {
  --navy:    #0d2b5e;
  --blue:    #1a4b8c;
  --accent:  #c8102e;
  --green:   #16a34a;
  --orange:  #ea580c;
  --white:   #ffffff;
  --bg:      #f1f3f8;
  --border:  #d4d9e4;
  --text:    #1e2535;
  --muted:   #6b7888;
  --sidebar-w: 240px;
  --ff: 'IBM Plex Sans', system-ui, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--ff); color: var(--text); background: var(--bg); font-size: 14px; }
a { color: var(--blue); text-decoration: none; }
input, select, textarea, button { font-family: var(--ff); font-size: 14px; }
img { max-width: 100%; }

/* ── Login Page ── */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, var(--navy) 0%, #1e4080 100%); }
.login-box { background: white; padding: 40px; border-radius: 12px; width: 380px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo h1 { font-size: 1.3rem; font-weight: 800; color: var(--navy); }
.login-logo h1 span { color: var(--accent); }
.login-logo p { font-size: .75rem; color: var(--muted); margin-top: 4px; letter-spacing: .08em; text-transform: uppercase; }
.login-box .form-group { margin-bottom: 18px; }
.login-box label { display: block; font-size: .82rem; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.login-box input { width: 100%; padding: 10px 14px; border: 2px solid var(--border); border-radius: 6px; transition: border-color .2s; }
.login-box input:focus { outline: none; border-color: var(--blue); }
.login-box button { width: 100%; padding: 11px; background: var(--navy); color: white; font-weight: 700; border-radius: 6px; transition: background .2s; }
.login-box button:hover { background: var(--blue); }
.login-error { background: #fef2f2; border: 1px solid #fca5a5; color: #b91c1c; padding: 10px 14px; border-radius: 6px; font-size: .85rem; margin-bottom: 16px; }

/* ── Admin Layout ── */
.admin-wrap { display: flex; min-height: 100vh; }

/* Sidebar */
.admin-sidebar { width: var(--sidebar-w); background: var(--navy); color: white; display: flex; flex-direction: column; position: fixed; top: 0; left: 0; height: 100vh; overflow-y: auto; z-index: 100; }
.sidebar-brand { padding: 20px 16px; border-bottom: 1px solid rgba(255,255,255,.1); }
.sidebar-brand h2 { font-size: .95rem; font-weight: 800; color: white; }
.sidebar-brand h2 span { color: #f4c430; }
.sidebar-brand p { font-size: .65rem; color: rgba(255,255,255,.5); margin-top: 3px; letter-spacing: .08em; text-transform: uppercase; }
.sidebar-nav { flex: 1; padding: 12px 0; }
.sidebar-nav .nav-section { font-size: .62rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: rgba(255,255,255,.35); padding: 12px 16px 6px; }
.sidebar-nav a { display: flex; align-items: center; gap: 10px; padding: 9px 16px; font-size: .84rem; color: rgba(255,255,255,.75); transition: all .2s; border-left: 3px solid transparent; }
.sidebar-nav a:hover, .sidebar-nav a.active { color: white; background: rgba(255,255,255,.08); border-left-color: #f4c430; }
.sidebar-nav a .icon { width: 18px; text-align: center; }
.sidebar-footer { padding: 16px; border-top: 1px solid rgba(255,255,255,.1); font-size: .75rem; color: rgba(255,255,255,.45); }
.sidebar-footer a { color: rgba(255,255,255,.6); }

/* Main */
.admin-main { margin-left: var(--sidebar-w); flex: 1; display: flex; flex-direction: column; }
.admin-topbar { background: white; border-bottom: 1px solid var(--border); padding: 12px 28px; display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 90; }
.admin-topbar h1 { font-size: 1.1rem; font-weight: 700; color: var(--navy); }
.admin-topbar .user-info { display: flex; align-items: center; gap: 12px; font-size: .82rem; color: var(--muted); }
.admin-topbar .user-info a { color: var(--accent); font-weight: 600; }
.admin-content { padding: 28px; flex: 1; }

/* ── Cards & Panels ── */
.panel { background: white; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; margin-bottom: 24px; }
.panel-header { padding: 14px 20px; background: var(--bg); border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.panel-header h2 { font-size: .95rem; font-weight: 700; color: var(--navy); }
.panel-body { padding: 20px; }

/* Stats cards */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 28px; }
.stat-card { background: white; border: 1px solid var(--border); border-radius: 8px; padding: 20px; display: flex; align-items: center; gap: 16px; }
.stat-icon { width: 48px; height: 48px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 1.4rem; flex-shrink: 0; }
.stat-icon.blue { background: #dbeafe; }
.stat-icon.green { background: #dcfce7; }
.stat-icon.orange { background: #ffedd5; }
.stat-icon.purple { background: #f3e8ff; }
.stat-num { font-size: 1.6rem; font-weight: 800; color: var(--navy); line-height: 1; }
.stat-label { font-size: .75rem; color: var(--muted); margin-top: 3px; }

/* ── Tables ── */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { background: var(--bg); font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 10px 16px; text-align: left; border-bottom: 2px solid var(--border); white-space: nowrap; }
.data-table td { padding: 12px 16px; border-bottom: 1px solid var(--border); font-size: .85rem; vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--bg); }
.table-actions { display: flex; gap: 6px; }
.table-wrap { overflow-x: auto; }

/* ── Forms ── */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.form-group { margin-bottom: 18px; }
.form-group.full { grid-column: 1 / -1; }
.form-group label { display: block; font-size: .82rem; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.form-group label .req { color: var(--accent); }
.form-control { width: 100%; padding: 9px 12px; border: 2px solid var(--border); border-radius: 6px; transition: border-color .2s; background: white; }
.form-control:focus { outline: none; border-color: var(--blue); }
.form-control.error { border-color: var(--accent); }
textarea.form-control { resize: vertical; min-height: 120px; }
select.form-control { cursor: pointer; }
.form-hint { font-size: .75rem; color: var(--muted); margin-top: 4px; }
.form-actions { display: flex; gap: 10px; padding-top: 8px; border-top: 1px solid var(--border); margin-top: 8px; }

/* ── Buttons ── */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: 6px; font-size: .82rem; font-weight: 600; border: none; cursor: pointer; transition: all .2s; white-space: nowrap; }
.btn-primary { background: var(--navy); color: white; }
.btn-primary:hover { background: var(--blue); }
.btn-success { background: var(--green); color: white; }
.btn-success:hover { filter: brightness(1.1); }
.btn-warning { background: var(--orange); color: white; }
.btn-warning:hover { filter: brightness(1.1); }
.btn-danger { background: var(--accent); color: white; }
.btn-danger:hover { filter: brightness(1.1); }
.btn-outline { background: white; color: var(--text); border: 2px solid var(--border); }
.btn-outline:hover { border-color: var(--blue); color: var(--blue); }
.btn-sm { padding: 5px 10px; font-size: .75rem; }
.btn-icon { padding: 6px 8px; }

/* ── Status badges ── */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 20px; font-size: .7rem; font-weight: 700; }
.badge-success { background: #dcfce7; color: #15803d; }
.badge-warning { background: #ffedd5; color: #c2410c; }
.badge-danger  { background: #fee2e2; color: #b91c1c; }
.badge-info    { background: #dbeafe; color: #1d4ed8; }
.badge-gray    { background: #f1f5f9; color: #64748b; }

/* ── Alerts / Flash ── */
.flash-msg { padding: 12px 16px; border-radius: 6px; font-size: .85rem; font-weight: 500; margin-bottom: 20px; display: flex; align-items: center; gap: 8px; }
.flash-success { background: #f0fdf4; border: 1px solid #86efac; color: #15803d; }
.flash-error   { background: #fef2f2; border: 1px solid #fca5a5; color: #b91c1c; }
.flash-info    { background: #eff6ff; border: 1px solid #93c5fd; color: #1d4ed8; }

/* ── Image preview ── */
.img-preview { margin-top: 10px; max-width: 240px; border-radius: 6px; border: 2px solid var(--border); }

/* ── Pagination (admin) ── */
.admin-pagination { display: flex; gap: 4px; align-items: center; padding: 16px 20px; border-top: 1px solid var(--border); }
.admin-pagination a, .admin-pagination span { display: flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 4px; font-size: .8rem; font-weight: 600; border: 1px solid var(--border); background: white; color: var(--text); transition: all .2s; }
.admin-pagination a:hover { background: var(--blue); color: white; border-color: var(--blue); }
.admin-pagination span.current { background: var(--navy); color: white; border-color: var(--navy); }

@media (max-width: 768px) {
  .admin-sidebar { transform: translateX(-100%); transition: transform .3s; }
  .admin-sidebar.open { transform: translateX(0); }
  .admin-main { margin-left: 0; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .form-grid { grid-template-columns: 1fr; }
}
