/* base styles for the pages: colors, header, buttons, cards, scan list and bottom dock */
:root {
  --sky-100: #e8f6fd;
  --sky-200: #cfeefb;
  --sky-300: #b5e3f6;
  --sky-500: #6cc4e8;
  --teal-500: #1aa7b5;
  --teal-600: #0b7a85;
  --orange-500: #ff9f43;
  --orange-600: #e5822a;
  --ink: #23272f;
  --ink-soft: #5b6472;
  --white: #ffffff;
  --amber: #b45309;
  --amber-bg: #fff3d6;
  --red: #c0392b;
  --red-bg: #fde7e7;
  --green: #1f7a4d;
  --green-bg: #e3f6ec;

  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --shadow: 0 8px 22px rgba(35, 39, 47, 0.13);
  --shadow-sm: 0 2px 8px rgba(35, 39, 47, 0.1);

  --font: "Nunito", "Poppins", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

/* page background */
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 16px;
  color: var(--ink);
  background: linear-gradient(180deg, var(--sky-300) 0, var(--sky-100) 280px, #f7fcff 100%) fixed;
}

.app { max-width: 480px; margin: 0 auto; padding: 0 16px 130px; }
h1, h2, h3, p { margin: 0; }
a { color: inherit; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.top {
  position: relative;
  display: flex; align-items: center; gap: 12px;
  padding: 22px 0 14px;
}
.top::before, .top::after {
  content: ""; position: absolute; z-index: 0; pointer-events: none;
  background: rgba(255, 255, 255, 0.85); border-radius: 999px;
}
.top::before { width: 70px; height: 22px; right: 4px; top: 14px; box-shadow: 18px 8px 0 -4px rgba(255,255,255,.85); }
.top::after  { width: 46px; height: 16px; right: 96px; top: 46px; }
.top > * { position: relative; z-index: 1; }
.top .titles h1 { font-size: 1.7rem; font-weight: 800; line-height: 1.1; }
.top .titles p { color: var(--ink-soft); font-weight: 700; margin-top: 2px; }
.mascot { width: 64px; flex: none; animation: bob 2.6s ease-in-out infinite; }
.mascot svg { width: 100%; height: auto; display: block; }
.back {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--white); box-shadow: var(--shadow-sm); flex: none;
}

@keyframes bob { 0%, 100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(-6px) rotate(2deg); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pop { from { transform: scale(.94); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 22px;
  border-radius: 999px; border: 2px solid transparent;
  font: 800 1rem var(--font); text-decoration: none; cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease;
}
.btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; transform: none; box-shadow: none; }
.btn.primary { background: var(--ink); color: var(--white); }
.btn.accent  { background: var(--orange-500); color: var(--ink); }
.btn.ghost   { background: var(--white); color: var(--ink); border-color: var(--ink); }
.btn.danger  { background: var(--red); color: var(--white); }
.btn.wide { width: 100%; }
.btn.small { min-height: 44px; padding: 0 16px; }

:focus-visible { outline: 3px solid var(--teal-600); outline-offset: 2px; }
.btn.primary:focus-visible, .btn.danger:focus-visible { outline-color: var(--orange-500); }

.icon { display: inline-flex; width: 1.4em; height: 1.4em; }
.icon svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 44px; min-height: 44px; border-radius: 50%;
  background: transparent; border: 0; color: var(--ink); cursor: pointer;
}
.icon-btn:hover { background: var(--sky-100); }

/*cards */
.card { background: var(--white); border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: 16px; margin-bottom: 16px; }

.trip-card {
  background: var(--white); border-radius: var(--radius-lg); box-shadow: var(--shadow);
  overflow: hidden; margin-bottom: 18px; transition: transform .15s ease, box-shadow .15s ease;
  animation: pop .25s ease both;
}
.trip-card:hover { transform: translateY(-3px); box-shadow: 0 12px 28px rgba(35, 39, 47, 0.17); }
.scene { height: 120px; }
.scene svg { width: 100%; height: 100%; display: block; }
.trip-info { display: flex; align-items: center; justify-content: space-between; padding: 12px 8px 4px 16px; }
.trip-name { font-size: 1.25rem; font-weight: 800; }
.trip-date { color: var(--ink-soft); font-weight: 700; font-size: .95rem; }
.bag-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 10px 16px 16px; }
.bag-btn {
  position: relative; display: flex; flex-direction: column; gap: 2px;
  min-height: 64px; padding: 10px 14px; border-radius: var(--radius-md);
  background: var(--sky-100); border: 2px solid var(--sky-300); text-decoration: none;
  transition: transform .12s ease, background .12s ease;
}
.bag-btn:hover { background: var(--sky-200); transform: translateY(-2px); }
.bag-label { font-weight: 800; }
.bag-count { color: var(--ink-soft); font-weight: 700; font-size: .9rem; }
.badge {
  position: absolute; top: -8px; right: -6px; min-width: 26px; height: 26px; padding: 0 7px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 999px; font-weight: 800; font-size: .85rem; border: 2px solid var(--white);
}
.badge.warning { background: var(--amber-bg); color: var(--amber); box-shadow: 0 0 0 2px var(--amber); }
.badge.prohibited { background: var(--red-bg); color: var(--red); box-shadow: 0 0 0 2px var(--red); }

