/* ============================================================
   Admin panel styles
   ============================================================ */

/* ---------- General Sans (UI font) ---------- */
@font-face {
  font-family: 'General Sans';
  src: url('../../fonts/general-sans-400.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'General Sans';
  src: url('../../fonts/general-sans-500.woff2') format('woff2');
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: 'General Sans';
  src: url('../../fonts/general-sans-600.woff2') format('woff2');
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: 'General Sans';
  src: url('../../fonts/general-sans-700.woff2') format('woff2');
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: 'General Sans';
  src: url('../../fonts/general-sans-700.woff2') format('woff2');
  font-weight: 800;
  font-display: swap;
}

/* ---------- JetBrains Mono (spec/badges) ---------- */
@font-face {
  font-family: 'JetBrains Mono';
  src: url('../../fonts/jetbrains-mono-400.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'JetBrains Mono';
  src: url('../../fonts/jetbrains-mono-500.woff2') format('woff2');
  font-weight: 500;
  font-display: swap;
}

:root {
  --a-bg: #f4f4f2;
  --a-panel: #ffffff;
  --a-ink: #111111;
  --a-muted: #6b6b66;
  --a-line: #e3e3df;
  --a-dark: #111111;
  --a-accent: #000000;
  --a-danger: #b0342c;
  --a-ok: #1f7a3d;
  --a-warn: #9a6a00;
  --a-radius: 8px;
  --font-ui: 'General Sans', 'Inter', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: var(--font-ui);
  background: var(--a-bg);
  color: var(--a-ink);
  font-size: 14px;
  line-height: 1.5;
  letter-spacing: 0.02em;
}

a { color: inherit; text-decoration: none; }

#adminApp { display: flex; min-height: 100vh; }

/* ---------- Sidebar ---------- */
.a-side {
  width: 232px;
  flex: 0 0 232px;
  background: var(--a-dark);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.a-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 20px;
  font-weight: 800;
  letter-spacing: 2px;
  font-size: 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.a-brand-mark {
  width: 32px;
  height: 32px;
  background: #fff;
  color: #000;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 900;
}

.a-nav { flex: 1; padding: 12px 0; }

.a-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 20px;
  color: rgba(255, 255, 255, 0.75);
  font-weight: 600;
  font-size: 13px;
  width: 100%;
  background: none;
  border: none;
  border-left: 3px solid transparent;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
}

.a-nav-item:hover { color: #fff; background: rgba(255, 255, 255, 0.06); }

.a-nav-item.active { color: #fff; border-left-color: #fff; background: rgba(255, 255, 255, 0.1); }

.a-nav-icon { width: 18px; text-align: center; opacity: 0.85; }

.a-side-foot { padding: 8px 0 14px; border-top: 1px solid rgba(255, 255, 255, 0.12); }

/* ---------- Main ---------- */
.a-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.a-topbar {
  height: 64px;
  background: var(--a-panel);
  border-bottom: 1px solid var(--a-line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 20;
}

.a-topbar-title { font-size: 17px; font-weight: 800; letter-spacing: 0.5px; text-transform: uppercase; }

.a-topbar-user { display: flex; align-items: center; gap: 10px; }

.a-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #000;
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 13px;
}

.a-user-meta { line-height: 1.2; }
.a-user-meta strong { display: block; font-size: 12px; }
.a-user-meta span { color: var(--a-muted); font-size: 11px; }

.a-content { padding: 28px; max-width: 1280px; width: 100%; }

/* ---------- Stat cards ---------- */
.a-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 16px; margin-bottom: 26px; }

.a-stat {
  background: var(--a-panel);
  border: 1px solid var(--a-line);
  border-radius: var(--a-radius);
  padding: 18px 20px;
}

.a-stat .a-stat-label { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--a-muted); font-weight: 700; }

.a-stat .a-stat-value { font-size: 30px; font-weight: 800; margin-top: 6px; line-height: 1; }

.a-stat .a-stat-sub { font-size: 12px; color: var(--a-muted); margin-top: 6px; }

.a-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 26px; }
@media (max-width: 1000px) { .a-grid-2 { grid-template-columns: 1fr; } }

.a-panel {
  background: var(--a-panel);
  border: 1px solid var(--a-line);
  border-radius: var(--a-radius);
  overflow: hidden;
}

.a-panel-head {
  padding: 14px 20px;
  border-bottom: 1px solid var(--a-line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 800;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.a-panel-body { padding: 20px; }

/* ---------- Buttons ---------- */
.a-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  border: 1px solid var(--a-line);
  background: var(--a-panel);
  color: var(--a-ink);
  border-radius: 6px;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
}

.a-btn:hover { border-color: #bbb; }

.a-btn-dark { background: var(--a-dark); color: #fff; border-color: var(--a-dark); }
.a-btn-dark:hover { background: #000; border-color: #000; }

.a-btn-danger { color: var(--a-danger); border-color: #e2b3af; }
.a-btn-danger:hover { background: var(--a-danger); color: #fff; }

.a-btn-sm { padding: 6px 11px; font-size: 12px; }

.a-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---------- Toolbar / filters ---------- */
.a-toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }

.a-input, .a-select, .a-textarea {
  padding: 9px 12px;
  border: 1px solid var(--a-line);
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  background: #fff;
  color: var(--a-ink);
}

.a-input:focus, .a-select:focus, .a-textarea:focus { outline: none; border-color: #000; }

.a-input { min-width: 220px; }

.a-search { position: relative; }
.a-search input { padding-right: 34px; }

.a-toolbar .spacer { flex: 1; }

/* ---------- Table ---------- */
.a-table-wrap { overflow-x: auto; }

table.a-table { width: 100%; border-collapse: collapse; font-size: 13px; }

.a-table th {
  text-align: left;
  padding: 11px 16px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--a-muted);
  background: #fafaf8;
  border-bottom: 1px solid var(--a-line);
  white-space: nowrap;
}

.a-table td { padding: 12px 16px; border-bottom: 1px solid var(--a-line); vertical-align: middle; }

.a-table tr:last-child td { border-bottom: none; }

.a-table tbody tr:hover { background: #fafaf9; }

.a-thumb {
  width: 42px;
  height: 42px;
  object-fit: cover;
  border-radius: 6px;
  background: #eee;
  display: block;
}

.a-cell-title { font-weight: 700; }

.a-cell-sub { color: var(--a-muted); font-size: 12px; }

/* ---------- Badges ---------- */
.a-badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.a-badge.active, .a-badge.paid, .a-badge.delivered, .a-badge.true { background: #e3f2e6; color: var(--a-ok); }
.a-badge.draft, .a-badge.archived, .a-badge.cancelled, .a-badge.false { background: #f0efec; color: var(--a-muted); }
.a-badge.pending { background: #fdeee2; color: var(--a-warn); }
.a-badge.processing { background: #e8f0fa; color: #23558c; }
.a-badge.shipped { background: #efe6fb; color: #5b3a94; }

/* ---------- Pagination ---------- */
.a-pagination { display: flex; gap: 6px; justify-content: flex-end; margin-top: 16px; flex-wrap: wrap; }

.a-page {
  min-width: 34px;
  height: 34px;
  padding: 0 8px;
  border: 1px solid var(--a-line);
  background: #fff;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 700;
  font-size: 12px;
  font-family: inherit;
}

.a-page:hover { border-color: #000; }
.a-page.active { background: #000; color: #fff; border-color: #000; }

/* ---------- Forms ---------- */
.a-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 20px; }

@media (max-width: 800px) { .a-form-grid { grid-template-columns: 1fr; } }

.a-form-grid .full { grid-column: 1 / -1; }

.a-field label { display: block; font-size: 12px; font-weight: 700; margin-bottom: 6px; }

.a-field .hint { font-size: 11px; color: var(--a-muted); font-weight: 400; }

.a-field input, .a-field select, .a-field textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--a-line);
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
}

.a-field textarea { min-height: 90px; resize: vertical; }

.a-check { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13px; }
.a-check input { width: auto; }

.a-form-actions { display: flex; gap: 10px; margin-top: 26px; padding-top: 20px; border-top: 1px solid var(--a-line); }

/* ---------- Repeater (variants, images) ---------- */
.a-repeater { display: grid; gap: 10px; }

.a-rep-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 90px 90px auto;
  gap: 8px;
  align-items: center;
  background: #fafaf8;
  border: 1px solid var(--a-line);
  border-radius: 6px;
  padding: 8px;
}

.a-rep-row.img-row { grid-template-columns: 1fr 1fr auto; }

.a-rep-row input, .a-rep-row select {
  padding: 7px 10px;
  border: 1px solid var(--a-line);
  border-radius: 5px;
  font-size: 12px;
  font-family: inherit;
  width: 100%;
}

.a-rep-del {
  width: 30px;
  height: 30px;
  border: 1px solid #e2b3af;
  color: var(--a-danger);
  background: #fff;
  border-radius: 5px;
  cursor: pointer;
  font-weight: 800;
}

.a-rep-add { margin-top: 10px; }

/* ---------- Order rows / expand ---------- */
.a-order-row { cursor: pointer; }

.a-order-detail { background: #fafaf8; border-top: 1px solid var(--a-line); }
.a-order-detail > td { padding: 20px 24px; }

.a-od-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 24px; }
@media (max-width: 800px) { .a-od-grid { grid-template-columns: 1fr; } }

.a-od-grid h4 { margin: 0 0 8px; font-size: 12px; text-transform: uppercase; letter-spacing: 1px; color: var(--a-muted); }

.a-od-item { display: flex; gap: 12px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--a-line); }
.a-od-item:last-child { border-bottom: none; }

.a-od-item img, .a-od-ph {
  width: 44px;
  height: 44px;
  border-radius: 6px;
  object-fit: cover;
  background: #eee;
  flex: 0 0 44px;
}

.a-od-item .grow { flex: 1; min-width: 0; }
.a-od-item .grow strong { display: block; font-size: 13px; }
.a-od-item .grow span { font-size: 12px; color: var(--a-muted); }

.a-od-totals { border-top: 1px solid var(--a-line); margin-top: 10px; padding-top: 10px; }
.a-od-totals div { display: flex; justify-content: space-between; font-size: 13px; padding: 3px 0; }
.a-od-totals .total { font-weight: 800; font-size: 15px; border-top: 1px solid var(--a-line); margin-top: 4px; padding-top: 8px; }

/* ---------- Notice / empty ---------- */
.a-notice {
  max-width: 420px;
  margin: 80px auto;
  text-align: center;
  background: var(--a-panel);
  border: 1px solid var(--a-line);
  border-radius: var(--a-radius);
  padding: 40px;
}

.a-empty { text-align: center; color: var(--a-muted); padding: 40px 20px; }

/* ---------- Toast ---------- */
.a-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #000;
  color: #fff;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  z-index: 100;
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.25s ease;
  pointer-events: none;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.a-toast.show { opacity: 1; transform: translateY(0); }
.a-toast.err { background: var(--a-danger); }

/* ---------- Skeletons ---------- */
.a-skel-row { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--a-line); }
.a-skel { height: 14px; background: linear-gradient(90deg, #eee 25%, #f6f6f4 50%, #eee 75%); background-size: 200% 100%; animation: aSh 1.2s infinite; border-radius: 4px; }
@keyframes aSh { to { background-position: -200% 0; } }

/* ---------- Status select ---------- */
.a-status-form { display: flex; gap: 8px; align-items: center; }

/* ---------- Mobile menu button / backdrop ---------- */
.a-menu-btn {
  display: none;
  width: 40px;
  height: 40px;
  border: 1px solid var(--a-line);
  background: #fff;
  border-radius: 6px;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  flex: none;
  font-family: inherit;
}

.a-menu-btn:hover { border-color: #bbb; }

.a-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 40;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1100px) {
  .a-table th, .a-table td { padding: 10px 12px; }
  .a-topbar { padding: 0 20px; }
  .a-content { padding: 22px; }
}

@media (max-width: 900px) {
  .a-menu-btn { display: inline-flex; }

  .a-side {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 50;
    width: min(280px, 84vw);
    flex: none;
    transform: translateX(-102%);
    transition: transform 0.28s ease;
    box-shadow: 12px 0 32px rgba(0, 0, 0, 0.25);
    overflow-y: auto;
  }

  .a-side.open { transform: translateX(0); }

  .a-main { width: 100%; }
  .a-topbar { height: 56px; padding: 0 14px; gap: 10px; justify-content: flex-start; }
  .a-topbar-title { font-size: 14px; flex: 1; }
  .a-content { padding: 18px 16px; }

  .a-toolbar { flex-direction: column; align-items: stretch; gap: 10px; }
  .a-toolbar .a-input, .a-toolbar .a-select { width: 100%; min-width: 0; flex: none; }
  .a-toolbar .spacer { display: none; }
  .a-toolbar .a-btn { align-self: flex-start; }

  .a-panel-head { padding: 13px 16px; }
  .a-panel-body { padding: 16px; }

  .a-skel-row { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 640px) {
  .a-user-meta { display: none; }
  .a-topbar-user { gap: 6px; }
  .a-content { padding: 14px 12px; }

  .a-stats { gap: 10px; margin-bottom: 18px; }
  .a-stat { padding: 14px; }
  .a-stat .a-stat-value { font-size: 24px; }

  table.a-table { font-size: 12px; }
  .a-table th, .a-table td { padding: 9px 10px; }

  .a-form-actions { flex-direction: column; }
  .a-form-actions .a-btn { width: 100%; justify-content: center; }

  .a-rep-row { grid-template-columns: 1fr 1fr; }
  .a-rep-row > :last-child { grid-column: 1 / -1; justify-self: stretch; }
  .a-rep-del { width: 100%; height: 34px; }

  .a-notice { margin: 36px 12px; padding: 28px 18px; }

  .a-status-form { flex-direction: column; align-items: stretch; }
  .a-status-form .a-select { width: 100%; }
  .a-status-form .a-btn { justify-content: center; }

  .a-pagination { justify-content: flex-start; }
  .a-od-detail { padding: 12px; }
  .a-od-item img, .a-od-ph { width: 40px; height: 40px; flex-basis: 40px; }
}

@media (prefers-reduced-motion: reduce) {
  .a-side { transition: none; }
  .a-skel { animation: none; }
  * { transition: none; }
}
