/* ==========================================================================
   Shell — a sidebar beside the page on a desktop screen, a top bar and an
   off-canvas drawer on anything narrower. The sidebar is fixed, so the page
   only has to leave room for it (.admin-page below).
   ========================================================================== */

:root {
  --sidebar-w: 236px;
  --topbar-h: 56px;
}

/* Every page's outermost wrapper. These were centring flex columns, which is
   why the boards inside them carried a fixed width wider than their own
   container and clipped on the left. Plain blocks now: the shell sets the
   offset, .body-pad sets the measure. */
.admin-page,
.home-container,
.orders-container,
.products-container,
.reviews-container,
.tutorials-container,
.discount-container,
.users-container {
  display: block;
  min-height: 100vh;
  background: var(--bg);
}

/* ---------- Sidebar ---------- */

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  width: var(--sidebar-w);
  background: var(--ink);
  color: #ffffff;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 20px 18px 14px;
}

.sidebar-logo {
  display: flex;
  align-items: baseline;
  gap: 7px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-weight: 800;
  font-size: 16px;
  letter-spacing: 0.04em;
  color: #ffffff;
  text-decoration: none;
}

.sidebar-logo span {
  font-weight: 500;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.55);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px 12px;
}

/* 44px tall so it is a comfortable target on the touch screens that get the
   drawer, and roomy rather than cramped on a desktop. */
.sidebar-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 44px;
  padding: 0 12px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.72);
  text-decoration: none;
  transition:
    background-color 0.16s ease,
    color 0.16s ease;
}

.sidebar-link:hover {
  background: rgba(255, 255, 255, 0.07);
  color: #ffffff;
}

/* The current page is marked twice over: a lighter panel and a bar down the
   left edge, so it does not rest on a colour difference alone. */
.sidebar-link.active {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  font-weight: 600;
}

.sidebar-link.active::before {
  content: "";
  position: absolute;
  left: -12px;
  top: 10px;
  bottom: 10px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: #ffffff;
}

.sidebar-link:focus-visible,
.sidebar-logout:focus-visible,
.sidebar-close:focus-visible,
.topbar-menu:focus-visible {
  outline: 2px solid #ffffff;
  outline-offset: 2px;
}

.sidebar-icon {
  display: inline-flex;
  flex-shrink: 0;
  width: 20px;
  height: 20px;
}

.sidebar-icon svg {
  width: 100%;
  height: 100%;
}

.sidebar-label {
  flex: 1;
}

/* How many orders are waiting for a decision, on the item that leads to them
   — the one number worth carrying on every page. */
.sidebar-badge {
  min-width: 20px;
  padding: 2px 6px;
  border-radius: 10px;
  background: var(--warn);
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.sidebar-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: auto;
  padding: 14px 18px 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.sidebar-who {
  font-size: 13px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.82);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-logout {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  padding: 7px 10px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.72);
  text-decoration: none;
  transition:
    background-color 0.16s ease,
    color 0.16s ease;
}

.sidebar-logout svg {
  width: 15px;
  height: 15px;
}

.sidebar-logout:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.sidebar-close,
.sidebar-scrim {
  display: none;
}

/* ---------- Top bar (narrow screens) ---------- */