/*bag page */
.toggle { display: grid; grid-template-columns: 1fr 1fr; background: var(--white); border-radius: 999px; padding: 5px; box-shadow: var(--shadow-sm); margin-bottom: 16px; }
.toggle button {
  min-height: 46px; border: 0; border-radius: 999px; background: transparent;
  font: 800 1rem var(--font); color: var(--ink-soft); cursor: pointer;
}
.toggle button.active { background: var(--ink); color: var(--white); }

.item-row {
  display: flex; align-items: center; gap: 10px;
  background: var(--white); border-radius: var(--radius-md); box-shadow: var(--shadow-sm);
  padding: 10px 10px 10px 12px; margin-bottom: 10px; animation: pop .2s ease both;
}
.tile {
  width: 46px; height: 46px; flex: none; display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem; background: var(--sky-100); border: 2px solid var(--sky-300); border-radius: 14px;
}
.item-name { flex: 1; min-width: 0; font-weight: 800; overflow-wrap: anywhere; }
.qty { display: inline-flex; align-items: center; gap: 2px; }
.qty button {
  width: 44px; height: 44px; border-radius: 50%; border: 2px solid var(--sky-300);
  background: var(--sky-100); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; color: var(--ink);
}
.qty button:hover { background: var(--sky-200); }
.qty .num { min-width: 24px; text-align: center; font-weight: 800; }
.status-btn { width: 44px; height: 44px; border: 0; background: transparent; border-radius: 50%; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.status-btn:hover { background: var(--sky-100); }
.status-btn.muted svg { opacity: .45; }
.status-spacer { width: 44px; flex: none; }

.empty { text-align: center; padding: 26px 10px; color: var(--ink-soft); font-weight: 700; }
.empty .mascot { margin: 0 auto 10px; animation: none; }

.reminders h2 { font-size: 1.1rem; font-weight: 800; margin-bottom: 8px; }
.rem-list { list-style: none; margin: 0; padding: 0; }
.rem-row { display: flex; align-items: center; gap: 4px; }
.rem-check {
  flex: 1; min-height: 48px; display: flex; align-items: center; gap: 12px; text-align: left;
  background: transparent; border: 0; font: 700 1rem var(--font); color: var(--ink); cursor: pointer; border-radius: var(--radius-sm);
}
.rem-box {
  width: 26px; height: 26px; flex: none; border-radius: 8px; border: 3px solid var(--teal-600);
  display: inline-flex; align-items: center; justify-content: center; background: var(--white); color: var(--white);
}
.rem-box .icon { width: 16px; height: 16px; }
.rem-check[aria-pressed="true"] .rem-box { background: var(--teal-600); }
.rem-check[aria-pressed="true"] .rem-text { text-decoration: line-through; color: var(--ink-soft); }
.add-row { display: flex; gap: 8px; margin-top: 10px; }
.add-row input { flex: 1; }

/* ---------- forms ---------- */
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-weight: 800; margin-bottom: 6px; }
input[type="text"], input[type="date"] {
  width: 100%; min-height: 48px; padding: 0 14px; border-radius: var(--radius-sm);
  border: 2px solid var(--sky-300); background: var(--white); color: var(--ink); font: 700 1rem var(--font);
}
input[type="text"]:focus, input[type="date"]:focus { border-color: var(--teal-600); outline: none; box-shadow: 0 0 0 3px rgba(11, 122, 133, 0.25); }

/* bottom buttons */
.dock {
  position: fixed; left: 50%; bottom: 0; transform: translateX(-50%);
  width: min(480px, 100%); display: flex; gap: 10px; padding: 12px 16px 16px;
  background: linear-gradient(180deg, rgba(247, 252, 255, 0) 0, rgba(247, 252, 255, 0.95) 28%);
  z-index: 5;
}
.dock .btn { flex: 1; }


