/* ── Order Page — Cafe Hidden Garden ───────────────────────────────────── */
/* Mobile-first: scanned from table QR codes */

:root {
  --paper: #F4F2EC;
  --roast: #1B1512;
  --roast-med: #4A4038;
  --parchment: #968878;
  --green: #3C6E55;
  --green-light: #4E8A6B;
  --cherry: #C44D34;
  --cherry-bg: rgba(196, 77, 52, 0.06);
  --crema: #EAE5DD;
  --white: #FFFFFF;
  --rule: #D9D2C7;
  --rule-light: #EBE7E0;
  --font-display: 'Newsreader', Georgia, serif;
  --font-body: 'Figtree', sans-serif;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

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

html {
  background: var(--paper);
  color: var(--roast);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
  max-width: 800px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
}

::selection { background: rgba(60, 110, 85, 0.12); }

/* ── Header ─────────────────────────────────────────────────────────── */
.ord-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(244, 242, 236, 0.94);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--rule);
}

.ord-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  height: 52px;
  gap: 12px;
}

.ord-logo {
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--green);
  text-decoration: none;
  letter-spacing: -0.01em;
}

.ord-table {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.ord-table-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--parchment);
}

.ord-table-num {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--roast);
}

.ord-cart-badge {
  display: flex;
  align-items: center;
  gap: 5px;
  background: var(--roast);
  color: var(--paper);
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}

.ord-cart-badge svg { color: var(--paper); }

/* ── Main Layout ────────────────────────────────────────────────────── */
.ord-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 20px 16px 100px;
}

/* ── Section Title ──────────────────────────────────────────────────── */
.ord-section-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--roast);
  margin-bottom: 16px;
  letter-spacing: -0.01em;
}

/* ── Filters ────────────────────────────────────────────────────────── */
.ord-filter {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.ord-filter-btn {
  padding: 6px 14px;
  border: 1px solid var(--rule);
  background: var(--white);
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--roast-med);
  cursor: pointer;
  transition: all 0.15s var(--ease);
}

.ord-filter-btn:hover { border-color: var(--roast-med); color: var(--roast); }
.ord-filter-btn.active {
  background: var(--roast);
  color: var(--paper);
  border-color: var(--roast);
}

/* ── Live Orders ────────────────────────────────────────────────────── */
.ord-live {
  margin-bottom: 8px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--rule);
}

.ord-live-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.live-order {
  background: var(--paper);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--green);
  padding: 12px 14px;
  animation: liveOrderIn 0.3s var(--ease);
}

.live-order.served {
  border-left-color: var(--parchment);
}

@keyframes liveOrderIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.live-order-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.live-order-status {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.live-order-status.pending { color: var(--green); }
.live-order-status.served { color: var(--parchment); }

.live-order-items {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 0.8rem;
  color: var(--roast);
}

.live-order-items li {
  display: flex;
  justify-content: space-between;
}

.live-order-items .lo-custom {
  font-style: italic;
  color: var(--parchment);
}

.live-order-note {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--rule-light);
  font-size: 0.72rem;
  color: var(--parchment);
  font-style: italic;
}

.live-order-total {
  margin-top: 6px;
  text-align: right;
  font-weight: 700;
  font-size: 0.82rem;
  color: var(--roast-med);
}

/* ── Menu Items ─────────────────────────────────────────────────────── */
.ord-items {
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: var(--rule);
  border: 1px solid var(--rule);
}

.ord-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--white);
  cursor: pointer;
  transition: background 0.12s;
  user-select: none;
}

.ord-item:active { background: var(--paper); }
.ord-item.sold-out { opacity: 0.45; cursor: default; }

.ord-item-img {
  width: 48px;
  height: 48px;
  border-radius: 6px;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--crema);
  position: relative;
}

.ord-item-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  inset: 0;
  z-index: 1;
}

.ord-item-img svg {
  width: 22px;
  height: 22px;
  color: var(--parchment);
  position: absolute;
  inset: 0;
  margin: auto;
  z-index: 0;
  opacity: 0.6;
}

.ord-item-info {
  flex: 1;
  min-width: 0;
}

.ord-item-name {
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--roast);
}

.ord-item-desc {
  font-size: 0.72rem;
  color: var(--parchment);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ord-item-price {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--roast-med);
  flex-shrink: 0;
}

.ord-item-add {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1.5px solid var(--green);
  background: transparent;
  color: var(--green);
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s;
}

.ord-item-add:active { background: var(--green); color: var(--white); }
.ord-item.sold-out .ord-item-add { border-color: var(--rule); color: var(--rule); cursor: default; }

/* ── Cart ───────────────────────────────────────────────────────────── */
.ord-cart {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-width: 800px;
  margin: 0 auto;
  background: var(--white);
  border-top: 1px solid var(--rule);
  z-index: 40;
  max-height: 50vh;
  overflow-y: auto;
  box-shadow: 0 -4px 24px rgba(27, 21, 18, 0.08);
  transition: max-height 0.25s var(--ease);
}

