/* ==========================================================================
   ALOKA TECH — admin panel
   Deliberately plain and roomy: the shop owner is not a developer.
   ========================================================================== */

:root {
  --brand: #006cb7;
  --brand-700: #005694;
  --brand-050: #eef6fc;
  --brand-100: #d7e9f7;
  --ink: #323369;
  --ink-800: #2a2b58;
  --ink-900: #1e1f43;
  --bg: #f4f6fa;
  --line: #e3e8f0;
  --line-strong: #cdd5e2;
  --text: #15171d;
  --muted: #5c6478;
  --muted-2: #8b93a5;
  --ok: #0f7b47;
  --ok-bg: #e7f5ee;
  --danger: #c0392b;
  --danger-bg: #fdecea;
  --warn: #b45309;
  --radius: 12px;
  --radius-sm: 9px;
  --shadow: 0 2px 10px rgba(16, 24, 40, .06);
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Poppins', 'Inter', system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-family: var(--font-display); font-weight: 700; letter-spacing: -.02em; margin: 0; line-height: 1.25; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
img, svg { display: block; max-width: 100%; }
svg { fill: currentColor; }
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-700); }
button { font: inherit; cursor: pointer; }

:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; border-radius: 4px; }

.req { color: var(--danger); }

/* ── Buttons ───────────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  padding: .62rem 1.1rem;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: .92rem;
  white-space: nowrap;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.btn svg { width: 17px; height: 17px; flex: none; }
.btn--brand { background: var(--brand); color: #fff; }
.btn--brand:hover { background: var(--brand-700); color: #fff; }
.btn--ghost { background: #fff; border-color: var(--line-strong); color: var(--ink); }
.btn--ghost:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-050); }
.btn--danger { background: #fff; border-color: #f0c6c1; color: var(--danger); }
.btn--danger:hover { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn--plain { background: none; color: var(--muted); }
.btn--plain:hover { color: var(--ink); background: #fff; }
.btn--sm { padding: .38rem .75rem; font-size: .84rem; }
.btn--lg { padding: .82rem 1.5rem; font-size: 1rem; }
.btn--block { width: 100%; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

/* ── Login / error screen ──────────────────────────────────────────── */

.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2rem 1.25rem;
  background:
    radial-gradient(800px 380px at 50% -10%, rgba(0, 108, 183, .35), transparent 65%),
    linear-gradient(160deg, var(--ink-900), var(--ink));
}
.login__card {
  width: 100%;
  max-width: 420px;
  background: #fff;
  border-radius: 18px;
  padding: 2.5rem 2.25rem;
  box-shadow: 0 24px 60px rgba(10, 12, 40, .35);
}
.login__brand { text-align: center; margin-bottom: 1.75rem; }
.login__wordmark {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.65rem;
  letter-spacing: -.03em;
  color: var(--brand);
}
.login__wordmark span { font-weight: 600; margin-left: .3em; }
.login__heritage {
  display: block;
  margin-top: 5px;
  font-family: Georgia, serif;
  font-size: .58rem;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--ink);
}
.login h1 { font-size: 1.4rem; color: var(--ink-900); }
.login__lede { margin: .4rem 0 1.5rem; color: var(--muted); font-size: .92rem; }
.login__back { margin-top: 1.5rem; text-align: center; font-size: .88rem; }
.login__back a { color: var(--muted); }
.login .btn { margin-top: .5rem; }

/* ── Shell ─────────────────────────────────────────────────────────── */

.admin { display: grid; grid-template-columns: 246px 1fr; min-height: 100vh; }

.side {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  padding: 1.6rem 1.1rem;
  background: var(--ink-900);
  color: rgba(255, 255, 255, .75);
  position: sticky;
  top: 0;
  height: 100vh;
}
.side__brand { padding: 0 .6rem; }
.side__wordmark {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: -.03em;
  color: #fff;
}
.side__wordmark span { font-weight: 600; margin-left: .28em; color: var(--brand-100); }
.side__sub {
  display: block;
  margin-top: 3px;
  font-size: .7rem;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .45);
}

