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

:root {
  --bg: #0d1117; --bg2: #161b22; --bg3: #1c2128;
  --border: rgba(240,246,252,0.1); --border2: rgba(240,246,252,0.06);
  --text: #e6edf3; --muted: #8b949e; --sub: #6e7681;
  --accent: #f59e0b; --green: #3fb950; --red: #f85149; --blue: #58a6ff;
  --font: 'Sarabun','Inter',sans-serif;
  --radius: 6px; --radius-lg: 10px;
  --sidebar-w: 240px; --nav-h: 56px;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body { font-family: var(--font); background: var(--bg); color: var(--text); font-size: 14px; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: #fbbf24; }
input, textarea, select, button { font-family: var(--font); font-size: 14px; }
img { max-width: 100%; }

/* Layout */
.admin-layout { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); background: var(--bg2);
  border-right: 1px solid var(--border); flex-shrink: 0;
  position: fixed; top: 0; bottom: 0; left: 0; z-index: 100;
  display: flex; flex-direction: column;
  overflow-y: auto;
}
.sidebar-header { padding: 16px 20px; border-bottom: 1px solid var(--border); }
.sidebar-logo { display: flex; align-items: center; gap: 10px; }
.sidebar-logo-icon { width: 32px; height: 32px; background: var(--accent); border-radius: 6px; display: flex; align-items: center; justify-content: center; font-weight: 900; font-size: 13px; color: #000; }
.sidebar-logo-text { font-size: 14px; font-weight: 700; color: var(--text); }
.sidebar-nav { padding: 12px 0; flex: 1; }
.nav-section-label { padding: 6px 20px; font-size: 10px; font-weight: 700; color: var(--sub); text-transform: uppercase; letter-spacing: 1.5px; margin-top: 8px; }
.sidebar-link {
  display: flex; align-items: center; gap: 10px; padding: 9px 20px;
  font-size: 14px; color: var(--muted); transition: all 0.2s;
}
.sidebar-link:hover { color: var(--text); background: rgba(255,255,255,0.04); }
.sidebar-link.active { color: var(--accent); background: rgba(245,158,11,0.08); border-right: 2px solid var(--accent); }
.sidebar-link .icon { width: 16px; text-align: center; }

.main-wrap { margin-left: var(--sidebar-w); flex: 1; display: flex; flex-direction: column; min-height: 100vh; }
.topbar {
  height: var(--nav-h); background: var(--bg2); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; position: sticky; top: 0; z-index: 50;
}
.topbar-title { font-size: 16px; font-weight: 600; color: var(--text); }
.topbar-user { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--muted); }
.topbar-logout { padding: 6px 14px; background: rgba(248,81,73,0.1); border: 1px solid rgba(248,81,73,0.2); color: var(--red); border-radius: var(--radius); font-size: 12px; cursor: pointer; }
.topbar-logout:hover { background: rgba(248,81,73,0.2); }

.content { padding: 24px; flex: 1; }

/* Cards */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.stat-card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px; }
.stat-num { font-size: 28px; font-weight: 800; color: var(--text); font-family: 'Inter'; line-height: 1; margin-bottom: 4px; }
.stat-label { font-size: 12px; color: var(--muted); }
.stat-icon { float: right; font-size: 28px; margin-top: -4px; }

/* Tables */
.card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; margin-bottom: 24px; }
.card-header { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.card-title { font-size: 15px; font-weight: 600; color: var(--text); }
.card-body { padding: 20px; }
.table { width: 100%; border-collapse: collapse; }
.table th { padding: 10px 12px; text-align: left; font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; border-bottom: 1px solid var(--border); background: var(--bg3); }
.table td { padding: 12px; border-bottom: 1px solid var(--border2); font-size: 14px; vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: rgba(255,255,255,0.02); }
.table img { width: 40px; height: 40px; object-fit: cover; border-radius: 4px; }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: var(--radius); font-size: 13px; font-weight: 600; cursor: pointer; border: none; transition: all 0.2s; }
.btn-primary { background: var(--accent); color: #000; }
.btn-primary:hover { background: #fbbf24; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-danger  { background: rgba(248,81,73,0.1); border: 1px solid rgba(248,81,73,0.2); color: var(--red); }
.btn-danger:hover  { background: rgba(248,81,73,0.2); }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--muted); }
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }
.btn-success { background: rgba(63,185,80,0.1); border: 1px solid rgba(63,185,80,0.2); color: var(--green); }

/* Forms */
.form-group { margin-bottom: 18px; }
.form-label { display: block; font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.form-label span { color: var(--red); margin-left: 2px; }
.form-control {
  width: 100%; padding: 9px 12px;
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text); font-size: 14px; outline: none;
  transition: border-color 0.2s;
}
.form-control:focus { border-color: var(--accent); }
.form-control::placeholder { color: var(--sub); }
textarea.form-control { resize: vertical; min-height: 100px; }
.form-hint { font-size: 11px; color: var(--muted); margin-top: 4px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-actions { display: flex; gap: 10px; margin-top: 24px; }

/* Badge */
.badge { display: inline-block; padding: 2px 8px; border-radius: 100px; font-size: 11px; font-weight: 600; }
.badge-green  { background: rgba(63,185,80,0.15);  color: var(--green); }
.badge-red    { background: rgba(248,81,73,0.15);  color: var(--red); }
.badge-yellow { background: rgba(245,158,11,0.15); color: var(--accent); }

/* Image upload */
.img-upload-wrap { position: relative; display: inline-block; }
.img-preview { width: 120px; height: 90px; object-fit: cover; border-radius: var(--radius); border: 1px solid var(--border); background: var(--bg3); display: flex; align-items: center; justify-content: center; font-size: 32px; color: var(--muted); }
.img-preview img { width: 100%; height: 100%; object-fit: cover; border-radius: var(--radius); }

/* Alert */
.alert { padding: 12px 16px; border-radius: var(--radius); margin-bottom: 16px; font-size: 14px; }
.alert-success { background: rgba(63,185,80,0.1); border: 1px solid rgba(63,185,80,0.3); color: var(--green); }
.alert-error   { background: rgba(248,81,73,0.1);  border: 1px solid rgba(248,81,73,0.3);  color: var(--red); }

/* Pagination */
.pagination { display: flex; gap: 6px; margin-top: 16px; justify-content: center; }
.page-btn { padding: 6px 12px; background: var(--bg3); border: 1px solid var(--border); color: var(--muted); border-radius: var(--radius); font-size: 13px; }
.page-btn.active, .page-btn:hover { background: var(--accent); color: #000; border-color: var(--accent); }

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