/* ═══════════════════════════════════════════════════════════
   WORLD GLOBAL LIBRARY — Admin Dashboard CSS
   ═══════════════════════════════════════════════════════════ */

:root {
  /* Aligned with the public site's modernized brand palette (2026). */
  --primary:    #18336b;   /* brand navy */
  --primary-dk: #11244c;
  --primary-lt: #2456db;   /* interactive blue */
  --accent:     #f5b324;   /* refined gold */
  --green:      #15a34a;
  --white:      #ffffff;
  --bg:         #f3f6fb;
  --card:       #ffffff;
  --border:     #e4e9f2;
  --text:       #0e1b35;
  --muted:      #5b6b86;
  --danger:     #dc2626;
  --sidebar-w:  240px;
  --header-h:   58px;
  --ring:       0 0 0 3px rgba(36,86,219,.45);
  --font:       'Inter', 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, Arial, sans-serif;
}

/* WCAG 2.2 visible focus for keyboard users (admin). */
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible,
textarea:focus-visible, [tabindex]:focus-visible, .nav-item:focus-visible {
  outline: none; box-shadow: var(--ring); border-radius: 6px;
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration:.001ms!important; transition-duration:.001ms!important; }
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--font); background: var(--bg); color: var(--text); font-size: 14px; min-height: 100vh; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
button { cursor: pointer; font-family: var(--font); }
input, select, textarea { font-family: var(--font); }

/* ── Layout ──────────────────────────────────────────────── */
#app { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); background: var(--primary-dk, #091e4a);
  position: fixed; top: 0; bottom: 0; left: 0; z-index: 200;
  display: flex; flex-direction: column; overflow-y: auto;
  transition: transform .25s;
}
.sidebar-logo {
  padding: 16px; border-bottom: 1px solid rgba(255,255,255,.08);
  display: flex; align-items: center; gap: 10px;
}
.sidebar-logo .logo-icon {
  height: 30px; width: auto; object-fit: contain;
  display: block; flex-shrink: 0;
}
.sidebar-logo .logo-text { color: rgba(255,255,255,.9); line-height: 1.1; }
.sidebar-logo .logo-text strong { font-size: 11px; font-weight: 800; display: block; }
.sidebar-logo .logo-text small  { font-size: 9px; opacity: .6; }

.sidebar-nav { flex: 1; padding: 12px 0; }
.nav-section { font-size: 10px; font-weight: 700; letter-spacing: .8px; color: rgba(255,255,255,.35); padding: 12px 16px 4px; text-transform: uppercase; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; color: rgba(255,255,255,.72); font-size: 13px; font-weight: 500;
  cursor: pointer; border-left: 3px solid transparent; transition: all .15s;
}
.nav-item:hover { background: rgba(255,255,255,.07); color: var(--white); text-decoration: none; }
.nav-item.active { background: rgba(255,255,255,.1); color: var(--white); border-left-color: var(--accent); }
.nav-item .nav-icon { font-size: 16px; width: 20px; text-align: center; }

.main-area {
  margin-left: var(--sidebar-w);
  display: flex; flex-direction: column; min-height: 100vh; flex: 1;
}
.topbar {
  height: var(--header-h); background: var(--card);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; padding: 0 24px;
  position: sticky; top: 0; z-index: 100;
  gap: 16px;
}
.topbar h1 { font-size: 17px; font-weight: 800; flex: 1; }
.topbar .user-info { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.topbar .user-info .avatar {
  width: 32px; height: 32px; background: var(--primary);
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  color: var(--white); font-size: 13px; font-weight: 700;
}

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

/* ── Cards ───────────────────────────────────────────────── */
.card {
  background: var(--card); border-radius: 10px;
  border: 1px solid var(--border); padding: 20px;
  box-shadow: 0 1px 4px rgba(13,45,107,.05);
}
.card-title { font-size: 15px; font-weight: 800; margin-bottom: 16px; color: var(--primary); }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--card); border-radius: 10px; padding: 18px;
  border: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 4px;
}
.stat-card .stat-icon { font-size: 24px; margin-bottom: 4px; }
.stat-card .stat-value { font-size: 26px; font-weight: 900; color: var(--primary); }
.stat-card .stat-label { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .3px; }

