/* ============================================================
   Aurora4x4 Admin CMS — Professional Layout v4
   Inspired by WordPress / Shopify admin UX standards
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  --sb-width: 240px;
  --tb-height: 60px;
  --blue: #0066FF;
  --blue-hover: #0052cc;
  --green: #16a34a;
  --orange: #ea580c;
  --red: #dc2626;
  --purple: #7c3aed;

  --bg-app: #f1f5f9;       /* light grey background — easy on eyes */
  --bg-sidebar: #1e2330;   /* dark sidebar */
  --bg-topbar: #ffffff;
  --bg-card: #ffffff;
  --bg-input: #f8fafc;
  --bg-hover: #f1f5f9;
  --bg-selected: #eff6ff;

  --text-main: #1e293b;
  --text-sub: #64748b;
  --text-muted: #94a3b8;
  --text-sidebar: #94a3b8;
  --text-sidebar-active: #ffffff;

  --border: #e2e8f0;
  --border-focus: #0066FF;

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow: 0 4px 12px rgba(0,0,0,0.1);
  --shadow-lg: 0 10px 30px rgba(0,0,0,0.15);
}

/* ── RESET ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body { font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif; font-size: 14px; line-height: 1.6; color: var(--text-main); background: var(--bg-app); overflow-x: hidden; }
a { text-decoration: none; color: inherit; cursor: pointer; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; font-size: 14px; }
textarea { resize: vertical; }
img { max-width: 100%; display: block; }

/* ══════════════════════════════════════════
   LOGIN PAGE
══════════════════════════════════════════ */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1e2330 0%, #0f172a 100%);
}
.login-box {
  width: 420px;
  background: #fff;
  border-radius: 20px;
  padding: 48px 44px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.login-logo { text-align: center; margin-bottom: 36px; }
.logo-a { font-size: 1.8rem; font-weight: 800; color: var(--blue); letter-spacing: -0.02em; }
.logo-m { font-size: 1.8rem; font-weight: 800; color: var(--text-main); letter-spacing: -0.02em; }
.login-sub { font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.12em; margin-top: 6px; }
.login-err { color: var(--red); font-size: 0.83rem; min-height: 20px; text-align: center; margin-bottom: 4px; }
.login-hint { text-align: center; font-size: 0.75rem; color: var(--text-muted); margin-top: 16px; background: var(--bg-input); padding: 8px 14px; border-radius: var(--radius-sm); }
.eye { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); cursor: pointer; opacity: 0.4; font-size: 1rem; user-select: none; }
.eye:hover { opacity: 1; }
.btn-login {
  width: 100%; padding: 14px; background: var(--blue); color: #fff; border: none;
  border-radius: var(--radius); font-size: 1rem; font-weight: 700; margin-top: 10px;
  transition: all 0.2s; letter-spacing: 0.02em;
}
.btn-login:hover { background: var(--blue-hover); transform: translateY(-1px); box-shadow: 0 6px 20px rgba(0,102,255,0.3); }

/* ══════════════════════════════════════════
   APP SHELL — Three-zone layout
══════════════════════════════════════════ */
.app {
  display: block;      /* sidebar is fixed-position, main uses margin-left */
  min-height: 100vh;
}