.topbar {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 90;
  align-items: center;
  gap: 10px;
  height: var(--topbar-h);
  padding: 0 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.topbar-menu {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin-left: -6px;
  border: none;
  border-radius: 8px;
  background: none;
  color: var(--ink);
  cursor: pointer;
}

.topbar-menu svg {
  width: 22px;
  height: 22px;
}

.topbar-title {
  flex: 1;
  font-weight: 700;
  font-size: 16px;
  color: var(--ink);
}

.topbar-waiting {
  padding: 6px 10px;
  border-radius: 20px;
  background: var(--warn-soft);
  color: var(--warn);
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

/* Signed out there is no sidebar, so this bar carries the brand and the two
   links on every width. */
.topbar.signed-out {
  display: flex;
  position: static;
  justify-content: space-between;
}

.topbar.signed-out .sidebar-logo {
  color: var(--ink);
}

.topbar.signed-out .sidebar-logo span {
  color: var(--ink-faint);
}

.topbar-auth {
  display: flex;
  gap: 6px;
}

.topbar-auth a {
  padding: 9px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-soft);
  text-decoration: none;
}

.topbar-auth a:hover {
  background: var(--accent-soft);
  color: var(--accent);
}

/* ---------- Desktop: the page sits beside the sidebar ---------- */

@media (min-width: 1024px) {
  .admin-page,
  .home-container,
  .orders-container,
  .products-container,
  .reviews-container,
  .tutorials-container,
  .discount-container,
  .users-container {
    padding-left: var(--sidebar-w);
  }
}

/* ---------- Narrow: the sidebar becomes a drawer ---------- */

@media (max-width: 1023px) {
  .topbar {
    display: flex;
  }

  .admin-page,
  .home-container,
  .orders-container,
  .products-container,
  .reviews-container,
  .tutorials-container,
  .discount-container,
  .users-container {
    padding-top: var(--topbar-h);
  }

  /* Translated rather than hidden, so it can slide; still unreachable by tab
     while closed because the whole panel is out of the layout's flow and
     inert to pointers. */
  .sidebar {
    width: min(280px, 82vw);
    transform: translateX(-100%);
    visibility: hidden;
    transition:
      transform 0.22s cubic-bezier(0.2, 0.8, 0.2, 1),
      visibility 0.22s;
  }

  .sidebar.open {
    transform: none;
    visibility: visible;
  }

  .sidebar-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    margin-right: -8px;
    border: none;
    border-radius: 8px;
    background: none;
    color: rgba(255, 255, 255, 0.75);
    cursor: pointer;
  }

  .sidebar-close svg {
    width: 20px;
    height: 20px;
  }

  .sidebar-scrim {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 95;
    background: rgba(0, 0, 0, 0.45);
    opacity: 0;
    transition: opacity 0.22s ease;
  }

  .sidebar-scrim.open {
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .sidebar,
  .sidebar-scrim {
    transition: none;
  }
}

/* ---------- Small screens ---------- */

@media (max-width: 760px) {
  .body-pad {
    padding: 18px 16px 24px;
  }

  /* Percentage column widths will squeeze a table into the viewport until
     every cell is one character and an ellipsis. The table keeps a width it
     is readable at and .table-scroll slides it sideways instead. */
  .table-data {
    min-width: 680px;
  }

  /* 14px each side of a 40px column leaves twelve pixels for the text. */
  .table-data th,
  .table-data td {
    padding: 12px 10px;
    font-size: 14px;
  }

  .table-data th {
    font-size: 14px;
  }

  .modal-backdrop {
    padding: 16px 12px;
  }

  .modal-box {
    padding: 18px 16px;
  }

  .toast-host {
    top: calc(var(--topbar-h) + 10px);
    right: 12px;
    left: 12px;
  }

  .toast {
    max-width: none;
  }
}

/* ---------- Page ---------- */

.body-pad {
  width: 100%;
  max-width: 1300px;
  margin: 0 auto;
  padding: 26px 28px 30px;
}

.table-scroll {
  width: 100%;
  overflow-x: auto;
}



/* ---------- Section header ---------- */

.section-head {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}

.section-title {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-weight: 800;
  font-size: 20px;
  color: var(--ink);
}

/* ---------- Buttons ---------- */

.btn-console {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  padding: 10px 18px;
  border-radius: 9px;
  border: none;
  cursor: pointer;
  text-decoration: none;
}

.btn-console:hover {
  background: var(--accent-hover);
}

.btn-text-danger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--hard);
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  padding: 10px 18px;
  border-radius: 9px;
  border: none;
  cursor: pointer;
}

.btn-text-danger:hover {
  background: #a6301f;
}

/* ---------- Data table ---------- */

.table-data {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  background: var(--surface);
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
}

.table-data th,
.table-data td {
  padding: 14px;
  text-align: left;
  font-size: 15px;
  border-bottom: 1px solid var(--line);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.table-data th {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 16px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink);
  background: var(--line-strong);
}

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

.table-data tbody tr:hover {
  background: var(--accent-soft);
}

.cell-strong {
  font-weight: 700;
  color: var(--ink);
}

.cell-soft {
  color: var(--ink-soft);
}

.thumb-sm {
  width: 46px;
  height: 46px;
  border-radius: 8px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  object-fit: cover;
  display: block;
}

/* ---------- Status pill select ---------- */

