/* ============================================================
   D&O Admin Panel — Master Stylesheet
   assets/css/admin.css
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Syne:wght@600;700;800&family=DM+Sans:wght@300;400;500;600&family=DM+Mono:wght@400;500&display=swap');

:root {
  --bg:       #09090b;
  --bg-2:     #0f0f12;
  --bg-3:     #18181f;
  --bg-4:     #222230;
  --gold:     #c9973c;
  --gold-h:   #e3b85a;
  --gold-p:   rgba(201,151,60,.1);
  --gold-g:   rgba(201,151,60,.2);
  --green:    #22c55e;
  --red:      #ef4444;
  --blue:     #3b82f6;
  --amber:    #f59e0b;
  --white:    #f0eee9;
  --muted:    #5a5a6e;
  --slate:    #8888a0;
  --border:   rgba(255,255,255,.06);
  --r:        10px;
  --shadow:   0 16px 50px rgba(0,0,0,.5);
  --t:        all .28s cubic-bezier(.25,.8,.25,1);
  --sidebar:  260px;
}

*,*::before,*::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--white);
  font-size: 14px;
  min-height: 100vh;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; }
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--bg-4); border-radius: 2px; }

/* ── Layout ──────────────────────────────────────── */
.layout { display: flex; min-height: 100vh; }
.main-content { margin-left: var(--sidebar); flex: 1; padding: 30px 32px; min-height: 100vh; }

/* ── Sidebar ─────────────────────────────────────── */
.sidebar {
  width: var(--sidebar);
  background: var(--bg-2);
  border-right: 1px solid var(--border);
  position: fixed; top: 0; left: 0; bottom: 0;
  display: flex; flex-direction: column;
  z-index: 100; overflow-y: auto;
  transition: transform .28s ease;
}
.sb-head {
  padding: 22px 20px 18px;
  border-bottom: 1px solid var(--border);
}
.sb-logo {
  display: flex; align-items: center; gap: 10px;
  font-family: 'Syne', sans-serif; font-weight: 800;
  font-size: 20px; color: var(--white);
}
.sb-logo-box {
  width: 38px; height: 38px;
  background: linear-gradient(135deg, var(--gold), var(--gold-h));
  border-radius: 8px; display: flex;
  align-items: center; justify-content: center;
  font-size: 13px; font-weight: 900; color: var(--bg);
  font-family: 'DM Mono', monospace;
  box-shadow: 0 4px 16px var(--gold-g); flex-shrink: 0;
}
.sb-badge {
  font-size: 9px; background: var(--gold-p);
  border: 1px solid var(--gold-g); color: var(--gold);
  border-radius: 4px; padding: 2px 8px;
  font-family: 'DM Mono', monospace;
  letter-spacing: .08em; text-transform: uppercase;
  margin-top: 6px; display: inline-block;
}

.sb-nav { flex: 1; padding: 14px 0; }
.sb-section {
  font-size: 9px; font-weight: 600; color: var(--muted);
  letter-spacing: .16em; text-transform: uppercase;
  padding: 14px 20px 5px;
  font-family: 'DM Mono', monospace;
}
.sb-nav a {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 20px; color: var(--slate);
  font-size: 13.5px; font-weight: 500;
  border-left: 3px solid transparent;
  transition: var(--t); position: relative;
}
.sb-nav a:hover { color: var(--white); background: rgba(255,255,255,.03); }
.sb-nav a.active {
  color: var(--gold);
  background: var(--gold-p);
  border-left-color: var(--gold);
}
.sb-nav a .nav-ico { font-size: 16px; width: 20px; text-align: center; flex-shrink: 0; }
.sb-nav a .nav-badge {
  margin-left: auto; background: var(--red);
  color: #fff; border-radius: 10px;
  font-size: 10px; font-weight: 700;
  padding: 1px 6px; line-height: 16px;
}