/* ── SIDEBAR ── */
.sidebar {
  width: var(--sb-width);
  min-width: var(--sb-width);
  background: var(--bg-sidebar);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 300;
  overflow-y: auto;
  overflow-x: hidden;
  transition: transform 0.3s;
}
.sb-logo {
  padding: 24px 20px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  flex-shrink: 0;
}
.sb-tag { font-size: 0.65rem; color: rgba(255,255,255,0.35); text-transform: uppercase; letter-spacing: 0.1em; margin-top: 4px; }
.sb-nav { flex: 1; padding: 10px 10px; display: flex; flex-direction: column; }
.sb-sec {
  font-size: 0.62rem; font-weight: 700; color: rgba(255,255,255,0.3);
  text-transform: uppercase; letter-spacing: 0.1em;
  padding: 14px 10px 5px; margin-top: 4px;
}
.ni {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: var(--radius-sm);
  color: var(--text-sidebar); font-size: 0.875rem; font-weight: 500;
  transition: all 0.15s; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; position: relative;
}
.ni:hover { background: rgba(255,255,255,0.07); color: #fff; }
.ni.active { background: var(--blue); color: #fff; }
.nb {
  margin-left: auto; flex-shrink: 0;
  background: rgba(255,255,255,0.15); color: #fff;
  font-size: 0.65rem; font-weight: 700;
  padding: 1px 7px; border-radius: 10px; min-width: 20px; text-align: center;
}
.ni.active .nb { background: rgba(255,255,255,0.3); }
.sb-foot {
  padding: 14px 12px;
  border-top: 1px solid rgba(255,255,255,0.08);
  display: flex; gap: 8px; flex-shrink: 0;
}
.btn-site {
  flex: 1; text-align: center; padding: 9px;
  background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.7); border-radius: var(--radius-sm);
  font-size: 0.8rem; font-weight: 600; transition: 0.2s;
}
.btn-site:hover { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn-logout {
  flex: 1; padding: 9px; background: none;
  border: 1px solid rgba(255,255,255,0.12); border-radius: var(--radius-sm);
  color: rgba(255,255,255,0.5); font-size: 0.8rem; transition: 0.2s;
}
.btn-logout:hover { background: rgba(220,38,38,0.15); border-color: var(--red); color: #fca5a5; }

/* ── MAIN AREA ── */
.main {
  margin-left: var(--sb-width);   /* push right of fixed sidebar */
  min-height: 100vh;
  background: var(--bg-app);
}

/* ── TOPBAR ── */
.topbar {
  height: var(--tb-height);
  background: var(--bg-topbar);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky; top: 0; z-index: 200;
  box-shadow: var(--shadow-sm);
}
.tb-l, .tb-r { display: flex; align-items: center; gap: 12px; }
.sb-toggle {
  display: none; background: none; border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 6px 10px; color: var(--text-sub);
}
.tb-title { font-weight: 700; font-size: 1.05rem; color: var(--text-main); }
.save-ok { font-size: 0.8rem; color: var(--green); opacity: 0; transition: opacity 0.3s; }
.avatar {
  width: 36px; height: 36px; background: var(--blue); border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 0.85rem;
}

/* ── PAGE CONTAINER ── */
.page { display: none; padding: 28px 32px 60px; }
.page.active { display: block; }

/* ══════════════════════════════════════════
   SHARED COMPONENTS
══════════════════════════════════════════ */

/* Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}
.ct { font-weight: 700; font-size: 1rem; color: var(--text-main); margin-bottom: 18px; }

/* Stat Cards */
.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin-bottom: 28px; }
.stat-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 22px 20px;
  display: flex; align-items: center; gap: 16px;
  box-shadow: var(--shadow-sm); transition: box-shadow 0.2s;
}
.stat-card:hover { box-shadow: var(--shadow); }
.stat-ico { font-size: 2rem; }
.sn { font-size: 1.9rem; font-weight: 800; color: var(--text-main); line-height: 1; }
.sl { font-size: 0.75rem; color: var(--text-sub); margin-top: 3px; font-weight: 500; }

/* Dash Grid */
.dash-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 18px; }
.ri { display: flex; align-items: center; gap: 12px; padding: 10px 12px; background: var(--bg-input); border-radius: var(--radius-sm); margin-bottom: 8px; border: 1px solid var(--border); }
.ri-img { width: 44px; height: 44px; object-fit: cover; border-radius: var(--radius-sm); background: var(--bg-hover); flex-shrink: 0; }
.ri-n { font-size: 0.875rem; font-weight: 600; max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ri-s { font-size: 0.72rem; color: var(--text-sub); }

/* Quick Actions */
.qa-list { display: flex; flex-direction: column; gap: 8px; }
.qa {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 14px; background: var(--bg-input);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text-main); text-align: left; font-size: 0.875rem;
  font-weight: 500; transition: all 0.15s;
}
.qa:hover { background: var(--bg-selected); border-color: var(--blue); color: var(--blue); }