.status-select {
  border: none;
  border-radius: 999px;
  padding: 4px 4px 4px 11px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  text-transform: capitalize;
}

.status-select.status-process {
  background: var(--good-soft);
  color: var(--good);
}

.status-select.status-pause {
  background: var(--warn-soft);
  color: var(--warn);
}

.status-select.status-delete {
  background: var(--hard-soft);
  color: var(--hard);
}

.status-select.status-active {
  background: var(--good-soft);
  color: var(--good);
}

.status-select.status-block {
  background: var(--warn-soft);
  color: var(--warn);
}

.status-select.status-hidden {
  background: var(--surface-2);
  color: var(--ink-soft);
}


/* ---------- Outline button ---------- */

.btn-outline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1.5px solid var(--line-strong);
  color: var(--ink-soft);
  font-weight: 700;
  font-size: 12.5px;
  padding: 7px 14px;
  border-radius: 8px;
  background: var(--surface);
  cursor: pointer;
}

.btn-outline:hover {
  border-color: var(--ink-soft);
  color: var(--ink);
}

/* ---------- Modal ---------- */

.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  padding: 40px 24px;
  align-items: flex-start;
  justify-content: center;
  overflow-y: auto;
  z-index: 1000;
}

.modal-backdrop.open {
  display: flex;
}

.modal-box {
  background: var(--surface);
  border-radius: 16px;
  padding: 26px 28px;
  max-width: 1000px;
  width: 100%;
  height: auto;
  box-shadow: 0 20px 60px -20px rgba(0, 0, 0, 0.4);
}

.modal-box .title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.modal-box .title {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-weight: 800;
  font-size: 18px;
  color: var(--ink);
}

.modal-close {
  background: none;
  border: none;
  color: var(--ink-faint);
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
  padding: 0;
}

/* Column flex and min-width: 0 were Bootstrap's .card until it was dropped;
   the dashboard panels size their rows by them, so they stay. */
.card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow-wrap: break-word;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px;
  margin-bottom: 16px;
}

.card .label {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-faint);
  margin-bottom: 10px;
}

.card .name {
  font-weight: 700;
  color: var(--ink);
  font-size: 14px;
}

.card .sub {
  color: var(--ink-soft);
  font-size: 12.5px;
  margin-top: 3px;
}

.item-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  padding: 6px 0;
  border-bottom: 1px solid var(--line);
  color: var(--ink-soft);
}

.item-row:last-of-type {
  border-bottom: none;
}

.item-row .n {
  color: var(--ink);
  font-weight: 600;
}

.total-row {
  display: flex;
  justify-content: space-between;
  font-weight: 800;
  color: var(--ink);
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  font-size: 14px;
}

/* Sits under the total and explains it: the pre-discount price and what came
   off. Quiet on purpose — the number above is the one being reconciled. */
.total-note {
  display: flex;
  justify-content: flex-end;
  margin-top: 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-faint);
}

/* Marks a discounted order in the list, so a total that looks low against the
   products in it is explained at a glance. */
.sale-chip {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--good-soft);
  color: var(--good);
  font-size: 11px;
  font-weight: 700;
}

.order-detail {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 22px;
}

@media (max-width: 700px) {
  .order-detail {
    grid-template-columns: 1fr;
  }
}

.shot-img {
  width: 100%;
  max-height: 340px;
  object-fit: contain;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  display: block;
}

.shot-img + .shot-img {
  margin-top: 10px;
}

.decision-row {
  display: flex;
  gap: 10px;
  margin-top: 4px;
}

.decision-row .btn-console,
.decision-row .btn-text-danger {
  flex: 1;
  justify-content: center;
}
/* ---------- Pager ---------- */

/* Sits under a list, inside the same card, so the count reads as part of the
   table rather than as something floating below it. */
.pager {
  /* The lists sit in centring flex columns, which would otherwise shrink the
     pager to its contents and leave the rule above it floating. */
  width: 100%;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

/* Centres the count when there is only one page and the steps are absent. */
.pager-count {
  flex: 1;
  text-align: center;
  font-size: 13px;
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
}

.pager-step {
  display: inline-flex;
  align-items: center;
  padding: 7px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
  transition:
    background-color 0.15s ease,
    border-color 0.15s ease;
}

.pager-step:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-hover);
}

