/* ===========================================================
   AONE BAZAAR — DESIGN SYSTEM
   Palette grounded in the bazaar itself: fresh-produce green,
   marigold-garland amber, and night-market indigo. The ribbon
   banner from the shop's own badge logo is reused everywhere
   as the signature shape (card headers, eyebrows, badges).
=========================================================== */

:root {
  /* ---- Color: brand ---- */
  --green-900: #0f4a2b;
  --green-700: #1e7a46;
  --green-600: #269257;
  --green-100: #e4f3ea;

  --marigold-700: #c9701a;
  --marigold-600: #f0932b;
  --marigold-400: #ffb85c;
  --marigold-100: #fdecd6;

  --indigo-900: #12203a;
  --indigo-800: #16233d;
  --indigo-700: #223757;

  --danger-600: #d64545;
  --danger-100: #fbe4e4;

  /* ---- Color: neutrals ---- */
  --paper: #fbf9f4;
  --surface: #ffffff;
  --surface-sunken: #f3efe4;
  --line: #e7e0cf;
  --line-strong: #d8cfb6;
  --ink: #1c1b18;
  --ink-soft: #5b584f;
  --ink-faint: #8b8778;

  /* ---- Type ---- */
  --font-display: "Fraunces", "Georgia", serif;
  --font-body: "Poppins", "Segoe UI", sans-serif;

  /* ---- Radius / shadow ---- */
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;
  --shadow-sm: 0 1px 2px rgba(28, 27, 24, 0.06), 0 1px 1px rgba(28, 27, 24, 0.04);
  --shadow-md: 0 8px 24px rgba(28, 27, 24, 0.10);
  --shadow-lg: 0 20px 48px rgba(18, 32, 58, 0.18);

  /* ---- Motion ---- */
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --fast: 160ms;
  --med: 280ms;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  overflow-x: hidden;
  width: 100%;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--paper);
  color: var(--ink);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  max-width: 100vw;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  color: var(--ink);
  margin: 0 0 0.4em;
  line-height: 1.15;
  font-weight: 600;
}

p {
  margin: 0 0 1em;
  color: var(--ink-soft);
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
  cursor: pointer;
}

input, textarea, select {
  font-family: inherit;
  font-size: 1rem;
}

.hidden {
  display: none !important;
}

/* Visible keyboard focus for links & buttons — inputs/selects/
   textareas get their own green focus ring defined further below,
   so they're excluded here to avoid a doubled-up outline. */
a:focus-visible,
button:focus-visible {
  outline: 3px solid var(--marigold-600);
  outline-offset: 2px;
  border-radius: 4px;
}

.container {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 20px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--green-700);
}

.eyebrow::before {
  content: "";
  width: 18px;
  height: 2px;
  background: var(--marigold-600);
  display: inline-block;
}

/* ---- Ribbon banner: the shop badge's signature shape,
   reused as a section/card header device ---- */
.ribbon {
  position: relative;
  display: inline-block;
  padding: 9px 26px;
  font-family: var(--font-display);
  font-weight: 600;
  color: #fff;
  background: var(--green-700);
  clip-path: polygon(0% 0%, 100% 0%, 92% 50%, 100% 100%, 0% 100%, 8% 50%);
}

.ribbon--amber { background: var(--marigold-600); }
.ribbon--indigo { background: var(--indigo-800); }

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: 999px;
  border: 1.5px solid transparent;
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: transform var(--fast) var(--ease), box-shadow var(--fast) var(--ease), background var(--fast) var(--ease), border-color var(--fast) var(--ease), color var(--fast) var(--ease);
  white-space: nowrap;
}

.btn:active { transform: translateY(1px) scale(0.99); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; box-shadow: none; }

.btn-primary {
  background: var(--green-700);
  color: #fff;
  box-shadow: 0 1px 2px rgba(15, 74, 43, 0.15), 0 4px 10px rgba(15, 74, 43, 0.12);
}
.btn-primary:hover { background: var(--green-900); box-shadow: 0 2px 6px rgba(15, 74, 43, 0.2), 0 10px 22px rgba(15, 74, 43, 0.18); transform: translateY(-1px); }