/* ── Tables ──────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; padding: 9px 12px; background: var(--bg); border-bottom: 2px solid var(--border); font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .3px; white-space: nowrap; }
td { padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:hover td { background: #f8faff; }
.td-title { max-width: 260px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }

/* ── Badges ──────────────────────────────────────────────── */
.badge {
  display: inline-block; padding: 2px 8px; border-radius: 20px;
  font-size: 11px; font-weight: 700; white-space: nowrap;
}
.badge-published  { background: #d1fae5; color: #065f46; }
.badge-review     { background: #fef3c7; color: #92400e; }
.badge-pending    { background: #f3f4f6; color: #6b7280; }
.badge-rejected   { background: #fee2e2; color: #991b1b; }
.badge-unclassified { background: #ede9fe; color: #5b21b6; }

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 7px 14px; border-radius: 7px; font-size: 13px; font-weight: 600;
  border: none; cursor: pointer; transition: filter .15s; white-space: nowrap;
}
.btn:hover { filter: brightness(.9); }
.btn-primary { background: var(--primary); color: var(--white); }
.btn-accent  { background: var(--accent); color: #6b3800; }
.btn-green   { background: var(--green); color: var(--white); }
.btn-danger  { background: var(--danger); color: var(--white); }
.btn-outline { background: transparent; border: 1.5px solid var(--border); color: var(--text); }
.btn-sm { padding: 4px 9px; font-size: 11px; }
.btn-xs { padding: 2px 7px; font-size: 11px; }

/* ── Forms ───────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 5px; text-transform: uppercase; letter-spacing: .3px; }
.form-control {
  width: 100%; padding: 9px 12px; border: 1.5px solid var(--border);
  border-radius: 7px; font-size: 13px; color: var(--text); background: var(--bg);
  outline: none; transition: border-color .15s;
}
.form-control:focus { border-color: var(--primary); background: var(--white); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* ── Upload Area ─────────────────────────────────────────── */
.drop-zone {
  border: 2.5px dashed var(--border);
  border-radius: 12px;
  padding: 48px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s, background .2s;
  background: var(--bg);
}
.drop-zone.over { border-color: var(--primary); background: #eef2ff; }
.drop-zone .dz-icon { font-size: 40px; margin-bottom: 12px; }
.drop-zone h3 { font-size: 16px; color: var(--primary); margin-bottom: 6px; }
.drop-zone p  { font-size: 13px; color: var(--muted); margin-bottom: 14px; }

/* ── Progress Bar ────────────────────────────────────────── */
.progress-wrap { background: #e5e7eb; border-radius: 99px; height: 8px; overflow: hidden; }
.progress-bar  { height: 100%; background: var(--primary); border-radius: 99px; transition: width .3s; }
.progress-bar.success { background: var(--green); }
.progress-bar.error   { background: var(--danger); }

/* ── Upload Queue ────────────────────────────────────────── */
.upload-queue { margin-top: 20px; display: flex; flex-direction: column; gap: 8px; }
.queue-item {
  display: flex; align-items: center; gap: 12px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 8px; padding: 10px 14px;
}
.queue-item .qi-name { flex: 1; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.queue-item .qi-size { font-size: 11px; color: var(--muted); flex-shrink: 0; }
.queue-item .qi-status { font-size: 11px; font-weight: 700; flex-shrink: 0; }
.qi-status.done    { color: var(--green); }
.qi-status.error   { color: var(--danger); }
.qi-status.pending { color: var(--muted); }
.qi-status.uploading { color: var(--primary); }
.qi-progress { width: 100px; flex-shrink: 0; }

/* ── Login ───────────────────────────────────────────────── */
.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #091e4a 0%, #0d2d6b 100%);
}
.login-box {
  background: var(--white); border-radius: 14px; padding: 40px;
  width: 100%; max-width: 380px; box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.login-box .login-logo { text-align: center; margin-bottom: 28px; }
.login-box .login-logo .logo-icon { height: 46px; width: auto; object-fit: contain; display: block; margin: 0 auto 12px; }
.login-box .login-logo h2 { font-size: 18px; font-weight: 900; color: var(--primary); }
.login-box .login-logo p  { font-size: 12px; color: var(--muted); }
.login-error { background: #fee2e2; color: var(--danger); border-radius: 7px; padding: 10px 12px; font-size: 13px; margin-bottom: 14px; display: none; }
.login-error.show { display: block; }

/* ── Alerts ──────────────────────────────────────────────── */
.alert { padding: 12px 16px; border-radius: 8px; font-size: 13px; margin-bottom: 16px; }
.alert-success { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.alert-error   { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.alert-info    { background: #dbeafe; color: #1e40af; border: 1px solid #93c5fd; }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-area { margin-left: 0; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .form-row { grid-template-columns: 1fr; }
}
