/* Soda Time Admin Portal
   Brand colours mirror sodatime_dart_lib/lib/colors.dart. */

:root {
  --soda-red: #ce171f;
  --soda-red-dark: #a5121a;
  --soda-green: #5ca038;
  --font-grey: #777777;
  --ink: #1f2124;
  --line: #e2e4e8;
  --surface: #ffffff;
  --page: #f4f5f7;
  --font-body: "Nunito", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-display: "Barlow Condensed", "Nunito", Arial, sans-serif;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 6px 20px rgba(0, 0, 0, 0.05);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font: 15px/1.5 var(--font-body);
}

[hidden] { display: none !important; }

/* ---------------------------------------------------------------- Branding

   sodatime.com ships only a white-on-transparent logo, and its favicon is that
   logo on the brand red — so every surface carrying the logo is red. */

.login-logo {
  display: block;
  width: 190px;
  height: auto;
  margin: 0 auto 4px;
}

.app-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
}

.app-title img {
  height: 34px;
  width: auto;
}

.app-title span {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.85);
}

/* ------------------------------------------------------------------ Boot */

.booting {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  color: var(--font-grey);
}

.spinner {
  width: 28px;
  height: 28px;
  border: 3px solid var(--line);
  border-top-color: var(--soda-red);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------------ Login */

.login-view {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--soda-red);
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 36px 32px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* Red bed behind the white logo, bleeding to the card's edges. */
.login-card .login-logo {
  background: var(--soda-red);
  padding: 26px 24px 22px;
  margin: -36px -32px 0;
  width: auto;
  max-width: none;
  box-sizing: content-box;
  object-fit: contain;
  height: 96px;
}

.login-subtitle {
  margin: 0;
  text-align: center;
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--font-grey);
}

.field { display: flex; flex-direction: column; gap: 6px; }
.field span { font-size: 13px; font-weight: 600; color: var(--font-grey); }

.field input {
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 15px;
  background: #fff;
  color: var(--ink);
}
.field input:focus {
  outline: none;
  border-color: var(--soda-red);
  box-shadow: 0 0 0 3px rgba(206, 23, 31, 0.14);
}

/* --------------------------------------------------------------- Buttons */

.button {
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 11px 18px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}
.button:disabled { opacity: 0.55; cursor: not-allowed; }