.btn-accent {
  background: var(--marigold-600);
  color: var(--indigo-900);
  box-shadow: 0 1px 2px rgba(201, 112, 26, 0.18), 0 4px 10px rgba(201, 112, 26, 0.14);
}
.btn-accent:hover { background: var(--marigold-700); color: #fff; box-shadow: 0 2px 6px rgba(201, 112, 26, 0.22), 0 10px 22px rgba(201, 112, 26, 0.18); transform: translateY(-1px); }

.btn-outline {
  background: var(--surface);
  color: var(--green-700);
  border-color: var(--green-700);
}
.btn-outline:hover { background: var(--green-100); box-shadow: 0 2px 8px rgba(15, 74, 43, 0.1); }

.btn-ghost {
  background: transparent;
  color: var(--ink);
  border-color: transparent;
}
.btn-ghost:hover { background: var(--surface-sunken); }

.btn-sm { padding: 8px 16px; font-size: 0.85rem; }
.btn-block { width: 100%; }

/* ---- Text inputs, textareas & selects (shared everywhere) ---- */
input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="submit"]):not([type="button"]):not([type="range"]),
textarea,
select {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  padding: 11px 16px;
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font-size: 0.92rem;
  resize: none;
  line-height: 1.4;
  transition: border-color var(--fast) var(--ease), box-shadow var(--fast) var(--ease);
}

input::placeholder, textarea::placeholder { color: var(--ink-faint); }

input:hover, textarea:hover, select:hover { border-color: #b9ae8c; }

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--green-700);
  box-shadow: 0 0 0 3.5px rgba(30, 122, 70, 0.13);
}

input:disabled, select:disabled, textarea:disabled {
  background: var(--surface-sunken);
  color: var(--ink-faint);
  cursor: not-allowed;
}

/* File inputs render their own native "Choose File" button + filename
   text, which isn't covered by the width:100% rule above — without
   this, they can overflow narrow mobile containers since the browser
   doesn't shrink that native text on its own. */
input[type="file"] {
  max-width: 100%;
  box-sizing: border-box;
}

select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  cursor: pointer;
  padding-right: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%235b584f' stroke-width='2'%3E%3Cpath d='M5 7.5L10 12.5L15 7.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 15px;
}

/* Fully-rounded "pill" variant — used for search bars and quick
   filter dropdowns, distinct from the standard boxier form inputs. */
.input-pill, select.input-pill {
  border-radius: 999px;
  padding-left: 20px;
  padding-right: 20px;
}
select.input-pill { padding-right: 42px; }

/* ---------------- TOAST NOTIFICATIONS ---------------- */
.toast-container {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(360px, calc(100vw - 32px));
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--ink);
  color: #fff;
  border-radius: var(--radius-md);
  padding: 13px 14px;
  box-shadow: var(--shadow-lg);
  font-size: 0.88rem;
  line-height: 1.4;
  animation: toast-in 220ms var(--ease);
}

.toast.toast-hide {
  animation: toast-out 200ms var(--ease) forwards;
}

.toast-success { background: var(--green-900); }
.toast-error { background: var(--danger-600); }

.toast-icon {
  flex-shrink: 0;
  font-weight: 700;
  margin-top: 1px;
}

.toast-message {
  flex: 1;
  word-break: break-word;
}

.toast-close {
  flex-shrink: 0;
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.8);
  font-size: 1.1rem;
  line-height: 1;
  padding: 0;
  cursor: pointer;
}
.toast-close:hover { color: #fff; }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(-12px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes toast-out {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(-8px); }
}

/* ---------------- CUSTOM CONFIRM / PROMPT DIALOG ---------------- */
.custom-dialog-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgba(18, 32, 58, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: dialog-fade-in 160ms ease;
}

.custom-dialog {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 24px;
  width: 100%;
  max-width: 380px;
  animation: dialog-pop-in 160ms ease;
}

.custom-dialog-message {
  font-size: 0.98rem;
  color: var(--ink);
  line-height: 1.5;
  margin: 0 0 16px;
  white-space: pre-line;
}

.custom-dialog-input {
  width: 100%;
  margin-bottom: 16px;
}

.custom-dialog-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.custom-dialog-actions button {
  padding: 10px 20px;
  border-radius: 999px;
  border: 1.5px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all var(--fast) var(--ease);
}

.custom-dialog-cancel:hover { background: var(--surface-sunken); }

.custom-dialog-ok {
  background: var(--green-700);
  border-color: var(--green-700);
  color: #fff;
}
.custom-dialog-ok:hover { background: var(--green-900); }

.custom-dialog-ok.danger {
  background: var(--danger-600);
  border-color: var(--danger-600);
}
.custom-dialog-ok.danger:hover { background: #b32e2e; }

@keyframes dialog-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes dialog-pop-in {
  from { opacity: 0; transform: scale(0.94) translateY(6px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}