/* ═══════════════════════════════════════════════════════════════
   EpildaTranslator v4.3_LAMAR — Admin CSS
   Full mobile-responsive · Black & Gold Epilda brand

   v4.3_LAMAR mobile fix:
    - Added .mob-bar (fixed top bar with hamburger) — was referenced in JS but missing from CSS/HTML
    - Added .mob-menu-btn, .sidebar-close, .sidebar-overlay — all missing
    - main-content on mobile now has padding-top equal to mob-bar height
    - sidebar z-index raised above mob-bar so it slides over cleanly
═══════════════════════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --black:        #0a0a0a;
  --bg:           #0f0f0f;
  --surface:      #141414;
  --surface2:     #1a1a1a;
  --surface3:     #222;
  --border:       #2a2a2a;
  --border2:      #333;
  --gold:         #c9a227;
  --gold2:        #e6bb3a;
  --gold3:        #f5d060;
  --gold-dim:     rgba(201,162,39,.13);
  --gold-border:  rgba(201,162,39,.30);
  --text:         #f0f0f0;
  --text-muted:   #888;
  --text-dim:     #555;
  --green:        #22c55e;
  --red:          #ef4444;
  --blue:         #3b82f6;
  --orange:       #f97316;
  --purple:       #a855f7;
  --teal:         #14b8a6;
  --sidebar-w:    220px;
  --mob-bar-h:    56px;
  --radius:       10px;
  --radius-sm:    7px;
  --shadow:       0 4px 24px rgba(0,0,0,.5);
}

html { font-size: 15px; scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  line-height: 1.6;
  min-height: 100vh;
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--surface); }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gold); }

/* ── SIDEBAR ──────────────────────────────────────────────── */
.sidebar {
  position: fixed; top: 0; left: 0;
  width: var(--sidebar-w); height: 100vh;
  background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  z-index: 400; transition: transform .25s ease; overflow: hidden;
}
.sidebar-logo {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 16px 14px; border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.logo-icon { font-size: 22px; }
.logo-name { font-size: 15px; font-weight: 800; color: var(--gold); letter-spacing: -.3px; }
.logo-version { font-size: 10px; color: var(--text-muted); letter-spacing: .05em; margin-top: 1px; }

.sidebar-nav { flex: 1; padding: 10px 8px; overflow-y: auto; list-style: none; }
.sidebar-nav li { margin-bottom: 2px; }
.sidebar-link {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: var(--radius-sm);
  text-decoration: none; color: var(--text-muted);
  font-size: 14px; font-weight: 500; transition: .15s;
}
.sidebar-link:hover { background: var(--surface2); color: var(--text); }
.sidebar-link.active { background: var(--gold-dim); color: var(--gold); font-weight: 600; border: 1px solid var(--gold-border); }
.sidebar-icon { font-size: 16px; width: 20px; text-align: center; flex-shrink: 0; }
.sidebar-footer { padding: 14px 16px; border-top: 1px solid var(--border); font-size: 12px; flex-shrink: 0; }

/* ── Close button inside sidebar (mobile only) ── */
.sidebar-close {
  display: none;
  position: absolute; top: 10px; right: 10px;
  background: var(--surface3); border: 1px solid var(--border2);
  color: var(--text-muted); border-radius: 8px;
  width: 34px; height: 34px;
  align-items: center; justify-content: center;
  font-size: 18px; cursor: pointer; z-index: 10;
  transition: background .15s, color .15s;
}
.sidebar-close:hover { background: var(--surface2); color: var(--text); }

/* ── MOBILE TOP BAR (hamburger) ───────────────────────────── */
/* Hidden on desktop — shown only on mobile via media query    */
.mob-bar {
  display: none;
  position: fixed; top: 0; left: 0; right: 0;
  height: var(--mob-bar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  align-items: center; justify-content: space-between;
  padding: 0 16px;
  z-index: 350;
}
.mob-bar-title {
  font-size: 15px; font-weight: 700; color: var(--gold);
  letter-spacing: -.2px;
}
.mob-menu-btn {
  display: flex; flex-direction: column; justify-content: center;
  gap: 5px; width: 38px; height: 38px;
  background: var(--surface2); border: 1px solid var(--border2);
  border-radius: var(--radius-sm); cursor: pointer; padding: 8px;
  transition: background .15s, border-color .15s;
}
.mob-menu-btn:hover { background: var(--surface3); border-color: var(--gold-border); }
.mob-menu-btn span {
  display: block; height: 2px; background: var(--text);
  border-radius: 2px; transition: background .15s;
}
.mob-menu-btn:hover span { background: var(--gold); }

/* ── SIDEBAR OVERLAY (dim backdrop on mobile) ─────────────── */
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.6);
  z-index: 390;
  backdrop-filter: blur(2px);
}
.sidebar-overlay.show { display: block; }

