/* =========================================================
   CAFE — css/pages.css
   Load AFTER css/style.css (on every page, including index.html).
   Uses the same colours, fonts and radius as style.css.
========================================================= */

[hidden] { display: none !important; }

a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}


/* =========================================================
   FIXES FOR EXISTING HOMEPAGE PARTS
========================================================= */

/* product card: clickable image + name */
.product-image-link { position: absolute; inset: 0; z-index: 1; }
.product-favorite { z-index: 2; }
.product-name a { transition: color var(--ease); }
.product-name a:hover { color: var(--accent); }

/* floating cart: quantity controls */
.homepage-cart-quantity { display: flex; align-items: center; gap: 6px; margin-top: 5px; }
.homepage-cart-quantity button {
  width: 18px; height: 18px; padding: 0; border: 0; border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(255,255,255,.22); color: #fff; font-size: 12px; line-height: 1;
}
.homepage-cart-quantity button:hover { background: rgba(255,255,255,.34); }
.homepage-cart-quantity span { min-width: 10px; text-align: center; font-size: 9px; font-weight: 700; }
.homepage-cart-right { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.homepage-cart-remove {
  padding: 0; border: 0; background: transparent; color: #fff;
  font-size: 16px; line-height: 1; opacity: .7;
}
.homepage-cart-remove:hover { opacity: 1; }
.empty-cart-message { padding: 14px 6px; text-align: center; font-size: 10px; }
.empty-cart-message p { margin: 0; }
.empty-cart-message a { display: inline-block; margin-top: 6px; font-weight: 700; text-decoration: underline; }

/* search results */
.result-item { display: flex; justify-content: space-between; gap: 12px; }
.result-item strong { color: #222; }

/* toast: bottom-left so it never covers the cart button */
.toast { right: auto; left: 22px; }


/* =========================================================
   SHARED PIECES
========================================================= */

.btn-primary { border: 0; }
.btn-ghost { border: 1px solid #bbb; color: var(--coffee); background: #fff; }
.btn-ghost:hover { border-color: var(--coffee); background: var(--light); }
.btn-block { width: 100%; }
.btn-block + .btn-block { margin-top: 10px; }
.btn:disabled { opacity: .6; cursor: not-allowed; transform: none; }

.page-hero { background: linear-gradient(90deg, #1a0b04, #4a210f); color: #fff; padding: 44px 0; }
.page-hero h1 {
  font-family: "Playfair Display", Georgia, serif;
  font-size: clamp(28px, 4vw, 40px); line-height: 1.12; letter-spacing: -.025em; margin: 10px 0 8px;
}
.page-hero p { margin: 0; color: #d4c1b4; font-size: 13px; }

.page-section { padding: 52px 0 82px; }
.page-section.light { background: var(--light); }

.empty-state { max-width: 420px; margin: 0 auto; padding: 64px 20px; text-align: center; }
.empty-icon { font-size: 38px; margin-bottom: 12px; }
.empty-state h2 { font-family: "Playfair Display", Georgia, serif; font-size: 26px; margin: 0 0 8px; }
.empty-state p { margin: 0 0 22px; color: var(--muted); font-size: 13px; line-height: 1.6; }

.loading { text-align: center; color: var(--muted); font-size: 13px; padding: 60px 0; }

.qty-stepper {
  display: inline-flex; align-items: center; overflow: hidden;
  border: 1px solid var(--border); border-radius: 5px; background: #fff;
}
.qty-stepper button { width: 38px; height: 44px; border: 0; background: transparent; font-size: 18px; color: #444; }
.qty-stepper button:hover:not(:disabled) { background: var(--light); }
.qty-stepper button:disabled { opacity: .35; cursor: not-allowed; }
.qty-stepper span { min-width: 32px; text-align: center; font-size: 14px; font-weight: 700; }

.summary-card {
  position: sticky; top: 20px; padding: 22px;
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
}
.summary-card h2 { font-family: "Playfair Display", Georgia, serif; font-size: 22px; margin: 0 0 14px; }
.summary-line { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; font-size: 13px; color: #555; }
.summary-line.total {
  margin-top: 8px; padding-top: 14px; border-top: 1px solid #eee;
  font-size: 16px; font-weight: 700; color: var(--text);
}
.progress { height: 6px; margin: 12px 0 6px; overflow: hidden; border-radius: 6px; background: #eee; }
.progress i { display: block; height: 100%; border-radius: 6px; background: var(--gold); transition: width .3s ease; }
.progress-note { margin: 0 0 6px; font-size: 11px; line-height: 1.5; color: var(--muted); }
.summary-card .btn { margin-top: 16px; }
.summary-card .btn + .btn { margin-top: 10px; }


/* =========================================================
   MENU PAGE
========================================================= */

.catalog-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 22px; }
.filter-bar { display: flex; flex-wrap: wrap; gap: 8px; }
.filter-chip {
  padding: 8px 16px; border: 1px solid var(--border); border-radius: 30px;
  background: #fff; color: #444; font-size: 12px; font-weight: 600;
  transition: all var(--ease);
}
.filter-chip:hover { border-color: var(--coffee); color: var(--coffee); }
.filter-chip.active { background: var(--dark-brown); border-color: var(--dark-brown); color: #fff; }
.menu-search {
  width: 240px; max-width: 100%; height: 40px; padding: 0 12px;
  border: 1px solid #ccc; border-radius: 5px; font-size: 12px; outline: none;
}
.menu-search:focus { border-color: var(--accent); }
.result-count { margin: 0 0 16px; font-size: 12px; color: var(--muted); }


/* =========================================================
   PRODUCT DETAILS
========================================================= */

.crumbs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 26px; font-size: 11px; color: #999; }
.crumbs a:hover { color: var(--accent); }
.crumbs b { color: #333; font-weight: 600; }

.details-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; align-items: start; }
.details-media {
  aspect-ratio: 1 / 1; border-radius: 12px; box-shadow: var(--shadow);
  background: #eee center / cover no-repeat;
}
.details-info h1 {
  font-family: "Playfair Display", Georgia, serif;
  font-size: clamp(28px, 4vw, 38px); line-height: 1.12; letter-spacing: -.025em; margin: 10px 0 12px;
}
.details-info .rating-row { margin-bottom: 16px; font-size: 12px; }
.details-price { display: flex; align-items: baseline; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.details-price strong { font-size: 28px; }
.details-price s { font-size: 15px; color: #aaa; }
.details-price em {
  padding: 4px 9px; border-radius: 20px; background: #e8f2e3;
  font-size: 11px; font-style: normal; font-weight: 700; color: #3f6f2f;
}
.details-desc { max-width: 52ch; margin: 0 0 18px; font-size: 14px; line-height: 1.75; color: #555; }
.details-points { display: grid; gap: 9px; margin: 0 0 26px; padding: 0; list-style: none; font-size: 13px; color: #444; }
.details-points li { display: flex; align-items: center; gap: 10px; }
.details-points li::before {
  content: "✓"; flex: 0 0 20px; width: 20px; height: 20px; display: grid; place-items: center;
  border-radius: 50%; background: #f1e6dc; color: var(--coffee); font-size: 11px; font-weight: 700;
}
.details-buy { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 12px; }
.details-add { flex: 1; min-width: 190px; }
.details-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.related { margin-top: 76px; }


/* =========================================================
   CART PAGE
========================================================= */

.cart-layout,
.checkout-layout { display: grid; gap: 28px; align-items: start; }
.cart-layout { grid-template-columns: 1fr 340px; }
.checkout-layout { grid-template-columns: 1fr 380px; }

.cart-list { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.cart-row { display: grid; grid-template-columns: 84px 1fr auto; align-items: center; gap: 16px; padding: 16px; border-bottom: 1px solid #eee; }
.cart-row:last-child { border-bottom: 0; }
.cart-row-image { display: block; width: 84px; height: 84px; border-radius: 8px; background: #eee center / cover no-repeat; }
.cart-row-info h3 { margin: 0 0 5px; font-size: 14px; }
.cart-row-info h3 a:hover { color: var(--accent); }
.cart-row-info .unit { font-size: 12px; color: var(--muted); }
.cart-row-controls { display: flex; align-items: center; gap: 18px; }
.cart-row-total { min-width: 64px; text-align: right; font-size: 14px; }
.cart-remove { padding: 0; border: 0; background: none; color: #999; font-size: 12px; text-decoration: underline; }
.cart-remove:hover { color: #c0392b; }
.clear-cart { display: block; margin: 18px auto 0; }


/* =========================================================
   CHECKOUT
========================================================= */

.form-card { padding: 26px; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.form-section + .form-section { margin-top: 28px; padding-top: 24px; border-top: 1px solid #eee; }
.form-section h2 { font-family: "Playfair Display", Georgia, serif; font-size: 22px; margin: 0 0 16px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-field { display: flex; flex-direction: column; gap: 6px; }
.form-field.full { grid-column: 1 / -1; }
.form-field label { font-size: 12px; font-weight: 600; color: #333; }
.form-field label small { font-weight: 400; color: #999; }
.form-field input,
.form-field textarea {
  width: 100%; height: 46px; padding: 0 12px; outline: none; background: #fff;
  border: 1px solid #ccc; border-radius: 5px; font-size: 13px; font-family: inherit;
}
.form-field textarea { height: auto; min-height: 84px; padding: 12px; resize: vertical; }
.form-field input:focus,
.form-field textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(154, 78, 28, .12); }
.form-field.invalid input,
.form-field.invalid textarea { border-color: #c0392b; }
.field-error { font-size: 11px; color: #c0392b; }
.field-error:empty { display: none; }

.choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.choice {
  display: flex; align-items: flex-start; gap: 12px; padding: 14px;
  border: 1px solid var(--border); border-radius: 8px; cursor: pointer; transition: all var(--ease);
}
.choice input { margin-top: 3px; accent-color: var(--accent); }
.choice strong { display: block; font-size: 13px; }
.choice small { display: block; margin-top: 3px; font-size: 11px; line-height: 1.45; color: #888; }
.choice:has(input:checked),
.choice.static { border-color: var(--accent); background: #fbf5f0; cursor: default; }
.choice.static::before {
  content: "✓"; flex: 0 0 20px; width: 20px; height: 20px; display: grid; place-items: center;
  border-radius: 50%; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700;
}

.summary-items { margin-bottom: 4px; }
.summary-item { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid #f0f0f0; font-size: 13px; }
.summary-thumb { position: relative; flex: 0 0 52px; width: 52px; height: 52px; }
.summary-thumb i { display: block; width: 52px; height: 52px; border-radius: 8px; background: #eee center / cover no-repeat; }
.summary-thumb b {
  position: absolute; top: -6px; right: -6px; min-width: 18px; height: 18px; padding: 0 4px;
  display: grid; place-items: center; border-radius: 9px; background: var(--coffee); color: #fff; font-size: 10px;
}
.summary-item-name { flex: 1; font-weight: 600; }
.summary-note { margin: 14px 0 0; font-size: 11px; line-height: 1.5; color: var(--muted); text-align: center; }


/* =========================================================
   ORDER SUCCESS
========================================================= */

.success-card {
  max-width: 640px; margin: 0 auto; padding: 36px 30px; text-align: center;
  background: #fff; border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow);
}
.success-mark {
  width: 60px; height: 60px; margin: 0 auto 16px; display: grid; place-items: center;
  border-radius: 50%; background: #e8f2e3; color: #3f6f2f; font-size: 28px;
}
.success-card h1 { font-family: "Playfair Display", Georgia, serif; font-size: 30px; margin: 0 0 6px; }
.success-text { margin: 0; color: var(--muted); font-size: 13px; }
.order-number {
  display: inline-block; margin: 18px 0 22px; padding: 8px 14px;
  border: 1px dashed #cdbfb3; border-radius: 6px; background: var(--light);
  font-size: 13px; font-weight: 700; letter-spacing: .04em;
}
.success-card .summary-items { text-align: left; }
.order-details { display: grid; gap: 18px; margin-top: 22px; padding-top: 18px; border-top: 1px solid #eee; text-align: left; }
.order-details h3 { margin: 0 0 6px; font-size: 12px; font-weight: 600; color: var(--muted); }
.order-details p { margin: 0; font-size: 13px; line-height: 1.6; color: #333; }
.success-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 26px; }


/* =========================================================
   RESPONSIVE
========================================================= */

@media (max-width: 900px) {
  .details-layout { gap: 30px; }
  .cart-layout,
  .checkout-layout { grid-template-columns: 1fr; }
  .summary-card { position: static; }
}

@media (max-width: 700px) {
  .toast { left: 14px; right: 14px; bottom: 82px; text-align: center; }

  .page-hero { padding: 32px 0; }
  .page-section { padding: 34px 0 60px; }

  .details-layout { grid-template-columns: 1fr; }
  .related { margin-top: 56px; }

  .cart-row { grid-template-columns: 64px 1fr; gap: 12px; padding: 14px; }
  .cart-row-image { width: 64px; height: 64px; }
  .cart-row-controls { grid-column: 1 / -1; justify-content: space-between; gap: 10px; }

  .form-card { padding: 20px 16px; }
  .form-grid,
  .choice-grid { grid-template-columns: 1fr; }

  .success-card { padding: 28px 18px; }
  .homepage-cart-quantity button { width: 22px; height: 22px; }
}