#toasts { position: fixed; left: 50%; top: 12px; transform: translateX(-50%); width: min(440px, calc(100% - 24px)); z-index: 50; display: grid; gap: 8px; }
.toast { background: var(--ink); color: var(--white); padding: 12px 16px; border-radius: var(--radius-md); box-shadow: var(--shadow); font-weight: 700; animation: pop .2s ease both; }
.toast.error { background: var(--red); }
.toast.good { background: var(--green); }

/*dialogs */
dialog.dlg {
  border: 0; border-radius: var(--radius-lg); padding: 22px 20px 18px; color: var(--ink); font-family: var(--font);
  width: min(420px, calc(100vw - 32px)); max-height: calc(100vh - 32px); overflow: auto; box-shadow: var(--shadow);
}
dialog.dlg::backdrop { background: rgba(35, 39, 47, 0.55); }
dialog.dlg h2 { font-size: 1.3rem; font-weight: 800; margin-bottom: 10px; }
.dlg-body { margin-bottom: 16px; line-height: 1.45; font-weight: 600; }
.dlg-body .fine { display: block; margin-top: 10px; color: var(--ink-soft); font-size: .85rem; }
.dlg-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; }
.dlg-actions .btn { flex: 1 1 120px; }
.dlg-mascot { width: 84px; margin: 0 auto 8px; }
.dlg-mascot svg { width: 100%; display: block; }
.rem-edit-row { display: flex; gap: 6px; align-items: center; margin-bottom: 8px; }
.rem-edit-row input { flex: 1; }
.missing-list { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 8px; }
.missing-list li { display: flex; gap: 10px; align-items: flex-start; background: var(--amber-bg); border-radius: var(--radius-sm); padding: 10px 12px; font-weight: 700; }
.missing-list li.bad { background: var(--red-bg); }
.missing-list li.note { background: var(--sky-100); }

/*scan page */
.photo-box { text-align: center; }
#photo:focus-visible ~ .photo-btns #choose-label { outline: 3px solid var(--teal-600); outline-offset: 2px; }
.photo-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cam-video { display: block; width: 100%; max-height: 60vh; border-radius: var(--radius-md); background: #000; }
.preview { display: block; max-width: 100%; max-height: 260px; margin: 14px auto 0; border-radius: var(--radius-md); box-shadow: var(--shadow-sm); }
.hint { color: var(--ink-soft); font-weight: 700; text-align: center; margin: 10px 0; min-height: 1.2em; }
.spinner { width: 20px; height: 20px; border-radius: 50%; border: 3px solid rgba(255,255,255,.4); border-top-color: var(--white); animation: spin .8s linear infinite; }

.detected { display: flex; gap: 12px; align-items: flex-start; background: var(--white); border-radius: var(--radius-md); box-shadow: var(--shadow-sm); padding: 12px; margin-bottom: 10px; border-left: 8px solid var(--green); animation: pop .2s ease both; }
.detected.warning { border-left-color: var(--amber); }
.detected.prohibited { border-left-color: var(--red); background: var(--red-bg); }
.detected .body { flex: 1; min-width: 0; }
.detected h3 { font-size: 1.05rem; font-weight: 800; overflow-wrap: anywhere; }
.detected .note { margin: 4px 0 8px; font-weight: 600; line-height: 1.4; }
.detected .fine { color: var(--ink-soft); font-size: .8rem; font-weight: 700; }
.detected .row-btns { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.chip { display: inline-block; padding: 3px 10px; border-radius: 999px; font-weight: 800; font-size: .8rem; margin-top: 4px; }
.chip.allowed { background: var(--green-bg); color: var(--green); }
.chip.warning { background: var(--amber-bg); color: var(--amber); }
.chip.prohibited { background: var(--red); color: var(--white); }

@media (max-width: 380px) {
  .top .titles h1 { font-size: 1.45rem; }
  .mascot { width: 52px; }
  .btn { padding: 0 16px; }
}
/* tagline under the home title */
.tagline { text-align: center; font-weight: 800; color: var(--ink-soft); margin: 4px 0 14px; }

/* several bags: odd one out spans the full row, toggle wraps */
.bag-buttons > :last-child:nth-child(odd) { grid-column: 1 / -1; }
.toggle { display: flex; flex-wrap: wrap; }
.toggle button { flex: 1 1 40%; }

/* how many bags number boxes */
.check-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-weight: 700; margin-bottom: 6px; }
.check-row input { width: 80px; min-height: 44px; padding: 0 10px; border-radius: var(--radius-sm); border: 2px solid var(--sky-300); background: var(--white); color: var(--ink); font: 700 1rem var(--font); }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