/* ── MAIN CONTENT ─────────────────────────────────────────── */
.main-content { margin-left: var(--sidebar-w); min-height: 100vh; padding: 28px 28px 40px; max-width: 1500px; }

/* ── PAGE HEADER ──────────────────────────────────────────── */
.page-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 24px; flex-wrap: wrap; gap: 12px;
}
.page-header h1 { font-size: 22px; font-weight: 700; }
.subtitle { color: var(--text-muted); font-size: 13px; margin-top: 3px; }
.header-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ── STAT GRID ────────────────────────────────────────────── */
.stat-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px; margin-bottom: 24px;
}
.stat-card {
  background: rgba(255,255,255,.03);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: var(--radius);
  padding: 18px 18px 18px 16px;
  display: flex; align-items: center; gap: 14px;
  transition: border-color .15s, transform .15s, box-shadow .15s;
  box-shadow: 0 10px 30px rgba(0,0,0,.25);
}
.stat-card:hover {
  transform: translateY(-1px);
  border-color: rgba(255,255,255,.18);
  box-shadow: 0 14px 38px rgba(0,0,0,.28);
}
.stat-icon {
  width: 46px; height: 46px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; flex-shrink: 0; color: #fff;
}
.stat-icon.gold   { background: #c9a227; }
.stat-icon.green  { background: #22c55e; }
.stat-icon.blue   { background: #3b82f6; }
.stat-icon.red    { background: #ef4444; }
.stat-icon.orange { background: #f97316; }
.stat-icon.purple { background: #a855f7; }
.stat-icon.teal   { background: #14b8a6; }

.stat-body { min-width: 0; }
.stat-value { font-size: 24px; font-weight: 800; line-height: 1.05; color: #fff; }
.stat-label { font-size: 11px; color: var(--text-dim); text-transform: uppercase; letter-spacing: .08em; margin-top: 2px; }

/* ── CARDS ────────────────────────────────────────────────── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.card-title { font-size: 15px; font-weight: 600; margin-bottom: 16px; display: flex; align-items: center; gap: 8px; }

/* ── BUTTONS ──────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 600; cursor: pointer;
  border: 1px solid transparent; text-decoration: none;
  transition: .15s; white-space: nowrap;
}
.btn-primary   { background: var(--gold); color: #000; border-color: var(--gold); }
.btn-primary:hover { background: var(--gold2); }
.btn-secondary { background: var(--surface2); color: var(--text); border-color: var(--border2); }
.btn-secondary:hover { background: var(--surface3); }
.btn-ghost     { background: transparent; color: var(--text-muted); border-color: var(--border); }
.btn-ghost:hover { background: var(--surface2); color: var(--text); }
.btn-danger    { background: rgba(239,68,68,.12); color: var(--red); border-color: rgba(239,68,68,.25); }
.btn-danger:hover { background: rgba(239,68,68,.22); }
.btn-green     { background: rgba(34,197,94,.12); color: var(--green); border-color: rgba(34,197,94,.25); }
.btn-green:hover { background: rgba(34,197,94,.22); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-xs { padding: 3px 8px; font-size: 11px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.alert-banner {
  background: rgba(34,197,94,.12);
  border: 1px solid rgba(34,197,94,.27);
  color: #dcfce7;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
}

/* ── BADGES ───────────────────────────────────────────────── */
.badge {
  display: inline-block; padding: 2px 8px; border-radius: 12px;
  font-size: 11px; font-weight: 600; line-height: 1.5;
}
.badge-green  { background: rgba(34,197,94,.15);  color: var(--green); }
.badge-red    { background: rgba(239,68,68,.15);  color: var(--red); }
.badge-orange { background: rgba(249,115,22,.15); color: var(--orange); }
.badge-gold   { background: rgba(201,162,39,.15); color: var(--gold); }
.badge-blue   { background: rgba(59,130,246,.15); color: var(--blue); }
.badge-purple { background: rgba(168,85,247,.15); color: var(--purple); }
.badge-gray   { background: rgba(136,136,136,.15); color: var(--text-muted); }

/* ── TABLE ────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); }
.stats, .stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat, .stat-card { display: flex; gap: 12px; align-items: center; padding: 16px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); transition: border-color .15s, transform .15s; }
.stat-card:hover { transform: translateY(-1px); border-color: rgba(255,255,255,.12); }
.stat-icon { width: 42px; height: 42px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 16px; flex-shrink: 0; }
.stat-icon.gold   { background: rgba(201,162,39,.15); color: var(--gold); }
.stat-icon.green  { background: rgba(34,197,94,.12);  color: var(--green); }
.stat-icon.blue   { background: rgba(59,130,246,.12); color: var(--blue); }
.stat-icon.red    { background: rgba(239,68,68,.12);  color: var(--red); }
.stat-icon.orange { background: rgba(249,115,22,.12); color: var(--orange); }
.stat-icon.purple { background: rgba(168,85,247,.12); color: var(--purple); }
.stat-icon.teal   { background: rgba(20,184,166,.12); color: var(--teal); }
.stat-body { min-width: 0; }
.stat-value { font-size: 22px; font-weight: 700; line-height: 1.1; }
.stat-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .08em; margin-top: 2px; }
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.65); display: none; align-items: center; justify-content: center; padding: 20px; z-index: 9999; }
.modal-overlay.show { display: flex; }
.modal-panel { width: min(100%, 980px); max-height: 90vh; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); display: flex; flex-direction: column; overflow: hidden; }
.modal-header { padding: 16px 18px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--border); }
.modal-title { font-size: 15px; font-weight: 700; }
.modal-body { padding: 0 18px 18px; overflow: auto; }
.modal-log { min-height: 300px; max-height: 62vh; overflow-y: auto; background: #04070f; border: 1px solid rgba(255,255,255,.05); border-radius: 10px; padding: 14px; font-family: 'Fira Code', monospace; font-size: 12px; line-height: 1.5; color: #d6d6d6; white-space: pre-wrap; word-break: break-word; }
.modal-close { background: transparent; border: 1px solid var(--border); color: var(--text); padding: 8px 12px; border-radius: 10px; cursor: pointer; }
.modal-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead { background: var(--surface2); position: sticky; top: 0; z-index: 1; }
th { padding: 10px 14px; text-align: left; font-weight: 600; color: var(--text-muted); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; white-space: nowrap; }
td { padding: 10px 14px; border-top: 1px solid var(--border); vertical-align: middle; }
tr:hover td { background: rgba(255,255,255,.02); }
.td-mono { font-family: 'Fira Code', 'Courier New', monospace; font-size: 12px; }
.td-muted { color: var(--text-muted); }
.td-trunc { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── FORMS ────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
label { display: block; font-size: 13px; font-weight: 600; color: var(--text-muted); margin-bottom: 6px; }
input[type="text"], input[type="password"], input[type="number"], input[type="email"], input[type="url"],
select, textarea {
  width: 100%; background: var(--surface2); border: 1px solid var(--border2);
  color: var(--text); border-radius: var(--radius-sm); padding: 9px 12px; font-size: 14px; font-family: inherit; transition: .15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold-dim); }
textarea { resize: vertical; min-height: 100px; }
input::placeholder, textarea::placeholder { color: var(--text-dim); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ── PROGRESS BAR ─────────────────────────────────────────── */
.progress-wrap { background: var(--border); border-radius: 4px; height: 6px; overflow: hidden; }
.progress-bar  { height: 100%; background: var(--gold); border-radius: 4px; transition: width .4s; }
.progress-bar.green { background: var(--green); }
.progress-bar.red   { background: var(--red); }
.progress-bar.blue  { background: var(--blue); }

/* ── TOAST AREA ───────────────────────────────────────────── */
#toast-area {
  position: fixed; bottom: 20px; right: 20px;
  z-index: 999; display: flex; flex-direction: column; gap: 8px; max-width: 380px;
}
.toast {
  background: var(--surface2); border: 1px solid var(--border2);
  border-radius: var(--radius-sm); padding: 12px 16px;
  font-size: 13px; display: flex; align-items: flex-start; gap: 10px;
  box-shadow: var(--shadow); animation: fadeIn .2s ease;
}
.toast.success { border-color: rgba(34,197,94,.4); }
.toast.error   { border-color: rgba(239,68,68,.4); }
.toast.info    { border-color: var(--gold-border); }
@keyframes fadeIn { from { opacity:0; transform:translateY(8px); } to { opacity:1; transform:translateY(0); } }

/* ── FILTER BAR ───────────────────────────────────────────── */
.filter-bar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.filter-bar select, .filter-bar input { width: auto; min-width: 130px; }

/* ── HTML EDITOR ──────────────────────────────────────────── */
.code-editor {
  width: 100%; min-height: 400px; background: var(--surface2);
  border: 1px solid var(--border2); color: var(--text);
  border-radius: var(--radius-sm); padding: 12px;
  font-family: 'Fira Code', 'Courier New', monospace; font-size: 13px; line-height: 1.5;
  resize: vertical; tab-size: 2;
}
.code-editor:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold-dim); }

/* ── MISC ─────────────────────────────────────────────────── */
.mt-4 { margin-top: 20px; }
.mt-2 { margin-top: 10px; }
.mb-4 { margin-bottom: 20px; }
.text-muted { color: var(--text-muted); }
.text-gold  { color: var(--gold); }
.text-green { color: var(--green); }
.text-red   { color: var(--red); }
.flex { display: flex; }
.items-center { align-items: center; }
.gap-2 { gap: 8px; }
.w-full { width: 100%; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.monospace { font-family: 'Fira Code', 'Courier New', monospace; font-size: 12px; }
.divider { border: none; border-top: 1px solid var(--border); margin: 20px 0; }
.empty-state { text-align: center; padding: 48px 20px; color: var(--text-muted); }
.empty-state .empty-icon { font-size: 36px; margin-bottom: 12px; opacity: .5; }

/* ══ MOBILE RESPONSIVE ══════════════════════════════════════ */
@media (max-width: 768px) {
  /* Show the mobile top bar and hamburger */
  .mob-bar        { display: flex; }
  .sidebar-close  { display: flex; }

  /* Sidebar slides in from left over content */
  .sidebar {
    transform: translateX(-100%);
    width: min(280px, 85vw);
    /* Starts below mob-bar so it doesn't clip the title */
    top: 0;
    height: 100vh;
    z-index: 400;
  }
  .sidebar.open { transform: translateX(0); }

  /* Push content down so mob-bar doesn't overlap it */
  .main-content {
    margin-left: 0;
    padding: 16px 14px 40px;
    padding-top: calc(var(--mob-bar-h) + 16px);
  }

  .stat-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .stat-value { font-size: 18px; }
  .page-header { flex-direction: column; gap: 10px; }
  .header-actions { width: 100%; }
  .form-row { grid-template-columns: 1fr; }
  .filter-bar { flex-direction: column; align-items: stretch; }
  .filter-bar select, .filter-bar input { width: 100%; }
  th, td { padding: 8px 10px; }
  .btn { font-size: 12px; padding: 7px 10px; }
  /* Toast above any native bottom bars */
  #toast-area { bottom: 10px; right: 10px; left: 10px; max-width: none; }
}
@media (max-width: 480px) {
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .stat-value { font-size: 16px; }
  .page-header h1 { font-size: 18px; }
}
