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

:root {
  --sb:      240px;
  --bg:      #F4F6F9;
  --surface: #FFFFFF;
  --border:  #E2E8F0;
  --primary: #1C1409;
  --accent:  #C8902A;
  --text:    #2D3748;
  --muted:   #718096;
  --success: #38A169;
  --danger:  #E53E3E;
  --warning: #D69E2E;
  --info:    #3182CE;
  --t:       0.18s ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body { font-family: 'Inter', system-ui, sans-serif; background: var(--bg); color: var(--text); font-size: 14px; -webkit-font-smoothing: antialiased; }
a { text-decoration: none; color: inherit; }
img { display: block; max-width: 100%; }
button { cursor: pointer; font-family: inherit; }

/* ── LOGIN ──────────────────────────────────────────────────────── */
.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: var(--primary); padding: 20px;
  background-image: radial-gradient(circle at 20% 50%, rgba(200,144,42,0.12) 0%, transparent 60%);
}
.login-card {
  background: var(--surface); border-radius: 14px; padding: 48px 44px;
  width: 100%; max-width: 400px; box-shadow: 0 24px 64px rgba(0,0,0,0.4);
}
.login-brand { text-align: center; margin-bottom: 36px; }
.login-brand h2 { font-family: 'Playfair Display', serif; font-size: 1.7rem; color: var(--primary); margin-bottom: 4px; }
.login-brand h2 span { color: var(--accent); }
.login-brand p { font-size: 0.72rem; color: var(--muted); letter-spacing: 0.14em; text-transform: uppercase; }
.login-label { display: block; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; color: var(--text); margin-bottom: 6px; margin-top: 16px; }
.login-input {
  width: 100%; border: 1.5px solid var(--border); border-radius: 7px; padding: 12px 14px;
  font-size: 0.9rem; font-family: inherit; outline: none; transition: border var(--t); color: var(--text);
}
.login-input:focus { border-color: var(--accent); }
.login-btn {
  width: 100%; margin-top: 24px; padding: 13px; background: var(--accent); color: #fff;
  border: none; border-radius: 7px; font-size: 0.875rem; font-weight: 600; letter-spacing: 0.03em;
  transition: background var(--t);
}
.login-btn:hover { background: #b37d22; }
.login-error {
  background: #fff5f5; border: 1px solid #fed7d7; color: var(--danger);
  padding: 11px 14px; border-radius: 7px; font-size: 0.83rem; margin-top: 16px; display: none;
}
.login-error.show { display: block; }
.login-hint { font-size: 0.78rem; color: var(--muted); text-align: center; margin-top: 16px; }

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

/* ── SIDEBAR ────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sb); background: var(--primary); color: rgba(255,255,255,0.75);
  position: fixed; top: 0; bottom: 0; left: 0;
  display: flex; flex-direction: column; overflow-y: auto; z-index: 100;
}
.sidebar-brand { padding: 24px 20px 18px; border-bottom: 1px solid rgba(255,255,255,0.08); flex-shrink: 0; }
.sidebar-brand h3 { font-family: 'Playfair Display', serif; font-size: 1.2rem; color: #fff; }
.sidebar-brand h3 span { color: var(--accent); }
.sidebar-brand p { font-size: 0.66rem; color: rgba(255,255,255,0.32); letter-spacing: 0.14em; text-transform: uppercase; margin-top: 3px; }
.sidebar-section-title { font-size: 0.6rem; font-weight: 700; letter-spacing: 0.2em; text-transform: uppercase; color: rgba(255,255,255,0.28); padding: 18px 20px 8px; }
.sidebar-nav { flex: 1; padding-bottom: 16px; }
.sidebar-link {
  display: flex; align-items: center; gap: 10px; padding: 10px 20px;
  font-size: 0.84rem; color: rgba(255,255,255,0.58); transition: background var(--t), color var(--t);
  border: none; background: none; width: 100%; text-align: left; border-right: 2px solid transparent;
}
.sidebar-link:hover { background: rgba(255,255,255,0.06); color: rgba(255,255,255,0.9); }
.sidebar-link.active { background: rgba(200,144,42,0.18); color: #fff; border-right-color: var(--accent); }
.sidebar-link .s-icon { font-size: 1rem; width: 18px; text-align: center; opacity: 0.8; }
.sidebar-footer { padding: 16px 20px; border-top: 1px solid rgba(255,255,255,0.08); }
.sidebar-footer .sidebar-link { padding: 8px 0; }

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

/* ── TOPBAR ─────────────────────────────────────────────────────── */
.topbar {
  background: var(--surface); border-bottom: 1px solid var(--border);
  height: 60px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 28px; position: sticky; top: 0; z-index: 50;
}
.topbar-title { font-size: 1rem; font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.user-chip { display: flex; align-items: center; gap: 8px; font-size: 0.83rem; color: var(--muted); }
.avatar { width: 30px; height: 30px; background: var(--accent); border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 0.72rem; font-weight: 700; }
.logout-btn { font-size: 0.78rem; color: var(--muted); border: 1px solid var(--border); padding: 5px 12px; border-radius: 6px; background: none; transition: all var(--t); }
.logout-btn:hover { color: var(--danger); border-color: var(--danger); }

/* ── CONTENT ────────────────────────────────────────────────────── */
.admin-content { padding: 28px; flex: 1; }
.admin-page { display: none; }
.admin-page.active { display: block; }

/* ── STATS ──────────────────────────────────────────────────────── */
.stats-row { display: grid; grid-template-columns: repeat(4,1fr); gap: 18px; margin-bottom: 28px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 22px 24px; }
.stat-label { font-size: 0.68rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.stat-num { font-family: 'Playfair Display', serif; font-size: 2.2rem; font-weight: 600; color: var(--text); line-height: 1; }
.stat-sub { font-size: 0.76rem; color: var(--muted); margin-top: 6px; }

/* ── PANELS ─────────────────────────────────────────────────────── */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; margin-bottom: 22px; }
.panel-head { padding: 16px 22px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--border); }
.panel-head h4 { font-size: 0.9rem; font-weight: 600; }

/* ── TABLES ─────────────────────────────────────────────────────── */
.tbl-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; padding: 10px 16px; font-size: 0.66rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); background: #F7FAFC; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 13px 16px; font-size: 0.83rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #FAFBFC; }

