/* ============================================================
   Bostron UKC — Admin panel styles
   ============================================================ */

:root {
  --ink: #000000;
  --navy: #14213d;
  --navy-soft: #1c2c4d;
  --navy-line: rgba(255,255,255,0.08);
  --amber: #fca311;
  --grey: #e5e5e5;
  --grey-mid: #c7c7c7;
  --white: #ffffff;
  --muted: #6b7488;

  --font-display: "Sora", system-ui, sans-serif;
  --font-body: "Manrope", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;
  --radius: 10px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
/* The hidden attribute must beat explicit display rules below
   (e.g. .app-view{display:grid}) so login/dashboard never show at once. */
[hidden] { display: none !important; }
body { font-family: var(--font-body); background: #f4f5f8; color: var(--ink); -webkit-font-smoothing: antialiased; }

.sigdot { width: 10px; height: 10px; border-radius: 50%; background: var(--amber); display: inline-block; }

/* ---------- Buttons ---------- */
.btn { font-family: var(--font-display); font-weight: 600; font-size: .92rem; border: none; cursor: pointer;
  border-radius: 8px; padding: 11px 20px; display: inline-flex; align-items: center; gap: 8px; transition: all .14s; }
.btn:active { transform: translateY(1px); }
.btn-amber { background: var(--amber); color: var(--navy); }
.btn-amber:hover { background: #ffb22e; }
.btn-dark { background: var(--navy); color: var(--white); }
.btn-dark:hover { background: var(--navy-soft); }
.btn-ghost { background: transparent; color: var(--navy); border: 1px solid var(--grey-mid); }
.btn-ghost:hover { border-color: var(--navy); }
.btn-block { width: 100%; justify-content: center; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn-sm { padding: 7px 13px; font-size: .82rem; }
.btn-danger { background: #fff; color: #b00020; border: 1px solid #f2c2c8; }
.btn-danger:hover { background: #b00020; color: #fff; }

/* ---------- Fields ---------- */
.field { margin-bottom: 16px; }
.field label { display: block; font-family: var(--font-mono); font-size: .72rem; text-transform: uppercase;
  letter-spacing: .08em; color: var(--muted); margin-bottom: 7px; }
.field input, .field textarea, .field select {
  width: 100%; padding: 11px 13px; border: 1px solid var(--grey-mid); border-radius: 8px;
  font-family: var(--font-body); font-size: .95rem; background: #fff; }
.field input:focus, .field textarea:focus { outline: 2px solid var(--amber); border-color: var(--amber); }

/* ---------- Login ---------- */
.login-view { min-height: 100vh; display: grid; place-items: center; background: var(--navy);
  background-image: radial-gradient(circle at 80% 20%, rgba(252,163,17,.12), transparent 45%); padding: 24px; }
.login-card { background: #fff; border-radius: 16px; padding: 38px; width: 100%; max-width: 400px; box-shadow: 0 30px 70px rgba(0,0,0,.4); }
.login-brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-display);
  text-transform: uppercase; letter-spacing: .05em; font-size: .82rem; color: var(--navy); margin-bottom: 24px; }
.login-brand strong { color: var(--amber); }
.login-card h1 { font-family: var(--font-display); font-size: 1.7rem; }
.login-sub { color: var(--muted); margin: 4px 0 24px; font-size: .92rem; }
.form-error { color: #b00020; font-size: .85rem; margin-top: 12px; min-height: 1em; }

/* ---------- App layout ---------- */
.app-view { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }

.sidebar { background: var(--navy); color: #fff; display: flex; flex-direction: column; padding: 24px 16px; position: sticky; top: 0; height: 100vh; }
.sb-brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-display);
  text-transform: uppercase; letter-spacing: .05em; font-size: .95rem; padding: 0 8px 24px; }
.sb-brand strong { color: var(--amber); }
.sb-nav { display: flex; flex-direction: column; gap: 4px; }
.sb-link { background: none; border: none; color: rgba(255,255,255,.72); text-align: left;
  font-family: var(--font-body); font-size: .95rem; padding: 12px 14px; border-radius: 8px; cursor: pointer; transition: all .14s; }
.sb-link:hover { background: rgba(255,255,255,.06); color: #fff; }
.sb-link.active { background: var(--amber); color: var(--navy); font-weight: 600; }
.sb-foot { margin-top: auto; padding: 16px 8px 0; border-top: 1px solid var(--navy-line); }
.sb-who { display: block; font-family: var(--font-mono); font-size: .74rem; color: rgba(255,255,255,.5); margin-bottom: 10px; word-break: break-all; }
.sb-logout { background: none; border: 1px solid rgba(255,255,255,.2); color: #fff; padding: 8px 14px;
  border-radius: 7px; cursor: pointer; font-size: .85rem; width: 100%; }
.sb-logout:hover { border-color: var(--amber); color: var(--amber); }

.content { padding: 34px 40px; }
.tab-head { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 26px; gap: 16px; flex-wrap: wrap; }
.kicker { font-family: var(--font-mono); font-size: .72rem; text-transform: uppercase; letter-spacing: .2em; color: var(--muted); }
.tab-head h2 { font-family: var(--font-display); font-size: 1.8rem; }
.muted { color: var(--muted); padding: 30px 0; font-family: var(--font-mono); font-size: .9rem; }

/* ---------- Stats ---------- */
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px,1fr)); gap: 16px; margin-bottom: 28px; }
.stat { background: #fff; border: 1px solid var(--grey); border-radius: var(--radius); padding: 20px; }
.stat .n { font-family: var(--font-mono); font-weight: 700; font-size: 1.7rem; color: var(--navy); }
.stat .n.amber { color: var(--amber); }
.stat .l { font-family: var(--font-mono); font-size: .72rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin-top: 4px; }

/* ---------- Orders ---------- */
.order { background: #fff; border: 1px solid var(--grey); border-radius: var(--radius); margin-bottom: 14px; overflow: hidden; }
.order-top { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; cursor: pointer; gap: 16px; flex-wrap: wrap; }
.order-top:hover { background: #fafbfc; }
.order-ref { font-family: var(--font-mono); font-weight: 700; color: var(--navy); }
.order-meta { color: var(--muted); font-size: .85rem; }
.order-total { font-family: var(--font-mono); font-weight: 700; color: var(--amber); font-size: 1.05rem; }
.badge { font-family: var(--font-mono); font-size: .7rem; text-transform: uppercase; letter-spacing: .06em;
  padding: 4px 10px; border-radius: 999px; }
.badge.pending { background: #fff4e0; color: #a76a00; }
.badge.paid { background: #e3f3ea; color: #1f7a45; }
.badge.shipped { background: #e4ecfb; color: #2150a8; }
.badge.cancelled { background: #fbe4e6; color: #b00020; }
.order-body { padding: 0 20px 18px; border-top: 1px solid var(--grey); display: none; }
.order.open .order-body { display: block; }
.order-body table { width: 100%; border-collapse: collapse; margin: 14px 0; font-size: .9rem; }
.order-body th { text-align: left; font-family: var(--font-mono); font-size: .7rem; text-transform: uppercase;
  letter-spacing: .06em; color: var(--muted); padding: 8px 0; border-bottom: 1px solid var(--grey); }
.order-body td { padding: 9px 0; border-bottom: 1px solid var(--grey); }
.cust-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(180px,1fr)); gap: 10px; margin: 14px 0; }
.cust-grid div { font-size: .88rem; }
.cust-grid .k { font-family: var(--font-mono); font-size: .68rem; text-transform: uppercase; color: var(--muted); letter-spacing: .06em; }
.status-row { display: flex; align-items: center; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.status-row select { max-width: 200px; padding: 8px 10px; border: 1px solid var(--grey-mid); border-radius: 7px; }

/* ---------- Products table ---------- */
.prod-table { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--grey); border-radius: var(--radius); overflow: hidden; }
.prod-table th { text-align: left; font-family: var(--font-mono); font-size: .7rem; text-transform: uppercase;
  letter-spacing: .06em; color: var(--muted); padding: 14px 16px; background: #fafbfc; border-bottom: 1px solid var(--grey); }
.prod-table td { padding: 12px 16px; border-bottom: 1px solid var(--grey); font-size: .92rem; vertical-align: middle; }
.prod-table tr:last-child td { border-bottom: none; }
.prod-thumb { width: 48px; height: 48px; border-radius: 7px; object-fit: cover; background: var(--grey); }
.prod-name { font-weight: 600; }
.prod-price { font-family: var(--font-mono); color: var(--amber); font-weight: 700; }
.row-actions { display: flex; gap: 8px; }

/* ---------- Product form ---------- */
.product-form { background: #fff; border: 1px solid var(--grey); border-radius: var(--radius); padding: 26px; max-width: 820px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; }
.form-actions { display: flex; align-items: center; gap: 12px; margin-top: 12px; }
.form-msg { font-size: .85rem; }
.image-preview { margin-top: 10px; }
.image-preview img { max-width: 160px; border-radius: 8px; border: 1px solid var(--grey); }

@media (max-width: 760px){
  .app-view { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; align-items: center; flex-wrap: wrap; gap: 12px; }
  .sb-nav { flex-direction: row; flex-wrap: wrap; }
  .sb-foot { margin: 0 0 0 auto; padding: 0; border: none; display: flex; gap: 10px; align-items: center; }
  .sb-who { display: none; }
  .content { padding: 22px 18px; }
  .form-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   v2 additions — dashboard, charts, sales, categories, gallery
   ============================================================ */

/* sidebar section label */
.sb-section { font-family: var(--font-mono); font-size: .64rem; text-transform: uppercase;
  letter-spacing: .14em; color: rgba(255,255,255,.4); padding: 18px 14px 6px; margin: 0; }

.range-select { padding: 9px 12px; border: 1px solid var(--grey-mid); border-radius: 8px;
  font-family: var(--font-body); background: #fff; font-size: .9rem; }

/* panels + grid */
.panel-grid { display: grid; grid-template-columns: 1.7fr 1fr; gap: 18px; margin-bottom: 18px; }
.panel { background: #fff; border: 1px solid var(--grey); border-radius: var(--radius); padding: 20px 22px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; gap: 12px; }
.panel-head h3 { font-family: var(--font-display); font-size: 1.05rem; font-weight: 600; }
.panel-tag { font-family: var(--font-mono); font-size: .72rem; color: var(--muted); }
.chart-wrap { width: 100%; }
.chart-wrap svg { width: 100%; height: auto; display: block; }

/* chart bits */
.legend { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.legend-row { display: flex; align-items: center; gap: 9px; font-size: .85rem; }
.legend-dot { width: 11px; height: 11px; border-radius: 3px; flex: none; }
.legend-row .lv { margin-left: auto; font-family: var(--font-mono); font-weight: 700; color: var(--navy); }
.donut-flex { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.donut-flex svg { max-width: 200px; }
.donut-flex .legend { flex: 1; min-width: 160px; }

/* top products list */
.top-list { display: flex; flex-direction: column; }
.top-row { display: grid; grid-template-columns: 26px 44px 1fr auto; gap: 12px; align-items: center;
  padding: 11px 0; border-bottom: 1px solid var(--grey); }
.top-row:last-child { border-bottom: none; }
.top-rank { font-family: var(--font-mono); color: var(--muted); font-weight: 700; }
.top-thumb { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; background: var(--grey); }
.top-name { font-weight: 600; font-size: .92rem; line-height: 1.2; }
.top-units { font-family: var(--font-mono); font-size: .8rem; color: var(--muted); }
.top-rev { font-family: var(--font-mono); font-weight: 700; color: var(--amber); }

/* horizontal bars */
.hbars { display: flex; flex-direction: column; gap: 12px; }
.hbar { display: grid; grid-template-columns: 130px 1fr 70px; gap: 10px; align-items: center; }
.hbar .hb-label { font-size: .85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hbar .hb-track { background: var(--grey); border-radius: 999px; height: 12px; overflow: hidden; }
.hbar .hb-fill { height: 100%; background: var(--amber); border-radius: 999px; }
.hbar .hb-val { font-family: var(--font-mono); font-size: .8rem; text-align: right; color: var(--navy); font-weight: 700; }

/* sales list */
.sale-table { width: 100%; border-collapse: collapse; }
.sale-table th { text-align: left; font-family: var(--font-mono); font-size: .68rem; text-transform: uppercase;
  letter-spacing: .06em; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--grey); }
.sale-table td { padding: 11px 12px; border-bottom: 1px solid var(--grey); font-size: .9rem; }
.sale-table tr:last-child td { border-bottom: none; }
.sale-amt { font-family: var(--font-mono); font-weight: 700; color: var(--amber); }

/* categories */
.cat-add { display: flex; gap: 10px; margin-bottom: 6px; }
.cat-add input { flex: 1; padding: 11px 13px; border: 1px solid var(--grey-mid); border-radius: 8px; font-family: var(--font-body); }
#categories-list { margin-top: 14px; }
.cat-item { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px;
  border: 1px solid var(--grey); border-radius: 8px; margin-bottom: 8px; }
.cat-item .cat-name { font-weight: 600; }
.cat-item .cat-count { font-family: var(--font-mono); font-size: .76rem; color: var(--muted); margin-left: 10px; }

/* multi-image preview with remove */
.image-preview { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.ip-thumb { position: relative; width: 92px; height: 92px; border-radius: 8px; overflow: hidden; border: 1px solid var(--grey); }
.ip-thumb img { width: 100%; height: 100%; object-fit: cover; }
.ip-thumb .ip-x { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border: none;
  border-radius: 50%; background: rgba(0,0,0,.65); color: #fff; cursor: pointer; font-size: .9rem; line-height: 1;
  display: flex; align-items: center; justify-content: center; }
.ip-thumb .ip-x:hover { background: #b00020; }
.ip-badge { position: absolute; bottom: 0; left: 0; right: 0; background: var(--amber); color: var(--navy);
  font-family: var(--font-mono); font-size: .6rem; text-align: center; padding: 2px; text-transform: uppercase; letter-spacing: .05em; }

@media (max-width: 980px){ .panel-grid { grid-template-columns: 1fr; } }