.side__nav { display: flex; flex-direction: column; gap: 2px; }
.side__nav a {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .68rem .75rem;
  border-radius: var(--radius-sm);
  color: rgba(255, 255, 255, .75);
  font-weight: 500;
  font-size: .93rem;
}
.side__nav svg { width: 19px; height: 19px; opacity: .8; flex: none; }
.side__nav a:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.side__nav a.is-active { background: var(--brand); color: #fff; font-weight: 600; }
.side__nav a.is-active svg { opacity: 1; }

.side__foot { margin-top: auto; border-top: 1px solid rgba(255, 255, 255, .12); padding-top: 1.1rem; }
.side__view {
  display: flex;
  align-items: center;
  gap: .55rem;
  padding: .55rem .75rem;
  border-radius: var(--radius-sm);
  color: rgba(255, 255, 255, .75);
  font-size: .88rem;
  font-weight: 500;
}
.side__view svg { width: 16px; height: 16px; }
.side__view:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.side__logout { margin-top: .6rem; padding: 0 .75rem; }
.side__user { font-size: .78rem; color: rgba(255, 255, 255, .45); margin-bottom: .4rem; }
.side__user strong { color: rgba(255, 255, 255, .8); font-weight: 600; }
.side__logout button {
  width: 100%;
  padding: .5rem;
  background: none;
  border: 1px solid rgba(255, 255, 255, .22);
  border-radius: var(--radius-sm);
  color: rgba(255, 255, 255, .8);
  font-size: .86rem;
  font-weight: 600;
}
.side__logout button:hover { background: rgba(255, 255, 255, .1); color: #fff; }

.admin__main { padding: 2rem 2.25rem 4rem; min-width: 0; }
.admin__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.75rem;
}
.admin__head h1 { font-size: 1.6rem; color: var(--ink-900); }
.admin__sub { margin-top: .3rem; color: var(--muted); font-size: .92rem; }
.backlink { display: inline-block; margin-bottom: .5rem; font-size: .88rem; font-weight: 600; color: var(--muted); }
.backlink:hover { color: var(--brand); }

@media (max-width: 900px) {
  .admin { grid-template-columns: 1fr; }
  .side { position: static; height: auto; }
  .side__nav { flex-direction: row; flex-wrap: wrap; }
  .side__nav a { font-size: .86rem; padding: .5rem .7rem; }
  .side__foot { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
  .side__logout { margin-top: 0; padding: 0; }
  .side__user { display: none; }
  .admin__main { padding: 1.5rem 1.25rem 3rem; }
}

/* ── Alerts ────────────────────────────────────────────────────────── */

.alert {
  display: flex;
  align-items: flex-start;
  gap: .7rem;
  padding: .95rem 1.15rem;
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
  font-size: .93rem;
}
.alert svg { width: 20px; height: 20px; flex: none; margin-top: 1px; }
.alert--success { background: var(--ok-bg); color: var(--ok); border: 1px solid #bfe3d0; }
.alert--error { background: var(--danger-bg); color: var(--danger); border: 1px solid #f5cdc8; }
.alert__list { margin-top: .35rem; list-style: disc; padding-left: 1.1rem; }
.alert__list li { margin-top: .15rem; }
.alert a { color: inherit; text-decoration: underline; }

/* ── Stats ─────────────────────────────────────────────────────────── */

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 1.75rem; }
.stat {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem 1.35rem;
  box-shadow: var(--shadow);
}
.stat__num { display: block; font-family: var(--font-display); font-weight: 800; font-size: 2rem; color: var(--ink-900); letter-spacing: -.03em; }
.stat__label { display: block; color: var(--muted); font-size: .88rem; margin-top: -.15rem; }
.stat a { display: inline-block; margin-top: .6rem; font-size: .84rem; font-weight: 600; }
.stat--warn .stat__num { color: var(--warn); }

@media (max-width: 1000px) { .stats { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px) { .stats { grid-template-columns: 1fr; } }

/* ── Panels ────────────────────────────────────────────────────────── */

.panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.5rem 1.6rem;
  box-shadow: var(--shadow);
  margin-bottom: 1.5rem;
}
.panel__head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.1rem; }
.panel__head h2, .panel__title { font-size: 1.05rem; color: var(--ink-900); margin-bottom: 1.1rem; }
.panel__head h2 { margin-bottom: 0; }
.panel__count {
  display: inline-block;
  margin-left: .4rem;
  padding: .1rem .5rem;
  background: var(--brand-050);
  color: var(--brand);
  border-radius: 999px;
  font-size: .78rem;
  font-family: var(--font);
}
.panel--help { background: var(--brand-050); border-color: var(--brand-100); box-shadow: none; }
.link-more { font-size: .88rem; font-weight: 600; }

.guide { list-style: decimal; padding-left: 1.2rem; color: var(--muted); font-size: .93rem; }
.guide li { margin-top: .45rem; }
.guide strong { color: var(--ink-900); }

.blank { text-align: center; padding: 2.5rem 1rem; color: var(--muted); }
.blank p:first-child { font-size: 1.05rem; color: var(--ink-900); }
.blank .btn { margin-top: 1.1rem; }

/* ── Tables ────────────────────────────────────────────────────────── */

.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th {
  text-align: left;
  padding: .55rem .7rem;
  font-size: .74rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted-2);
  border-bottom: 1px solid var(--line);
}
.table td { padding: .75rem .7rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table strong { font-weight: 600; color: var(--ink-900); display: block; }
.th-img, .td-img { width: 58px; padding-right: 0 !important; }
.td-img img { width: 46px; height: 46px; object-fit: contain; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.td-price { font-weight: 600; color: var(--brand); white-space: nowrap; }
.td-view { font-size: .78rem; color: var(--muted-2); font-weight: 500; }
.td-view:hover { color: var(--brand); }
.td-actions { text-align: right; white-space: nowrap; }
.td-actions form { display: inline-block; margin-left: .35rem; }

.pill {
  display: inline-block;
  padding: .18rem .55rem;
  border-radius: 999px;
  font-size: .76rem;
  font-weight: 600;
}
.pill--ok { background: var(--ok-bg); color: var(--ok); }
.pill--off { background: var(--danger-bg); color: var(--danger); }
.pill--star { background: #fff5e0; color: var(--warn); margin-left: .4rem; }

@media (max-width: 760px) {
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tr { border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem; margin-bottom: .75rem; }
  .table td { border: 0; padding: .25rem 0; }
  .td-actions { text-align: left; margin-top: .6rem; }
  .td-actions form { margin-left: 0; margin-right: .35rem; }
}

/* ── Forms ─────────────────────────────────────────────────────────── */

.field { margin-bottom: 1.15rem; }
.field label { display: block; font-weight: 600; font-size: .89rem; color: var(--ink-900); margin-bottom: .35rem; }
.field input[type="text"],
.field input[type="email"],
.field input[type="password"],
.field input[type="search"],
.field select,
.field textarea {
  width: 100%;
  font: inherit;
  font-size: .94rem;
  padding: .62rem .8rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--text);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.field textarea { resize: vertical; min-height: 120px; line-height: 1.6; }
.field select { appearance: none; background: #fff url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%235c6478'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E") no-repeat right .6rem center / 18px; padding-right: 2.2rem; }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(0, 108, 183, .14);
}
.field input[type="file"] {
  width: 100%;
  font-size: .88rem;
  padding: .55rem;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-sm);
  background: #fbfcfe;
}
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 620px) { .field-row { grid-template-columns: 1fr; gap: 0; } }

.hint { margin-top: .35rem; font-size: .82rem; color: var(--muted-2); line-height: 1.45; }
.hint--panel { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--line); }

.form__sub { font-size: .95rem; color: var(--ink-900); margin: 1.75rem 0 .25rem; }

.form__grid { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 20px; align-items: start; }
.form__side .panel { margin-bottom: 16px; }
.form__actions { position: sticky; top: 1.5rem; display: grid; gap: .5rem; }
@media (max-width: 980px) { .form__grid { grid-template-columns: 1fr; } .form__actions { position: static; } }

.check { display: flex; align-items: flex-start; gap: .65rem; padding: .6rem 0; cursor: pointer; }
.check input { width: 19px; height: 19px; margin: 2px 0 0; accent-color: var(--brand); flex: none; cursor: pointer; }
.check span { display: block; font-size: .9rem; }
.check strong { display: block; font-weight: 600; color: var(--ink-900); }
.check em { display: block; font-style: normal; font-size: .82rem; color: var(--muted-2); margin-top: .1rem; }
.check--inline { padding: 0; }

/* Image uploader */
.uploader__preview {
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
  background: #fbfcfe;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  margin-bottom: .75rem;
}
.uploader__preview.is-empty { display: none; }
.uploader__placeholder {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  background: #fbfcfe;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-sm);
  color: var(--muted-2);
  font-size: .88rem;
  margin-bottom: .75rem;
}
.uploader__input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.uploader label.btn { cursor: pointer; }

.toolbar { display: flex; gap: .6rem; align-items: center; margin-bottom: 1.25rem; flex-wrap: wrap; }
.toolbar__search { position: relative; flex: 1 1 260px; }
.toolbar__search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; color: var(--muted-2); }
.toolbar__search input {
  width: 100%;
  font: inherit;
  font-size: .92rem;
  padding: .58rem .8rem .58rem 2.2rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: #fff;
}
.toolbar__search input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(0, 108, 183, .14); }