.pager-step:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* The end of the list. Kept in place rather than removed so the count stays
   centred and the other step doesn't slide across as you page. */
.pager-step.is-off {
  color: var(--ink-faint);
  background: var(--surface-2);
  border-color: var(--line);
  cursor: default;
}

/* ---------- Toasts ---------- */

/* Top-right, under the nav bar, where nothing else in the panel lives. */
.toast-host {
  position: fixed;
  top: 76px;
  right: 20px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  min-width: 220px;
  max-width: 360px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-left-width: 3px;
  border-radius: 10px;
  background: var(--surface);
  box-shadow: 0 12px 32px -12px rgba(0, 0, 0, 0.35);
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  /* Starts just off to the right and arrives, so the eye catches the movement
     without the panel appearing to jump. */
  opacity: 0;
  transform: translateX(12px);
  transition:
    opacity 0.18s cubic-bezier(0.2, 0.8, 0.2, 1),
    transform 0.18s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.toast.in {
  opacity: 1;
  transform: none;
}

.toast-good {
  border-left-color: var(--good);
}

.toast-bad {
  border-left-color: var(--hard);
  color: var(--hard);
}

@media (prefers-reduced-motion: reduce) {
  .toast {
    transition: none;
    opacity: 1;
    transform: none;
  }
}

/* ---------- Confirm dialog ---------- */

/* Narrower than the order detail modal and vertically centred: it holds one
   question, so sitting at the top of a tall backdrop would look lost. */
.confirm-backdrop {
  align-items: center;
}

.confirm-box {
  max-width: 420px;
}

.confirm-box .title-row {
  margin-bottom: 10px;
}

.confirm-body {
  margin: 0;
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink-soft);
}

.confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 22px;
}

.btn-danger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border: 1px solid var(--hard);
  border-radius: 8px;
  background: var(--hard);
  color: #ffffff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.btn-danger:hover {
  background: #a93226;
  border-color: #a93226;
}

.btn-danger:focus-visible,
.confirm-actions .btn-outline:focus-visible,
.confirm-actions .btn-console:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------- Filter chips ---------- */

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* Scoped through .chip-row so these outrank the page stylesheets' blanket
   "every link in this page is ink" rule, which loads after this file. */
.chip-row .chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: 20px;
  background: var(--surface);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
  text-decoration: none;
  transition:
    background-color 0.16s ease,
    border-color 0.16s ease,
    color 0.16s ease;
}

.chip-row .chip:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.chip-row .chip:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.chip-row .chip.active {
  background: var(--ink);
  border-color: var(--ink);
  color: #ffffff;
}

.chip-row .chip-count {
  font-variant-numeric: tabular-nums;
  opacity: 0.72;
}

/* The one filter with work behind it, tinted while it is not the chip in
   use — selecting it hands it over to the plain active look. */
.chip-row .chip-waiting:not(.active) {
  border-color: var(--warn);
  color: var(--warn);
  background: var(--warn-soft);
}

/* ---------- Icon buttons ---------- */

/* 36px, which with the 8px gap keeps a pair of them comfortably apart. The
   title and aria-label carry the meaning the glyph alone would not. */
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border: 1px solid transparent;
  border-radius: 9px;
  cursor: pointer;
  transition:
    background-color 0.16s ease,
    border-color 0.16s ease;
}

.icon-btn svg {
  width: 18px;
  height: 18px;
}

.icon-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.icon-btn:disabled {
  opacity: 0.45;
  cursor: default;
}

.icon-btn.is-good {
  background: var(--good-soft);
  border-color: var(--good-soft);
  color: var(--good);
}

.icon-btn.is-good:hover:not(:disabled) {
  background: var(--good);
  border-color: var(--good);
  color: #ffffff;
}

.icon-btn.is-hard {
  background: var(--hard-soft);
  border-color: var(--hard-soft);
  color: var(--hard);
}

.icon-btn.is-hard:hover:not(:disabled) {
  background: var(--hard);
  border-color: var(--hard);
  color: #ffffff;
}

.row-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ---------- Prompt field ---------- */

.prompt-label {
  display: block;
  margin: 16px 0 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
}

.prompt-text {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: var(--surface);
  font-family: inherit;
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
  resize: vertical;
}

.prompt-text:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