/* Table */
.toolbar {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 18px; flex-wrap: wrap; gap: 12px;
}
.tl-l { display: flex; gap: 10px; flex-wrap: wrap; }
.search {
  padding: 9px 14px; background: var(--bg-card); border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); font-size: 0.875rem; outline: none;
  transition: border-color 0.2s; min-width: 220px;
}
.search:focus { border-color: var(--blue); }
.sel {
  padding: 9px 12px; background: var(--bg-card); border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); font-size: 0.875rem; outline: none; color: var(--text-main);
}
.tw {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-sm);
}
.tbl { width: 100%; border-collapse: collapse; }
.tbl th {
  padding: 12px 16px; text-align: left; font-size: 0.72rem; font-weight: 700;
  color: var(--text-sub); text-transform: uppercase; letter-spacing: 0.07em;
  background: var(--bg-input); border-bottom: 1px solid var(--border);
}
.tbl td {
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  vertical-align: middle; color: var(--text-main);
}
.tbl tr:last-child td { border-bottom: none; }
.tbl tr:hover td { background: var(--bg-hover); }
.thumb { width: 48px; height: 48px; object-fit: cover; border-radius: var(--radius-sm); background: var(--bg-input); border: 1px solid var(--border); }
.tn { font-weight: 600; font-size: 0.875rem; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ts { font-size: 0.73rem; color: var(--text-sub); margin-top: 2px; }
.badge {
  display: inline-block; padding: 3px 10px; border-radius: 20px;
  font-size: 0.72rem; font-weight: 600;
  background: #eff6ff; color: var(--blue); border: 1px solid #bfdbfe;
}
.badge.draft { background: #fff7ed; color: var(--orange); border-color: #fed7aa; }
.badge.green { background: #f0fdf4; color: var(--green); border-color: #bbf7d0; }
.act { display: flex; gap: 6px; }
.empty { padding: 60px 20px; text-align: center; color: var(--text-sub); background: var(--bg-card); border-radius: var(--radius-lg); border: 2px dashed var(--border); }

/* ══════════════════════════════════════════
   PAGE EDITORS
══════════════════════════════════════════ */
.pe { max-width: 1000px; }
.ps {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 28px 32px;
  margin-bottom: 20px; box-shadow: var(--shadow-sm);
}
.pt {
  font-weight: 700; font-size: 1rem; color: var(--text-main);
  margin-bottom: 20px; padding-bottom: 14px;
  border-bottom: 2px solid var(--border);
  display: flex; align-items: center; gap: 8px;
}
.hint { color: var(--text-sub); font-size: 0.85rem; margin-bottom: 14px; line-height: 1.6; }

/* KPI Grid */
.kpi-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px;
}
.kpi-pair {
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px;
}
.kpi-pair label { font-size: 0.7rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; display: block; margin-bottom: 6px; }
.kpi-pair input { width: 100%; padding: 8px 12px; border: 1.5px solid var(--border); border-radius: var(--radius-sm); font-size: 1rem; font-weight: 700; }

/* Form Fields */
.fg { margin-bottom: 18px; }
.fg label {
  display: block; font-size: 0.78rem; font-weight: 700;
  color: var(--text-sub); text-transform: uppercase;
  letter-spacing: 0.06em; margin-bottom: 7px;
}
.fg input, .fg select, .fg textarea {
  width: 100%; padding: 10px 14px;
  background: var(--bg-input); border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text-main); font-size: 0.9rem;
  outline: none; transition: border-color 0.2s, box-shadow 0.2s;
}
.fg input:focus, .fg select:focus, .fg textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(0,102,255,0.1);
  background: #fff;
}

/* Image Preview */
.ip {
  margin-top: 10px; width: 100%; height: 160px;
  background: var(--bg-input); border: 2px dashed var(--border);
  border-radius: var(--radius); display: flex; align-items: center;
  justify-content: center; overflow: hidden; position: relative;
}
.ip.sm { height: 120px; }
.ip.med { height: 180px; }
.ip.lg { height: 220px; }
.ip img { width: 100%; height: 100%; object-fit: contain; }
.ph { color: var(--text-muted); font-size: 0.82rem; text-align: center; padding: 20px; }