/* ── Split layout (categories, settings) ───────────────────────────── */

.split { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
.panel--sticky { position: sticky; top: 1.5rem; }
@media (max-width: 980px) { .split { grid-template-columns: 1fr; } .panel--sticky { position: static; } }

/* ── Category rows ─────────────────────────────────────────────────── */

.rows { display: flex; flex-direction: column; }
.row {
  display: flex;
  align-items: center;
  gap: .8rem;
  padding: .7rem 0;
  border-bottom: 1px solid var(--line);
}
.row:last-child { border-bottom: 0; }
.row__order { display: flex; flex-direction: column; gap: 2px; flex: none; }
.row__order button {
  width: 26px; height: 20px;
  display: grid; place-items: center;
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  color: var(--muted);
  font-size: .6rem;
  line-height: 1;
  padding: 0;
}
.row__order button:hover:not(:disabled) { border-color: var(--brand); color: var(--brand); }
.row__order button:disabled { opacity: .3; cursor: not-allowed; }

.row__edit { display: flex; gap: .5rem; flex: 1; min-width: 0; }
.row__edit input {
  flex: 1;
  min-width: 0;
  font: inherit;
  font-size: .93rem;
  padding: .48rem .7rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
}
.row__edit input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(0, 108, 183, .14); }
.row__count { font-size: .84rem; color: var(--muted-2); white-space: nowrap; flex: none; }

