/* ============================================================
   PREMIUM24HR — Admin Stylesheet
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Kanit:wght@300;400;500;600;700;800&display=swap');

:root {
  --primary:   #DC2626;
  --primary2:  #B91C1C;
  --primary-light: rgba(220,38,38,0.08);
  --sidebar-bg: #1A0505;
  --sidebar-w:  240px;
  --bg:        #FFF8F8;
  --card-bg:   #FFFFFF;
  --text:      #1A0A00;
  --muted:     #9A8A80;
  --border:    rgba(220,38,38,0.10);
  --radius:    14px;
}

* { margin:0; padding:0; box-sizing:border-box; }
body { font-family:'Kanit',sans-serif; background:var(--bg); color:var(--text); min-height:100vh; }

/* ── SIDEBAR ── */
.sidebar {
  position: fixed; top:0; left:0; width:var(--sidebar-w);
  height:100vh; background:var(--sidebar-bg);
  display:flex; flex-direction:column; z-index:100;
  overflow-y:auto;
}
.sidebar-logo {
  padding:20px 20px 16px;
  display:flex; align-items:center; gap:12px;
  border-bottom:1px solid rgba(255,255,255,0.06);
}
.sidebar-logo-icon {
  width:38px; height:38px; border-radius:10px;
  background:linear-gradient(135deg,var(--primary),var(--primary2));
  display:flex; align-items:center; justify-content:center;
  flex-shrink:0; box-shadow:0 4px 12px rgba(220,38,38,0.35);
}
.sidebar-logo-icon svg { width:18px; height:18px; stroke:white; fill:none; stroke-width:2.5; }
.sidebar-logo-text { font-size:14px; font-weight:800; color:white; letter-spacing:0.5px; line-height:1.2; }
.sidebar-logo-sub  { font-size:10px; color:rgba(255,255,255,0.35); font-weight:400; }

.sidebar-section { padding:16px 12px 4px; }
.sidebar-section-label {
  font-size:9px; font-weight:700; letter-spacing:2px;
  color:rgba(255,255,255,0.25); text-transform:uppercase;
  padding:0 8px; margin-bottom:6px;
}
.sidebar-item {
  display:flex; align-items:center; gap:10px;
  padding:10px 12px; border-radius:10px; cursor:pointer;
  color:rgba(255,255,255,0.55); font-size:13px; font-weight:500;
  text-decoration:none; transition:all 0.2s; margin-bottom:2px;
  position:relative;
}
.sidebar-item:hover { background:rgba(255,255,255,0.06); color:rgba(255,255,255,0.85); }
.sidebar-item.active {
  background:linear-gradient(135deg,rgba(220,38,38,0.25),rgba(185,28,28,0.15));
  color:white; border:1px solid rgba(220,38,38,0.25);
}
.sidebar-item.active::before {
  content:''; position:absolute; left:0; top:4px; bottom:4px;
  width:3px; background:var(--primary); border-radius:0 3px 3px 0;
}
.sidebar-item svg { width:16px; height:16px; flex-shrink:0; }
.sidebar-item .badge {
  margin-left:auto; background:var(--primary);
  color:white; font-size:9px; font-weight:700;
  padding:2px 7px; border-radius:20px;
}
.sidebar-arrow { margin-left:auto; transition:transform 0.2s; width:12px; height:12px; }
.sidebar-item.open .sidebar-arrow { transform:rotate(180deg); }
.sidebar-sub { display:none; padding-left:38px; }
.sidebar-sub.open { display:block; }
.sidebar-sub a {
  display:block; padding:7px 12px; color:rgba(255,255,255,0.40);
  font-size:12px; text-decoration:none; border-radius:8px;
  transition:all 0.2s; margin-bottom:1px;
}
.sidebar-sub a:hover, .sidebar-sub a.active { color:rgba(255,255,255,0.85); background:rgba(255,255,255,0.05); }