.sb-foot {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
}
.sb-admin {
  display: flex; align-items: center; gap: 10px; margin-bottom: 12px;
}
.sb-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), var(--gold-h));
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 13px; color: var(--bg);
  font-family: 'Syne', sans-serif; flex-shrink: 0;
}
.sb-admin-name { font-size: 13px; font-weight: 600; color: var(--white); line-height: 1.2; }
.sb-admin-role { font-size: 10px; color: var(--muted); text-transform: capitalize; }

/* ── Topbar ──────────────────────────────────────── */
.topbar {
  display: flex; align-items: flex-start;
  justify-content: space-between; margin-bottom: 28px;
  padding-bottom: 20px; border-bottom: 1px solid var(--border);
}
.topbar-left h1 {
  font-family: 'Syne', sans-serif;
  font-size: 28px; font-weight: 800; color: var(--white); line-height: 1;
}
.topbar-left p { color: var(--slate); font-size: 13px; margin-top: 4px; }
.topbar-right { display: flex; gap: 10px; align-items: center; flex-shrink: 0; }

/* ── AJAX Search Bar ─────────────────────────────── */
.search-wrap {
  position: relative;
  display: flex; align-items: center;
}
.search-wrap input {
  background: var(--bg-3); border: 1px solid var(--border);
  border-radius: 9px; color: var(--white);
  padding: 9px 40px 9px 38px; font-size: 13.5px; width: 300px;
  transition: var(--t); font-family: 'DM Sans', sans-serif;
}
.search-wrap input:focus {
  outline: none; border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-p); width: 360px;
}
.search-wrap input::placeholder { color: var(--muted); }
.search-ico {
  position: absolute; left: 11px;
  color: var(--muted); font-size: 15px; pointer-events: none;
}
.search-clear {
  position: absolute; right: 10px;
  color: var(--muted); font-size: 14px;
  cursor: pointer; display: none;
  background: none; border: none; padding: 0;
  transition: var(--t);
}
.search-clear:hover { color: var(--white); }
.search-dropdown {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0;
  background: var(--bg-3); border: 1px solid var(--border);
  border-radius: 10px; box-shadow: var(--shadow);
  z-index: 500; max-height: 360px; overflow-y: auto;
  display: none;
}
.search-dropdown.open { display: block; }
.search-result-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px; border-bottom: 1px solid var(--border);
  cursor: pointer; transition: var(--t);
}
.search-result-item:last-child { border: none; }
.search-result-item:hover { background: var(--bg-4); }
.sri-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--gold-p); border: 1px solid var(--gold-g);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: var(--gold);
  flex-shrink: 0; font-family: 'Syne', sans-serif;
}
.sri-name { font-size: 13px; font-weight: 600; }
.sri-meta { font-size: 11px; color: var(--muted); }
.search-empty, .search-loading {
  padding: 20px; text-align: center;
  font-size: 13px; color: var(--muted);
}

/* ── Stat Cards ─────────────────────────────────── */
.stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px,1fr)); gap: 14px; margin-bottom: 28px; }
.stat-card {
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--r); padding: 20px;
  border-top: 3px solid var(--gold);
  transition: var(--t); position: relative; overflow: hidden;
}
.stat-card.green  { border-top-color: var(--green); }
.stat-card.red    { border-top-color: var(--red); }
.stat-card.blue   { border-top-color: var(--blue); }
.stat-card.amber  { border-top-color: var(--amber); }
.stat-card:hover  { transform: translateY(-3px); box-shadow: var(--shadow); }
.stat-card::after {
  content: '';
  position: absolute; top: 0; right: 0;
  width: 80px; height: 80px;
  background: radial-gradient(circle at top right, rgba(255,255,255,.02), transparent);
}
.stat-val {
  font-family: 'Syne', sans-serif;
  font-size: 36px; font-weight: 800; color: var(--white); line-height: 1;
}
.stat-lbl { font-size: 11px; color: var(--slate); text-transform: uppercase; letter-spacing: .06em; margin-top: 5px; }
.stat-sub { font-size: 11px; color: var(--muted); margin-top: 3px; }