/* ── BADGES ─────────────────────────────────────────────────────── */
.badge { display: inline-flex; padding: 2px 9px; border-radius: 20px; font-size: 0.66rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; white-space: nowrap; }
.badge-success { background: #C6F6D5; color: #22543D; }
.badge-warning { background: #FEFCBF; color: #744210; }
.badge-danger  { background: #FED7D7; color: #9B2C2C; }
.badge-info    { background: #BEE3F8; color: #2A4365; }
.badge-neutral { background: #EDF2F7; color: #4A5568; }
.badge-accent  { background: rgba(200,144,42,0.15); color: #7A5510; }

/* ── TOOLBAR ────────────────────────────────────────────────────── */
.toolbar-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; flex-wrap: wrap; gap: 10px; }
.toolbar-row h4 { font-size: 0.9rem; font-weight: 600; }
.toolbar-controls { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.add-btn { background: var(--accent); color: #fff; border: none; padding: 9px 18px; border-radius: 7px; font-size: 0.8rem; font-weight: 600; transition: background var(--t); }
.add-btn:hover { background: #b37d22; }
.reset-btn { background: none; color: var(--muted); border: 1px solid var(--border); padding: 8px 14px; border-radius: 7px; font-size: 0.78rem; transition: all var(--t); }
.reset-btn:hover { border-color: var(--danger); color: var(--danger); }
.search-input { border: 1.5px solid var(--border); border-radius: 7px; padding: 8px 13px; font-size: 0.82rem; font-family: inherit; outline: none; width: 200px; transition: border var(--t); }
.search-input:focus { border-color: var(--accent); }

/* ── ACTION BTNS ────────────────────────────────────────────────── */
.act-btns { display: flex; gap: 6px; }
.act-btn { padding: 5px 12px; border: 1px solid var(--border); background: none; border-radius: 5px; font-size: 0.73rem; font-weight: 500; transition: all var(--t); color: var(--text); }
.act-btn:hover { border-color: var(--accent); color: var(--accent); }
.act-btn.del:hover { border-color: var(--danger); color: var(--danger); }

/* ── MODAL ──────────────────────────────────────────────────────── */
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 200; display: none; align-items: center; justify-content: center; padding: 20px; }
.modal-bg.open { display: flex; }
.modal-box { background: var(--surface); border-radius: 12px; padding: 32px; width: 100%; max-width: 520px; max-height: 92vh; overflow-y: auto; box-shadow: 0 24px 64px rgba(0,0,0,0.22); }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.modal-head h3 { font-size: 1.05rem; font-weight: 600; }
.modal-close { background: none; border: none; font-size: 1.3rem; color: var(--muted); line-height: 1; transition: color var(--t); }
.modal-close:hover { color: var(--danger); }
.f-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.f-grp { margin-bottom: 4px; }
.f-grp.full { grid-column: 1 / -1; }
.f-grp label { display: block; font-size: 0.7rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text); margin-bottom: 6px; }
.f-grp input, .f-grp select, .f-grp textarea {
  width: 100%; border: 1.5px solid var(--border); border-radius: 6px; padding: 10px 11px;
  font-size: 0.875rem; font-family: inherit; outline: none; transition: border var(--t); color: var(--text);
}
.f-grp input:focus, .f-grp select:focus, .f-grp textarea:focus { border-color: var(--accent); }
.f-grp textarea { resize: vertical; min-height: 80px; }
.tags-row { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 4px; }
.tags-row label { display: flex; align-items: center; gap: 6px; font-size: 0.83rem; font-weight: 400; text-transform: none; letter-spacing: 0; cursor: pointer; }
.tags-row input[type="checkbox"] { accent-color: var(--accent); width: 15px; height: 15px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 24px; border-top: 1px solid var(--border); padding-top: 20px; }
.btn-save { background: var(--accent); color: #fff; border: none; padding: 10px 24px; border-radius: 7px; font-size: 0.85rem; font-weight: 600; transition: background var(--t); }
.btn-save:hover { background: #b37d22; }
.btn-cancel { background: none; color: var(--muted); border: 1px solid var(--border); padding: 10px 18px; border-radius: 7px; font-size: 0.85rem; transition: all var(--t); }
.btn-cancel:hover { border-color: var(--muted); color: var(--text); }

/* ── TOAST ──────────────────────────────────────────────────────── */
#admin-toast {
  position: fixed; bottom: 22px; right: 22px; z-index: 9999;
  background: var(--primary); color: #fff; padding: 12px 20px;
  border-radius: 8px; font-size: 0.83rem; font-weight: 500;
  box-shadow: 0 8px 28px rgba(0,0,0,0.25); transform: translateY(70px); opacity: 0;
  transition: transform 0.25s ease, opacity 0.25s ease; pointer-events: none;
}
#admin-toast.show { transform: translateY(0); opacity: 1; }

/* ── RESPONSIVE ─────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .stats-row { grid-template-columns: repeat(2,1fr); }
  .sidebar { transform: translateX(-100%); transition: transform 0.25s ease; }
  .sidebar.open { transform: translateX(0); }
  .admin-main { margin-left: 0; }
}
@media (max-width: 600px) {
  .stats-row { grid-template-columns: 1fr 1fr; }
  .f-row { grid-template-columns: 1fr; }
  .login-card { padding: 32px 24px; }
}