.button.primary { background: var(--soda-red); color: #fff; }
.button.primary:hover:not(:disabled) { background: var(--soda-red-dark); }

.button.ghost {
  background: #fff;
  border-color: var(--line);
  color: var(--ink);
}
.button.ghost:hover:not(:disabled) { border-color: var(--font-grey); }

.button.small { padding: 7px 13px; font-size: 13px; }

/* -------------------------------------------------------------- Messages */

.error {
  margin: 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: #fdecec;
  color: #96131a;
  font-size: 14px;
}

.warning {
  margin: 12px 0 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: #fff6e5;
  color: #8a5a00;
  font-size: 13.5px;
}

.status {
  margin: 14px 0 0;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 14px;
  background: #eef4ea;
  color: #3d6b24;
}
.status.is-error { background: #fdecec; color: #96131a; }

/* ---------------------------------------------------------------- Layout */

.app-header {
  background: var(--soda-red);
  border-bottom: 1px solid var(--soda-red-dark);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.header-right { display: flex; align-items: center; gap: 14px; }
.user-email { color: rgba(255, 255, 255, 0.9); font-size: 14px; }

.app-main { max-width: 1080px; margin: 0 auto; padding: 28px 24px 64px; }

.page-title {
  margin: 0 0 6px;
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.page-intro { margin: 0 0 24px; color: var(--font-grey); max-width: 70ch; }

.page-intro code {
  background: #eceef1;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 13px;
}

.columns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 20px;
  align-items: start;
}

.panel {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}
.panel h3 {
  margin: 0 0 14px;
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.note-panel { margin-top: 20px; }
.note-panel p { margin: 0; color: var(--font-grey); max-width: 80ch; }

/* ------------------------------------------------------ Kiosk-shaped frame

   aspect-ratio is set from JS to match the selected tablet shape. The image
   uses object-fit: fill, which is what the kiosk's BoxFit.fill does — it
   stretches rather than preserving the aspect ratio. */

.kiosk-frame {
  width: 100%;
  aspect-ratio: 1.875;
  background: var(--soda-red);
  border-radius: 6px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.kiosk-frame img { width: 100%; height: 100%; display: block; }
.kiosk-frame img.fill { object-fit: fill; }

.frame-placeholder {
  color: #fff;
  font-size: 14px;
  opacity: 0.9;
  text-align: center;
  padding: 12px;
}

/* -------------------------------------------------------------- Dropzone */

.dropzone {
  border: 2px dashed var(--line);
  border-radius: var(--radius);
  padding: 30px 16px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}
.dropzone:hover,
.dropzone:focus-visible,
.dropzone.is-dragging {
  border-color: var(--soda-red);
  background: #fdf4f4;
  outline: none;
}

.dropzone-main { margin: 0 0 4px; font-weight: 600; }
.dropzone-sub { margin: 0; color: var(--font-grey); font-size: 13.5px; }

/* ------------------------------------------------------------------ Meta */

.meta {
  margin: 14px 0 0;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 14px;
  font-size: 13.5px;
}
.meta > div { display: contents; }
.meta dt { color: var(--font-grey); }
.meta dd { margin: 0; }

.actions { display: flex; gap: 10px; margin-top: 16px; }

/* --------------------------------------------------------- Ratio picker */

.ratio-picker { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.ratio-picker label { font-size: 13px; font-weight: 600; color: var(--font-grey); margin-right: 8px; }

.ratio-picker select {
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  font-size: 14px;
  background: #fff;
  color: var(--ink);
}

.hint { margin: 10px 0 0; font-size: 13px; color: var(--font-grey); }

/* -------------------------------------------------------------- Progress */

.progress-track {
  margin-top: 12px;
  height: 6px;
  background: var(--line);
  border-radius: 3px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  width: 0;
  background: var(--soda-green);
  transition: width 0.2s ease;
}

/* ---------------------------------------------------- Alpha demo callout */

.demo-note {
  margin: 4px 0 0;
  padding: 10px 12px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #fafbfc;
  color: var(--font-grey);
  font-size: 13px;
  text-align: center;
}

.demo-note code {
  background: #eceef1;
  padding: 1px 5px;
  border-radius: 4px;
  color: var(--ink);
  font-size: 12.5px;
}


/* Explicit "Choose image..." button inside the dropzone. */
.dropzone .button { margin-top: 14px; }

/* Sign out sits on the red header bar. */
.app-header .button.ghost {
  background: transparent;
  border-color: rgba(255, 255, 255, 0.5);
  color: #fff;
}
.app-header .button.ghost:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.14);
  border-color: #fff;
}

/* Publishing is only half the job — the kiosks need a restart. */
.restart-callout {
  margin: 0;
  padding: 14px 16px;
  border-left: 4px solid var(--soda-red);
  border-radius: 0 8px 8px 0;
  background: #fdf4f4;
  color: var(--ink);
  max-width: 80ch;
}

/* ================================================================ Catalog
   Menu drinks, syrups & extras, sodas, soda colours, treats, published apps. */

.app-nav { display: flex; flex-wrap: wrap; gap: 4px; flex: 1; justify-content: center; }
.app-nav a {
  color: rgba(255, 255, 255, 0.85);
  text-decoration: none;
  font-weight: 700;
  font-size: 14px;
  padding: 6px 10px;
  border-radius: 7px;
}
.app-nav a:hover { background: rgba(255, 255, 255, 0.14); color: #fff; }
.app-nav a.is-active { background: #fff; color: var(--soda-red); }

.page-intro p { margin: 0 0 8px; }
.page-toolbar { display: flex; gap: 10px; margin: 0 0 16px; }
.empty-state { color: var(--font-grey); padding: 24px; background: var(--surface); border-radius: var(--radius); }

.group-title {
  margin: 22px 0 8px;
  font-family: var(--font-display);
  font-size: 17px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--font-grey);
}

.catalog-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.catalog-row {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  gap: 14px;
  align-items: center;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 10px 14px;
}
.catalog-row.is-off { opacity: 0.6; }
.thumb { width: 56px; height: 56px; object-fit: contain; border-radius: 6px; background: #f6f7f9; }
.thumb.empty, .thumb.broken { background: repeating-linear-gradient(45deg, #f1f2f4, #f1f2f4 6px, #e8eaee 6px, #e8eaee 12px); }
.row-main { min-width: 0; }
.row-title { font-weight: 800; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row-title .variant { font-weight: 600; color: var(--font-grey); font-size: 13.5px; }
.row-sub { color: var(--font-grey); font-size: 13.5px; }
.row-actions { display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.row-buttons { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
a.button { text-decoration: none; display: inline-block; }
.reach { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }

.chip {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  background: #eef4ea;
  color: #3d6b24;
}
.chip.muted, .chip.off { background: #eceef1; color: var(--font-grey); }
.chip.warn { background: #fff6e5; color: #8a5a00; }
.chip.good { background: #eef4ea; color: #3d6b24; }

.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 8px; }
.tab {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  padding: 8px 16px;
  font-weight: 700;
  cursor: pointer;
}
.tab.is-active { background: var(--soda-red); border-color: var(--soda-red); color: #fff; }

/* ---------------------------------------------------------------- Editor */

dialog.editor {
  border: none;
  border-radius: var(--radius);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
  padding: 24px;
  width: min(640px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
}
dialog.editor.wide { width: min(980px, calc(100vw - 32px)); }
dialog.editor::backdrop { background: rgba(20, 22, 26, 0.45); }
.editor-title { margin: 0 0 12px; font-family: var(--font-display); font-size: 24px; text-transform: uppercase; }
.editor-body { display: flex; flex-direction: column; gap: 14px; margin-bottom: 12px; }

.field-row { display: grid; grid-template-columns: 150px 1fr; gap: 6px 14px; align-items: start; }
.field-row > .field-label { font-size: 13px; font-weight: 700; color: var(--font-grey); padding-top: 9px; }
.field-row > .field-help { grid-column: 2; font-size: 12.5px; color: var(--font-grey); }
.field-row.type-checkbox > input { justify-self: start; margin-top: 10px; width: 18px; height: 18px; }
.field-row > .switch { justify-self: start; padding-top: 6px; }
.field-row input[type="text"], .field-row input[type="number"], .field-row select {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  font-size: 14px;
  background: #fff;
  color: var(--ink);
  width: 100%;
}
.field-row input[type="color"] { width: 64px; height: 36px; border: 1px solid var(--line); border-radius: 7px; background: #fff; }
.field-row input.narrow, .inline-row .narrow { width: 72px; }
.with-counter { display: flex; align-items: center; gap: 8px; }
.counter { font-size: 12px; color: var(--font-grey); white-space: nowrap; }
.counter.over, .hint.over { color: #96131a; font-weight: 700; }

.chips { display: flex; flex-wrap: wrap; gap: 10px; padding-top: 6px; }
.chip-toggle { display: flex; align-items: center; gap: 6px; font-size: 14px; }

.image-field { display: flex; gap: 14px; align-items: center; }
.image-field .preview { width: 96px; height: 96px; object-fit: contain; border-radius: 8px; background: #f6f7f9; border: 1px solid var(--line); }
.image-field .preview.empty, .image-field .preview.broken {
  display: flex; align-items: center; justify-content: center; font-size: 12px; color: var(--font-grey);
}
.image-actions { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }

.rows { display: flex; flex-direction: column; gap: 6px; }
.inline-row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.inline-row.header span { font-size: 12px; font-weight: 700; color: var(--font-grey); }
.inline-row .grow { flex: 1; min-width: 180px; }
.inline-row .grow select { width: 100%; }
.price-cell { display: flex; flex-direction: column; font-size: 12px; font-weight: 700; color: var(--font-grey); gap: 2px; }
.price-cell .chip { text-align: center; font-size: 11px; padding: 1px 6px; }

/* ------------------------------------------------------ Shown / hidden */

.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; font-size: 13px; font-weight: 700; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .slider {
  position: relative;
  width: 42px;
  height: 24px;
  border-radius: 999px;
  background: #c9ccd2;
  transition: background 0.15s;
  flex: none;
}
.switch .slider::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  transition: transform 0.15s;
}
.switch input:checked + .slider { background: var(--soda-green); }
.switch input:checked + .slider::after { transform: translateX(18px); }
.switch input:focus-visible + .slider { outline: 2px solid var(--soda-red); outline-offset: 2px; }
.switch input:disabled + .slider { opacity: 0.5; }
.switch .switch-text { min-width: 48px; color: var(--font-grey); }
.catalog-row.is-off .switch { opacity: 1; }

/* ------------------------------------------------------------ Item types */

.breadcrumb { margin: 0 0 12px; font-size: 13.5px; color: var(--font-grey); }
.breadcrumb a { color: var(--soda-red); }
.form-page { max-width: 980px; }
.form-page form .editor-title { margin-top: 0; }
.tab-count { margin-left: 6px; font-size: 12px; opacity: 0.75; }
.tab.is-hidden-type { text-decoration: line-through; }
.type-thumb { display: grid; place-items: center; font-size: 26px; color: var(--font-grey); }

.kind-cards, .type-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.kind-card, .type-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 16px;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
  cursor: pointer;
}
.kind-card input { position: absolute; opacity: 0; }
.kind-card span, .type-card span { font-size: 13px; color: var(--font-grey); }
.kind-card.is-selected { border-color: var(--soda-red); }
.kind-card.is-locked { cursor: default; }
.kind-card.is-locked:not(.is-selected) { display: none; }
.type-card:hover { border-color: var(--soda-red); }
.type-card.is-off { opacity: 0.6; }
.type-card.add { border-style: dashed; }
.type-cards { margin-bottom: 8px; }

.inventory-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 8px; }
.inventory-row input.narrow { width: 72px; padding: 5px 8px; border: 1px solid var(--line); border-radius: 7px; font: inherit; }

/* ------------------------------------------------------- Published apps */

.diff-row { padding: 10px 0; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; }
.diff-group { display: flex; gap: 8px; align-items: baseline; }
.diff-items { font-size: 13.5px; }
.skipped { margin-top: 12px; font-size: 13.5px; color: var(--font-grey); }
.skipped summary { cursor: pointer; font-weight: 700; }

/* ----------------------------------------------------------------- Toast */

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  padding: 12px 18px;
  border-radius: 8px;
  box-shadow: var(--shadow);
  font-size: 14px;
  max-width: min(640px, calc(100vw - 32px));
  z-index: 10;
}
.toast.is-error { background: #96131a; }

@media (max-width: 720px) {
  .app-header { flex-wrap: wrap; }
  .app-nav { order: 3; justify-content: flex-start; }
  .catalog-row { grid-template-columns: 44px 1fr; }
  .thumb { width: 44px; height: 44px; }
  .row-actions { grid-column: 1 / -1; align-items: flex-start; }
  .row-buttons { justify-content: flex-start; }
  .field-row { grid-template-columns: 1fr; }
  .field-row > .field-help { grid-column: 1; }
}

/* One grid for the extras header and rows, so the size columns line up. */
.extra-grid { display: grid; grid-template-columns: minmax(160px, 1fr) repeat(var(--size-columns, 6), 64px) 84px; gap: 6px; align-items: center; }
.extra-grid.header span { font-size: 12px; font-weight: 700; color: var(--font-grey); }
.extra-grid input.narrow { width: 64px; }
.rows > .field-help { font-size: 12.5px; color: var(--font-grey); }

/* ------------------------------------------------- Load errors, banner history */

.load-error {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  padding: 10px 16px;
  background: #fdecec;
  color: #96131a;
  font-weight: 600;
  border-bottom: 1px solid #f3c4c6;
}

.banner-history .history-items {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}
.banner-history li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
}
.banner-history img {
  width: 120px;
  aspect-ratio: 1.57;
  object-fit: fill;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #f6f7f9;
}

.diff-details { margin: 4px 0 0; padding-left: 18px; }
.diff-details li { margin: 2px 0; }

.customer-row { grid-template-columns: 1fr auto; }
.page-toolbar input[type="tel"] { flex: 0 1 240px; min-width: 0; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; font: inherit; }
.secret {
  margin: 4px 0 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 26px;
  letter-spacing: 0.08em;
  user-select: all;
  overflow-wrap: anywhere;
}