.ord-cart.collapsed {
  max-height: 56px;
  overflow: hidden;
}

.ord-cart-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px 10px;
  cursor: pointer;
}

.ord-cart-head h2 {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  color: var(--roast);
  letter-spacing: -0.01em;
}

.ord-cart-total {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--green);
}

.ord-cart-items {
  padding: 0 18px 8px;
  max-height: 200px;
  overflow-y: auto;
}

.ord-cart-empty {
  font-size: 0.78rem;
  color: var(--parchment);
  padding: 8px 0;
  text-align: center;
}

.cart-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--rule-light);
  gap: 8px;
}

.cart-item:last-child { border-bottom: none; }

.cart-item-info {
  flex: 1;
  min-width: 0;
}

.cart-item-name {
  font-weight: 600;
  font-size: 0.82rem;
  color: var(--roast);
}

.cart-item-meta {
  font-size: 0.68rem;
  color: var(--parchment);
}

.cart-item-qty {
  display: flex;
  align-items: center;
  gap: 4px;
}

.cart-qty-btn {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid var(--rule);
  background: var(--white);
  font-size: 0.85rem;
  color: var(--roast-med);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.cart-qty-btn:active { background: var(--paper); }

.cart-qty-num {
  width: 26px;
  text-align: center;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--roast);
}

.cart-item-price {
  font-weight: 600;
  font-size: 0.82rem;
  color: var(--roast-med);
  min-width: 48px;
  text-align: right;
}

.cart-item-remove {
  width: 24px;
  height: 24px;
  border: none;
  background: none;
  color: var(--cherry);
  cursor: pointer;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.5;
}

.cart-item-remove:hover { opacity: 1; }

.cart-item-custom {
  font-style: italic;
  color: var(--roast-med);
}

/* ── Cart Note ──────────────────────────────────────────────────────── */
.ord-cart-note {
  padding: 0 18px 10px;
}

.ord-cart-note label {
  display: block;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--parchment);
  margin-bottom: 4px;
}

.ord-cart-note textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--rule);
  font-family: var(--font-body);
  font-size: 0.8rem;
  color: var(--roast);
  background: var(--paper);
  resize: none;
  transition: border-color 0.2s;
}

.ord-cart-note textarea:focus {
  outline: none;
  border-color: var(--green);
}

/* ── Table Select (when no table param) ─────────────────────────────── */
.ord-cart-table-row {
  padding: 0 18px 10px;
}

.ord-cart-table-row label {
  display: block;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--parchment);
  margin-bottom: 4px;
}

.ord-cart-table-row select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--rule);
  font-family: var(--font-body);
  font-size: 0.82rem;
  color: var(--roast);
  background: var(--paper);
  transition: border-color 0.2s;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' fill='none'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23968878' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
}

.ord-cart-table-row select:focus {
  outline: none;
  border-color: var(--green);
}

/* ── Submit Button ──────────────────────────────────────────────────── */
.ord-submit {
  display: block;
  width: calc(100% - 36px);
  margin: 8px 18px 18px;
  padding: 14px;
  background: var(--roast);
  color: var(--paper);
  border: none;
  border-radius: 6px;
  font-family: var(--font-body);
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  letter-spacing: 0.02em;
}

.ord-submit:hover { background: var(--green); }
.ord-submit:active { transform: scale(0.98); }
.ord-submit:disabled {
  background: var(--rule);
  color: var(--parchment);
  cursor: not-allowed;
}

/* ── Toast ──────────────────────────────────────────────────────────── */
.ord-toast {
  position: fixed;
  top: 60px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s var(--ease);
}

.ord-toast.show {
  opacity: 1;
  pointer-events: auto;
}

.ord-toast-inner {
  background: var(--roast);
  color: var(--paper);
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  text-align: center;
  box-shadow: 0 4px 16px rgba(27, 21, 18, 0.15);
}

/* ── Success State ──────────────────────────────────────────────────── */
.ord-success {
  text-align: center;
  padding: 60px 20px;
}

.ord-success-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 20px;
  background: var(--green);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--white);
}

.ord-success h2 {
  font-family: var(--font-display);
  font-size: 1.4rem;
  color: var(--roast);
  margin-bottom: 8px;
}

.ord-success p {
  color: var(--roast-med);
  font-size: 0.88rem;
  margin-bottom: 24px;
}

/* ── Reduced Motion ─────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ── Desktop (wider than 500px) ─────────────────────────────────────── */
@media (min-width: 500px) {
  .ord-main {
    flex-direction: row;
    gap: 24px;
    padding: 24px 20px 120px;
  }

  .ord-menu { flex: 1; }
  .ord-cart {
    position: sticky;
    bottom: auto;
    top: 72px;
    width: 300px;
    flex-shrink: 0;
    border: 1px solid var(--rule);
    border-top: 1px solid var(--rule);
    box-shadow: none;
    align-self: flex-start;
    max-height: calc(100vh - 100px);
  }
}