@media (max-width: 620px) {
  .row { flex-wrap: wrap; }
  .row__edit { flex: 1 1 100%; order: 1; }
  .row__count { order: 2; }
}

/* ── Banner slides ─────────────────────────────────────────────────── */

.slides { display: flex; flex-direction: column; gap: 1.1rem; }
.slide-row {
  display: grid;
  grid-template-columns: 34px 220px minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: start;
  padding: 1.1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcfe;
}
.slide-row.is-off { opacity: .62; }
.slide-row__order { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.slide-row__order button {
  width: 28px; height: 21px;
  display: grid; place-items: center;
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  color: var(--muted);
  font-size: .6rem;
  padding: 0;
}
.slide-row__order button:hover:not(:disabled) { border-color: var(--brand); color: var(--brand); }
.slide-row__order button:disabled { opacity: .3; cursor: not-allowed; }
.slide-row__num { font-size: .8rem; font-weight: 700; color: var(--muted-2); }
.slide-row__img {
  width: 220px; height: 86px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: #fff;
}
.slide-row__form .field { margin-bottom: .7rem; }
.slide-row__form .field label { font-size: .82rem; }
.slide-row__foot { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-top: .3rem; }

@media (max-width: 1100px) {
  .slide-row { grid-template-columns: 34px minmax(0, 1fr); }
  .slide-row__img { width: 100%; height: 120px; grid-column: 2; }
  .slide-row__form { grid-column: 2; }
  .slide-row__delete { grid-column: 2; }
}

.banner-form .field-row { margin-bottom: 0; }