/* Two Column Form */
.fc { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }

/* ══════════════════════════════════════════
   LIST / DYNAMIC EDITORS
══════════════════════════════════════════ */
.list-item {
  background: var(--bg-input); border: 1.5px solid var(--border);
  border-radius: var(--radius); padding: 16px 18px; margin-bottom: 10px;
  transition: border-color 0.2s;
}
.list-item:hover { border-color: #94a3b8; }
.del-item {
  background: none; border: 1.5px solid #fecaca; color: var(--red);
  border-radius: var(--radius-sm); padding: 6px 10px;
  font-size: 0.8rem; font-weight: 600; flex-shrink: 0;
  transition: 0.15s; cursor: pointer;
}
.del-item:hover { background: var(--red); color: #fff; border-color: var(--red); }

/* Brand Logo Cards */
.brand-logo-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px;
}
.brand-logo-item {
  background: var(--bg-input); border: 1.5px solid var(--border);
  border-radius: var(--radius); padding: 14px; position: relative;
}
.brand-logo-item .logo-preview {
  width: 100%; height: 80px; object-fit: contain; border-radius: var(--radius-sm);
  background: #fff; border: 1px solid var(--border); margin-bottom: 10px;
}
.brand-logo-item .remove-brand {
  position: absolute; top: 8px; right: 8px;
  background: rgba(220,38,38,0.1); border: 1px solid #fecaca;
  color: var(--red); border-radius: 50%; width: 22px; height: 22px;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.7rem; cursor: pointer;
}

/* Cat Scenes Editor */
.scene-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.scene-item {
  background: var(--bg-input); border: 1.5px solid var(--border);
  border-radius: var(--radius-lg); overflow: hidden;
}
.scene-preview { width: 100%; height: 120px; object-fit: cover; background: var(--bg-hover); display: block; }
.scene-body { padding: 14px; }
.scene-label { font-size: 0.7rem; font-weight: 700; color: var(--blue); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 8px; }

/* ══════════════════════════════════════════
   MEDIA LIBRARY
══════════════════════════════════════════ */
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.media-card {
  background: var(--bg-card); border: 1.5px solid var(--border);
  border-radius: var(--radius-lg); overflow: hidden;
  box-shadow: var(--shadow-sm); transition: all 0.2s;
}
.media-card:hover { box-shadow: var(--shadow); border-color: #94a3b8; }
.media-img { width: 100%; height: 140px; object-fit: cover; background: var(--bg-input); display: block; }
.media-info { padding: 12px 14px; }
.media-desc { font-size: 0.82rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-main); }
.media-tags { font-size: 0.7rem; color: var(--text-sub); margin-top: 3px; }
.media-acts { display: flex; gap: 7px; margin-top: 10px; }

/* ══════════════════════════════════════════
   SETTINGS
══════════════════════════════════════════ */
.sw { display: flex; flex-direction: column; gap: 18px; max-width: 660px; }
.msg { font-size: 0.85rem; margin-top: 10px; min-height: 18px; }
.msg.ok { color: var(--green); }
.msg.err { color: var(--red); }

/* ══════════════════════════════════════════
   BUTTONS
══════════════════════════════════════════ */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 18px; border-radius: var(--radius-sm);
  font-size: 0.875rem; font-weight: 600;
  border: 1.5px solid var(--border); background: var(--bg-card);
  color: var(--text-main); transition: all 0.15s; white-space: nowrap;
}
.btn:hover { background: var(--bg-hover); border-color: #94a3b8; }
.btn-primary { background: var(--blue); color: #fff; border-color: var(--blue); }
.btn-primary:hover { background: var(--blue-hover); border-color: var(--blue-hover); box-shadow: 0 4px 12px rgba(0,102,255,0.25); }
.btn-danger { background: #fff1f2; color: var(--red); border-color: #fecaca; }
.btn-danger:hover { background: var(--red); color: #fff; border-color: var(--red); }
.btn-success { background: #f0fdf4; color: var(--green); border-color: #bbf7d0; }
.btn-success:hover { background: var(--green); color: #fff; border-color: var(--green); }
.btn-sm { padding: 6px 13px; font-size: 0.8rem; }
.btn-icon {
  padding: 7px 9px; border-radius: var(--radius-sm);
  background: var(--bg-input); border: 1.5px solid var(--border);
  color: var(--text-sub); font-size: 0.85rem; transition: 0.15s;
}
.btn-icon:hover { background: var(--bg-selected); border-color: var(--blue); color: var(--blue); }
.btn-icon.danger:hover { background: #fff1f2; border-color: #fecaca; color: var(--red); }

/* ══════════════════════════════════════════
   MODALS
══════════════════════════════════════════ */
.modal {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(15,23,42,0.6); backdrop-filter: blur(4px);
  display: flex; align-items: flex-start; justify-content: center;
  overflow-y: auto; padding: 40px 20px;
}
.mb {
  background: var(--bg-card); border-radius: var(--radius-lg);
  width: 100%; max-width: 960px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
  animation: modal-in 0.22s ease;
  border: 1px solid var(--border);
}
@keyframes modal-in { from { transform: translateY(16px) scale(0.98); opacity: 0; } }
.mh {
  display: flex; justify-content: space-between; align-items: center;
  padding: 20px 28px; border-bottom: 1px solid var(--border);
  background: var(--bg-input); border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.mh h2 { font-size: 1.05rem; font-weight: 700; color: var(--text-main); }
.mc {
  background: none; border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  width: 32px; height: 32px; display: flex; align-items: center; justify-content: center;
  color: var(--text-sub); font-size: 1rem; transition: 0.15s;
}
.mc:hover { background: var(--red); color: #fff; border-color: var(--red); }
.mbody { padding: 24px 28px; max-height: 70vh; overflow-y: auto; }
.mf {
  padding: 16px 28px; border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 10px;
  background: var(--bg-input); border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}
.confirm-box { max-width: 380px; padding: 40px 36px; text-align: center; }

/* ══════════════════════════════════════════
   TOAST NOTIFICATIONS
══════════════════════════════════════════ */
.toast {
  position: fixed; bottom: 28px; right: 28px; z-index: 9999;
  padding: 13px 22px; border-radius: var(--radius);
  font-size: 0.875rem; font-weight: 600;
  background: var(--text-main); color: #fff;
  box-shadow: 0 8px 25px rgba(0,0,0,0.2);
  opacity: 0; transform: translateY(10px) scale(0.95);
  transition: all 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translateY(0) scale(1); }
.toast.ok { background: var(--green); }
.toast.err { background: var(--red); }

/* ══════════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════════ */
@media (max-width: 1200px) {
  .dash-grid { grid-template-columns: 1fr 1fr; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 960px) {
  .stat-row { grid-template-columns: 1fr 1fr; }
  .fc { grid-template-columns: 1fr; }
  .scene-grid { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  :root { --sb-width: 0px; }
  .sidebar { transform: translateX(-240px); width: 240px; }
  .sidebar.open { transform: translateX(0); box-shadow: 0 0 40px rgba(0,0,0,0.4); }
  .main { margin-left: 0; }
  .sb-toggle { display: flex; }
  .stat-row { grid-template-columns: 1fr 1fr; }
  .dash-grid { grid-template-columns: 1fr; }
  .page { padding: 16px 18px 40px; }
  .ps { padding: 18px 20px; }
  .brand-logo-grid { grid-template-columns: 1fr 1fr; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
  .stat-row { grid-template-columns: 1fr; }
  .brand-logo-grid { grid-template-columns: 1fr 1fr; }
  .tbl th:nth-child(3), .tbl td:nth-child(3),
  .tbl th:nth-child(4), .tbl td:nth-child(4) { display: none; }
}