/* ── Cards ──────────────────────────────────────── */
.card {
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--r); padding: 22px;
}
.card-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 18px; padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.card-head h4 { font-family: 'Syne', sans-serif; font-size: 17px; font-weight: 700; margin: 0; }

/* ── Tables ─────────────────────────────────────── */
.tbl-wrap { overflow-x: auto; border-radius: var(--r); }
table.data-table { width: 100%; border-collapse: collapse; }
table.data-table thead th {
  background: var(--bg-3); color: var(--slate);
  font-size: 10px; font-weight: 700; letter-spacing: .12em;
  text-transform: uppercase; padding: 11px 14px;
  white-space: nowrap; border: none;
  font-family: 'DM Mono', monospace;
}
table.data-table tbody td {
  padding: 12px 14px; border-bottom: 1px solid var(--border);
  vertical-align: middle; font-size: 13.5px;
}
table.data-table tbody tr:last-child td { border: none; }
table.data-table tbody tr:hover td { background: rgba(255,255,255,.018); }

/* ── Badges ─────────────────────────────────────── */
.badge {
  font-size: 11px; font-weight: 600; padding: 3px 9px;
  border-radius: 6px; display: inline-block; letter-spacing: .03em;
  font-family: 'DM Mono', monospace;
}
.badge-active  { background: rgba(34,197,94,.12); color: #86efac; border: 1px solid rgba(34,197,94,.25); }
.badge-pending { background: rgba(245,158,11,.12); color: #fde68a; border: 1px solid rgba(245,158,11,.25); }
.badge-danger  { background: rgba(239,68,68,.12);  color: #fca5a5; border: 1px solid rgba(239,68,68,.25); }
.badge-muted   { background: rgba(255,255,255,.06); color: var(--slate); border: 1px solid var(--border); }

/* ── Buttons ─────────────────────────────────────── */
.btn {
  font-family: 'DM Sans', sans-serif; font-size: 13px;
  font-weight: 600; border-radius: 8px;
  padding: 8px 16px; border: none; cursor: pointer;
  transition: var(--t); display: inline-flex;
  align-items: center; gap: 6px; line-height: 1.4;
}
.btn-gold   { background: linear-gradient(135deg, var(--gold), var(--gold-h)); color: var(--bg); }
.btn-gold:hover { transform: translateY(-1px); box-shadow: 0 6px 20px var(--gold-g); }
.btn-ghost  { background: var(--bg-3); border: 1px solid var(--border); color: var(--white); }
.btn-ghost:hover { border-color: var(--gold); color: var(--gold); }
.btn-green  { background: rgba(34,197,94,.15); border: 1px solid rgba(34,197,94,.3); color: #86efac; }
.btn-green:hover { background: rgba(34,197,94,.25); }
.btn-red    { background: rgba(239,68,68,.15); border: 1px solid rgba(239,68,68,.3); color: #fca5a5; }
.btn-red:hover { background: rgba(239,68,68,.25); }
.btn-amber  { background: rgba(245,158,11,.15); border: 1px solid rgba(245,158,11,.3); color: #fde68a; }
.btn-amber:hover { background: rgba(245,158,11,.25); }
.btn-sm { padding: 5px 11px; font-size: 12px; }
.btn:disabled { opacity: .4; cursor: not-allowed; transform: none !important; }

/* ── Forms ──────────────────────────────────────── */
.form-group { margin-bottom: 18px; }
.form-label {
  display: block; font-size: 10.5px; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase;
  color: var(--slate); margin-bottom: 6px;
  font-family: 'DM Mono', monospace;
}
.form-control, .form-select {
  width: 100%; background: var(--bg-3); border: 1px solid var(--border);
  border-radius: 8px; color: var(--white);
  padding: 9px 13px; font-size: 14px;
  transition: var(--t); font-family: 'DM Sans', sans-serif;
}
.form-control:focus, .form-select:focus {
  outline: none; border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-p); background: var(--bg-3);
}
.form-control::placeholder { color: var(--muted); }
.form-select option { background: var(--bg-3); }
.form-text { font-size: 11px; color: var(--muted); margin-top: 4px; }

/* ── Alerts & Toast ─────────────────────────────── */
.alert { padding: 12px 16px; border-radius: 9px; font-size: 13.5px; border: 1px solid transparent; }
.alert-success { background: rgba(34,197,94,.08); border-color: rgba(34,197,94,.25); color: #86efac; }
.alert-danger  { background: rgba(239,68,68,.08); border-color: rgba(239,68,68,.25); color: #fca5a5; }
.alert-warning { background: rgba(245,158,11,.08); border-color: rgba(245,158,11,.25); color: #fde68a; }

#toast-area { position: fixed; top: 20px; right: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 10px; width: 320px; }
.toast-item {
  padding: 13px 16px; border-radius: 9px; font-size: 13.5px;
  display: flex; align-items: flex-start; gap: 10px;
  animation: toastIn .25s ease;
  box-shadow: 0 8px 30px rgba(0,0,0,.4);
  border: 1px solid transparent;
}
.toast-item.success { background: #0c2012; border-color: rgba(34,197,94,.3); color: #86efac; }
.toast-item.error   { background: #200c0c; border-color: rgba(239,68,68,.3); color: #fca5a5; }
.toast-item.warning { background: #1a1200; border-color: rgba(245,158,11,.3); color: #fde68a; }
.toast-item.info    { background: #0c1220; border-color: rgba(59,130,246,.3); color: #93c5fd; }
.toast-close { margin-left: auto; cursor: pointer; opacity: .6; background: none; border: none; color: inherit; font-size: 15px; flex-shrink: 0; }
@keyframes toastIn { from { opacity:0; transform: translateX(30px); } to { opacity:1; transform:translateX(0); } }

/* ── Spinner ─────────────────────────────────────── */
.spin {
  display: inline-block; width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,.2); border-top-color: var(--white);
  border-radius: 50%; animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Modal ───────────────────────────────────────── */
.modal-backdrop {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.75); backdrop-filter: blur(6px);
  z-index: 2000; align-items: center; justify-content: center; padding: 20px;
}
.modal-backdrop.open { display: flex; }
.modal-box {
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: 14px; width: 100%; max-width: 540px;
  box-shadow: 0 40px 100px rgba(0,0,0,.7);
  position: relative;
}
.modal-box.wide { max-width: 780px; }
.modal-head {
  padding: 20px 24px; border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
}
.modal-head h4 { font-family: 'Syne', sans-serif; font-size: 18px; font-weight: 700; margin: 0; }
.modal-close {
  width: 32px; height: 32px; border-radius: 7px;
  background: var(--bg-3); border: 1px solid var(--border);
  color: var(--slate); cursor: pointer; font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  transition: var(--t);
}
.modal-close:hover { background: var(--red); border-color: var(--red); color: #fff; }
.modal-body { padding: 24px; }
.modal-foot { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }

/* ── Auth pages ──────────────────────────────────── */
.auth-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(ellipse 60% 50% at 50% 30%, rgba(201,151,60,.08) 0%, transparent 65%),
    var(--bg);
  padding: 40px 16px;
}
.auth-box {
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: 16px; width: 100%; max-width: 440px;
  padding: 38px; box-shadow: 0 30px 80px rgba(0,0,0,.6);
}
.auth-logo { display: flex; align-items: center; gap: 12px; margin-bottom: 28px; }
.auth-logo-box {
  width: 44px; height: 44px;
  background: linear-gradient(135deg, var(--gold), var(--gold-h));
  border-radius: 9px; display: flex; align-items: center; justify-content: center;
  font-family: 'DM Mono', monospace; font-weight: 900; font-size: 16px; color: var(--bg);
  box-shadow: 0 4px 18px var(--gold-g);
}
.auth-logo-text { font-family: 'Syne', sans-serif; font-size: 21px; font-weight: 800; color: var(--white); }
.auth-logo-sub  { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .12em; }
.auth-box h2 { font-family: 'Syne', sans-serif; font-size: 26px; font-weight: 800; margin-bottom: 5px; }
.auth-sub { font-size: 13.5px; color: var(--slate); margin-bottom: 24px; }

/* ── Detail view ─────────────────────────────────── */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.detail-item { padding: 12px 14px; background: var(--bg-3); border-radius: 8px; border: 1px solid var(--border); }
.detail-label { font-size: 9.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .1em; font-family: 'DM Mono', monospace; margin-bottom: 3px; }
.detail-val { font-size: 14px; font-weight: 500; }
.detail-val.gold { color: var(--gold); }

/* ── Tabs ────────────────────────────────────────── */
.tabs { display: flex; gap: 4px; background: var(--bg-3); border-radius: 9px; padding: 4px; margin-bottom: 22px; width: fit-content; }
.tab-btn { padding: 8px 20px; border-radius: 7px; border: none; font-family: 'DM Sans', sans-serif; font-size: 13.5px; font-weight: 600; cursor: pointer; transition: var(--t); background: transparent; color: var(--muted); }
.tab-btn.active { background: var(--gold); color: var(--bg); }
.tab-btn:hover:not(.active) { color: var(--white); }
.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ── Pagination ──────────────────────────────────── */
.pagination { display: flex; gap: 6px; align-items: center; justify-content: center; margin-top: 22px; }
.pg-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 7px;
  font-size: 13px; font-weight: 500; background: var(--bg-3);
  border: 1px solid var(--border); color: var(--slate); transition: var(--t);
}
.pg-btn:hover { border-color: var(--gold); color: var(--gold); }
.pg-btn.active { background: var(--gold); border-color: var(--gold); color: var(--bg); font-weight: 700; }

/* ── Empty state ─────────────────────────────────── */
.empty { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty-icon { font-size: 52px; margin-bottom: 14px; opacity: .35; }
.empty h5 { color: var(--slate); margin-bottom: 6px; font-size: 17px; }

/* ── Filter bar ──────────────────────────────────── */
.filter-bar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 20px; align-items: center; }
.filter-bar select, .filter-bar input {
  background: var(--bg-3); border: 1px solid var(--border);
  border-radius: 8px; color: var(--white); padding: 8px 13px;
  font-size: 13.5px; font-family: 'DM Sans', sans-serif;
  transition: var(--t);
}
.filter-bar select:focus, .filter-bar input:focus {
  outline: none; border-color: var(--gold);
}

/* ── Mobile toggle ───────────────────────────────── */
.mob-toggle {
  display: none; position: fixed; top: 14px; left: 14px; z-index: 200;
  background: var(--gold); border: none; border-radius: 8px;
  width: 40px; height: 40px; cursor: pointer; font-size: 18px;
  color: var(--bg); align-items: center; justify-content: center;
}
.sb-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 99; }

@media(max-width: 1024px) {
  .mob-toggle { display: flex; }
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .sb-overlay.show { display: block; }
  .main-content { margin-left: 0; padding: 60px 16px 24px; }
  .stats-row { grid-template-columns: 1fr 1fr; }
  .search-wrap input { width: 200px; }
  .search-wrap input:focus { width: 240px; }
}
@media(max-width: 640px) {
  .stats-row { grid-template-columns: 1fr 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  .topbar { flex-direction: column; gap: 14px; }
  .topbar-right { width: 100%; }
  .search-wrap input { width: 100%; }
  .search-wrap input:focus { width: 100%; }
}