.sidebar-footer {
  margin-top:auto; padding:16px 12px;
  border-top:1px solid rgba(255,255,255,0.06);
}
.sidebar-user {
  display:flex; align-items:center; gap:10px;
  padding:10px 12px; border-radius:10px;
  background:rgba(255,255,255,0.05);
}
.sidebar-avatar {
  width:32px; height:32px; border-radius:50%;
  background:linear-gradient(135deg,var(--primary),var(--primary2));
  display:flex; align-items:center; justify-content:center;
  color:white; font-size:13px; font-weight:700; flex-shrink:0;
}
.sidebar-user-name  { font-size:12px; font-weight:600; color:white; }
.sidebar-user-role  { font-size:10px; color:rgba(255,255,255,0.35); }
.sidebar-logout {
  display:flex; align-items:center; gap:8px; margin-top:8px;
  padding:8px 12px; border-radius:8px; cursor:pointer;
  color:rgba(255,255,255,0.35); font-size:12px; text-decoration:none;
  transition:all 0.2s;
}
.sidebar-logout:hover { color:#EF4444; background:rgba(239,68,68,0.08); }
.sidebar-logout svg { width:14px; height:14px; }

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

/* ── TOPBAR ── */
.topbar {
  height:60px; background:white;
  border-bottom:1px solid var(--border);
  display:flex; align-items:center;
  padding:0 28px; gap:16px;
  position:sticky; top:0; z-index:50;
}
.topbar-title  { font-size:16px; font-weight:700; color:var(--text); }
.topbar-sub    { font-size:12px; color:var(--muted); margin-top:1px; }
.topbar-right  { margin-left:auto; display:flex; align-items:center; gap:12px; }
.topbar-user   {
  display:flex; align-items:center; gap:8px;
  padding:6px 14px; border-radius:20px;
  background:var(--primary-light); border:1px solid var(--border);
  font-size:13px; font-weight:600; color:var(--primary); cursor:pointer;
}
.topbar-avatar {
  width:28px; height:28px; border-radius:50%;
  background:linear-gradient(135deg,var(--primary),var(--primary2));
  display:flex; align-items:center; justify-content:center;
  color:white; font-size:11px; font-weight:700;
}

/* ── PAGE CONTENT ── */
.page { padding:28px; flex:1; }
.page-header { margin-bottom:24px; }
.page-title { font-size:22px; font-weight:800; color:var(--text); }
.page-sub   { font-size:13px; color:var(--muted); margin-top:3px; }

/* ── STAT CARDS ── */
.stats-section-label {
  font-size:11px; font-weight:700; color:var(--primary);
  letter-spacing:1px; text-transform:uppercase;
  display:flex; align-items:center; gap:8px; margin-bottom:12px;
}
.stats-section-label::before {
  content:''; width:16px; height:2px;
  background:var(--primary); border-radius:2px;
}
.stats-grid { display:grid; grid-template-columns:repeat(4,1fr); gap:14px; margin-bottom:20px; }
.stats-grid-3 { grid-template-columns:repeat(3,1fr); }

.stat-card {
  background:var(--card-bg); border-radius:var(--radius);
  padding:18px 20px; border:1px solid var(--border);
  display:flex; align-items:center; gap:14px;
  transition:box-shadow 0.2s;
}
.stat-card:hover { box-shadow:0 4px 20px rgba(220,38,38,0.08); }
.stat-icon {
  width:44px; height:44px; border-radius:12px; flex-shrink:0;
  display:flex; align-items:center; justify-content:center;
}
.stat-icon svg { width:20px; height:20px; }
.stat-num  { font-size:20px; font-weight:800; color:var(--text); line-height:1.1; }
.stat-lbl  { font-size:11px; color:var(--muted); margin-top:2px; font-weight:500; }

/* ── CHARTS ── */
.charts-grid { display:grid; grid-template-columns:1fr 1fr; gap:20px; margin-top:20px; }
.chart-card  {
  background:var(--card-bg); border-radius:var(--radius);
  border:1px solid var(--border); padding:20px;
}
.chart-header { display:flex; align-items:center; justify-content:space-between; margin-bottom:16px; }
.chart-title  { font-size:14px; font-weight:700; color:var(--text); }
.chart-select {
  padding:5px 10px; border-radius:8px; border:1px solid var(--border);
  font-family:'Kanit',sans-serif; font-size:12px; color:var(--text);
  background:var(--bg); outline:none;
}

/* ── DATE FILTER ── */
.date-filter {
  display:flex; align-items:center; gap:12px; flex-wrap:wrap;
  background:white; padding:16px 20px; border-radius:var(--radius);
  border:1px solid var(--border); margin-bottom:20px;
}
.date-filter label { font-size:12px; color:var(--muted); }
.date-input {
  padding:7px 12px; border-radius:8px; border:1px solid var(--border);
  font-family:'Kanit',sans-serif; font-size:13px; color:var(--text);
  background:var(--bg); outline:none;
}
.date-input:focus { border-color:var(--primary); }
.btn-filter {
  padding:8px 18px; border-radius:8px;
  background:linear-gradient(135deg,var(--primary),var(--primary2));
  color:white; font-family:'Kanit',sans-serif; font-size:13px; font-weight:600;
  border:none; cursor:pointer; transition:all 0.2s;
}
.btn-filter:hover { opacity:0.9; }
.btn-today {
  padding:8px 14px; border-radius:8px;
  background:var(--primary-light); color:var(--primary);
  font-family:'Kanit',sans-serif; font-size:13px; font-weight:600;
  border:1px solid var(--border); cursor:pointer; transition:all 0.2s;
}

/* ── LOGIN PAGE ── */
.login-bg {
  min-height:100vh; display:flex; align-items:center; justify-content:center;
  background:linear-gradient(135deg, #fff5f5 0%, #ffe4e4 50%, #fff5f5 100%);
}
.login-card {
  width:100%; max-width:400px; background:white;
  border-radius:20px; padding:40px 36px;
  box-shadow:0 20px 60px rgba(220,38,38,0.12);
  border:1px solid rgba(220,38,38,0.08);
}
.login-icon {
  width:64px; height:64px; border-radius:50%;
  background:linear-gradient(135deg,var(--primary),var(--primary2));
  display:flex; align-items:center; justify-content:center;
  margin:0 auto 16px; box-shadow:0 8px 24px rgba(220,38,38,0.30);
}
.login-icon svg { width:28px; height:28px; stroke:white; fill:none; stroke-width:2; }
.login-title { font-size:22px; font-weight:800; text-align:center; color:var(--text); }
.login-sub   { font-size:13px; color:var(--muted); text-align:center; margin-bottom:28px; }

.form-group  { margin-bottom:16px; }
.form-label  { font-size:12px; font-weight:700; color:#555; margin-bottom:6px; display:flex; align-items:center; gap:6px; }
.form-label svg { width:13px; height:13px; stroke:var(--primary); fill:none; stroke-width:2; }
.form-control {
  width:100%; padding:12px 16px;
  border:1.5px solid rgba(220,38,38,0.15);
  border-radius:10px; font-family:'Kanit',sans-serif; font-size:14px;
  color:var(--text); background:#FFFAFA; 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(220,38,38,0.10);
}
.btn-login {
  width:100%; padding:14px;
  background:linear-gradient(135deg,var(--primary),var(--primary2));
  color:white; font-family:'Kanit',sans-serif;
  font-size:15px; font-weight:700; border:none;
  border-radius:12px; cursor:pointer;
  box-shadow:0 6px 20px rgba(220,38,38,0.35);
  transition:all 0.3s; margin-top:8px;
  display:flex; align-items:center; justify-content:center; gap:8px;
}
.btn-login:hover { transform:translateY(-2px); box-shadow:0 10px 28px rgba(220,38,38,0.42); }
.alert-error {
  background:#FEF2F2; border:1px solid rgba(220,38,38,0.25);
  border-radius:8px; padding:10px 14px; font-size:13px; color:#B91C1C;
  margin-bottom:16px; display:flex; align-items:center; gap:8px;
}
.alert-error svg { width:14px; height:14px; stroke:#B91C1C; fill:none; stroke-width:2; flex-shrink:0; }

/* ── 2FA ── */
.otp-inputs { display:flex; gap:10px; justify-content:center; margin:20px 0; }
.otp-input {
  width:48px; height:56px; text-align:center; font-size:22px; font-weight:700;
  border:2px solid rgba(220,38,38,0.20); border-radius:12px;
  font-family:'Kanit',sans-serif; color:var(--text); background:#FFFAFA;
  outline:none; transition:all 0.2s;
}
.otp-input:focus { border-color:var(--primary); box-shadow:0 0 0 3px rgba(220,38,38,0.10); }
.btn-cancel {
  flex:1; padding:12px; border-radius:10px;
  border:1.5px solid var(--border); background:white;
  color:var(--muted); font-family:'Kanit',sans-serif;
  font-size:14px; font-weight:600; cursor:pointer; transition:all 0.2s;
}
.btn-confirm {
  flex:1; padding:12px; border-radius:10px;
  background:linear-gradient(135deg,var(--primary),var(--primary2));
  color:white; font-family:'Kanit',sans-serif;
  font-size:14px; font-weight:600; border:none; cursor:pointer; transition:all 0.2s;
}
.btn-confirm:hover { opacity:0.9; }

/* ── TABLE ── */
.table-card {
  background:white; border-radius:var(--radius);
  border:1px solid var(--border); overflow:hidden;
}
.table-header {
  display:flex; align-items:center; justify-content:space-between;
  padding:16px 20px; border-bottom:1px solid var(--border);
}
.table-title { font-size:14px; font-weight:700; color:var(--text); }
table { width:100%; border-collapse:collapse; }
th {
  padding:11px 16px; text-align:left; font-size:11px; font-weight:700;
  color:var(--muted); text-transform:uppercase; letter-spacing:0.5px;
  background:#FFF8F8; border-bottom:1px solid var(--border);
}
td {
  padding:12px 16px; font-size:13px; color:var(--text);
  border-bottom:1px solid rgba(220,38,38,0.05);
}
tr:last-child td { border-bottom:none; }
tr:hover td { background:rgba(220,38,38,0.02); }
.badge-status {
  display:inline-flex; align-items:center; gap:4px;
  padding:3px 10px; border-radius:20px; font-size:11px; font-weight:700;
}
.badge-success { background:#F0FDF4; color:#15803D; }
.badge-warning { background:#FFFBEB; color:#B45309; }
.badge-danger  { background:#FEF2F2; color:#B91C1C; }

/* ── COLORS ── */
.c-red    { background:rgba(220,38,38,0.10); }
.c-red svg { stroke:#DC2626; }
.c-green  { background:rgba(22,163,74,0.10); }
.c-green svg { stroke:#16A34A; }
.c-blue   { background:rgba(37,99,235,0.10); }
.c-blue svg { stroke:#2563EB; }
.c-purple { background:rgba(124,58,237,0.10); }
.c-purple svg { stroke:#7C3AED; }
.c-orange { background:rgba(234,88,12,0.10); }
.c-orange svg { stroke:#EA580C; }
.c-pink   { background:rgba(219,39,119,0.10); }
.c-pink svg { stroke:#DB2777; }
.c-teal   { background:rgba(13,148,136,0.10); }
.c-teal svg { stroke:#0D9488; }
.c-yellow { background:rgba(202,138,4,0.10); }
.c-yellow svg { stroke:#CA8A04; }
