/* ==========================================================================
   Maco Paper — Reusable components
   ========================================================================== */

/* ---------------------------- Section headers (shared across pages) ---------------------------- */
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--space-4); margin-bottom: var(--space-6); flex-wrap: wrap; }
.section-head h2 { margin-top: var(--space-2); }

/* ---------------------------- Product card ---------------------------- */
.product-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: var(--space-4);
}
@media (max-width: 1240px) { .product-grid { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 980px) { .product-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 700px) { .product-grid { grid-template-columns: repeat(2, 1fr); gap: var(--space-3); } }

.product-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--paper-000);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  transition: box-shadow var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out);
}
.product-card:hover { box-shadow: var(--shadow-md); border-color: var(--teal-400); }
.product-card .card-media {
  position: relative;
  aspect-ratio: 1 / 1;
  background: var(--paper-000);
  overflow: hidden;
}
.product-card .card-media img {
  width: 100%; height: 100%;
  object-fit: contain;
  padding: var(--space-3);
  transition: transform var(--dur-med) var(--ease-out);
}
.product-card:hover .card-media img { transform: scale(1.04); }
.product-card .card-badges { position: absolute; top: 8px; left: 8px; display: flex; flex-direction: column; gap: 4px; z-index: 1; }
.product-card .card-badges .badge--sale {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--coral-600);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.72rem;
  padding: 0;
}
.product-card .card-quick {
  position: absolute;
  right: 8px; top: 8px;
  display: flex; flex-direction: column; gap: 6px;
  opacity: 0;
  transition: opacity var(--dur-fast) var(--ease-out);
}
.product-card:hover .card-quick, .product-card:focus-within .card-quick { opacity: 1; }
.product-card .card-quick button {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--paper-000);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  display: flex; align-items: center; justify-content: center;
}
.product-card .card-quick button:hover { background: var(--teal-900); border-color: var(--teal-900); }
.product-card .card-quick button:hover svg { stroke: #fff; }
.product-card .card-quick svg { width: 16px; height: 16px; stroke: var(--teal-900); }

.card-body { padding: 0.7rem 0.85rem 0.9rem; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.card-cat { font-size: 0.66rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-300); font-weight: 700; }
.card-title {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 0.85rem;
  line-height: 1.35;
  color: var(--ink-900);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.3em;
}
.card-title a::after { content: ''; position: absolute; inset: 0; }
.card-price { display: flex; align-items: baseline; gap: 0.45em; margin-top: auto; padding-top: 6px; flex-wrap: wrap; }
.card-price .price-now { font-family: var(--font-body); font-weight: 700; font-size: 1rem; color: var(--teal-900); }
.card-price .price-old { font-size: 0.76rem; color: var(--ink-300); text-decoration: line-through; }
.product-card.is-out .card-media img { opacity: 0.45; }
.product-card.is-out .card-body { opacity: 0.6; }

.card-skeleton { background: linear-gradient(100deg, var(--paper-100) 30%, var(--paper-200) 45%, var(--paper-100) 60%); background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: var(--radius-md); aspect-ratio: 3/4.2; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------------------------- Ratings / stock ---------------------------- */
.stock-pill { display: inline-flex; align-items: center; gap: 0.5em; font-size: 0.85rem; font-weight: 600; }
.stock-pill::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--success); }
.stock-pill.is-out { color: var(--danger); }
.stock-pill.is-out::before { background: var(--danger); }

/* ---------------------------- Quantity stepper ---------------------------- */
.qty-stepper {
  display: inline-flex;
  align-items: center;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-pill);
  overflow: hidden;
}
.qty-stepper button {
  width: 38px; height: 38px;
  background: none; border: none;
  font-size: 1.1rem;
  display: flex; align-items: center; justify-content: center;
  transition: background var(--dur-fast);
}
.qty-stepper button:hover { background: var(--teal-050); }
.qty-stepper input {
  width: 42px;
  border: none;
  text-align: center;
  font-weight: 700;
  background: none;
  -moz-appearance: textfield;
}
.qty-stepper input::-webkit-outer-spin-button, .qty-stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* ---------------------------- Cart drawer ---------------------------- */
.drawer-overlay {
  position: fixed; inset: 0;
  background: rgba(18, 56, 55, 0.35);
  backdrop-filter: blur(2px);
  z-index: var(--z-drawer);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-med) var(--ease-out);
}
.drawer-overlay.is-open { opacity: 1; pointer-events: auto; }

.cart-drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: min(440px, 100vw);
  background: var(--paper-000);
  z-index: calc(var(--z-drawer) + 1);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform var(--dur-slow) var(--ease-in-out);
  box-shadow: -30px 0 60px rgba(0,0,0,0.12);
}
.cart-drawer.is-open { transform: translateX(0); }
.cart-drawer-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--space-5);
  border-bottom: 1px solid var(--border);
}
.cart-drawer-head h3 { font-size: 1.3rem; }
.cart-drawer-body { flex: 1; overflow-y: auto; padding: var(--space-4) var(--space-5); }
.cart-drawer-foot { padding: var(--space-5); border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: var(--space-3); }

.cart-line {
  display: grid;
  grid-template-columns: 72px 1fr auto;
  gap: var(--space-3);
  padding-block: var(--space-4);
  border-bottom: 1px solid var(--border);
  align-items: start;
}
.cart-line img { width: 72px; height: 72px; object-fit: contain; background: var(--paper-100); border-radius: var(--radius-sm); padding: 6px; }
.cart-line .line-title { font-weight: 600; font-size: 0.92rem; margin-bottom: 4px; }
.cart-line .line-cat { font-size: 0.75rem; color: var(--ink-300); margin-bottom: 8px; }
.cart-line .line-remove { font-size: 0.78rem; color: var(--coral-600); font-weight: 600; margin-top: 8px; }
.cart-line .line-total { font-weight: 700; text-align: right; white-space: nowrap; }

.cart-summary-row { display: flex; justify-content: space-between; font-size: 0.95rem; color: var(--ink-500); }
.cart-summary-row.total { font-size: 1.2rem; font-weight: 700; color: var(--teal-900); font-family: var(--font-display); }

/* ---------------------------- Search overlay ---------------------------- */
.search-overlay {
  position: fixed; inset: 0;
  z-index: var(--z-modal);
  background: rgba(28,24,21,0.5);
  opacity: 0; pointer-events: none;
  transition: opacity var(--dur-med);
}
.search-overlay.is-open { opacity: 1; pointer-events: auto; }
.search-panel {
  background: var(--paper-000);
  max-width: 720px;
  margin: 8vh auto 0;
  border-radius: var(--radius-lg);
  overflow: hidden;
  transform: translateY(-24px);
  opacity: 0;
  transition: transform var(--dur-med) var(--ease-out), opacity var(--dur-med) var(--ease-out);
}
.search-overlay.is-open .search-panel { transform: translateY(0); opacity: 1; }
.search-input-row { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-5); border-bottom: 1px solid var(--border); }
.search-input-row > svg { width: 22px; height: 22px; flex-shrink: 0; stroke: var(--ink-300); }
.search-input-row input { flex: 1; min-width: 0; border: none; font-size: 1.3rem; font-family: var(--font-display); background: none; }
.search-input-row input:focus { outline: none; }
.search-results { max-height: 60vh; overflow-y: auto; padding: var(--space-3) var(--space-5) var(--space-5); }
.search-result-item {
  display: flex; align-items: center; gap: var(--space-3);
  padding: 0.7em 0.4em;
  border-radius: var(--radius-sm);
  transition: background var(--dur-fast);
}
.search-result-item:hover, .search-result-item.is-active { background: var(--teal-050); }
.search-result-item img { width: 48px; height: 48px; object-fit: contain; background: var(--paper-100); border-radius: 8px; padding: 4px; }
.search-empty { text-align: center; padding: var(--space-6); color: var(--ink-300); }
.search-suggest { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 var(--space-5) var(--space-4); }
.search-suggest button { padding: 0.4em 0.9em; border-radius: var(--radius-pill); background: var(--paper-100); font-size: 0.82rem; font-weight: 600; }
.search-suggest button:hover { background: var(--teal-100); }

/* ---------------------------- Filters / sort ---------------------------- */
.shop-layout { display: grid; grid-template-columns: 260px 1fr; gap: var(--space-6); align-items: start; }
@media (max-width: 900px) { .shop-layout { grid-template-columns: 1fr; } }

.filters-panel { position: sticky; top: calc(var(--header-h) + var(--space-4)); display: flex; flex-direction: column; gap: var(--space-6); }
.filter-group h4 { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: var(--space-3); }
.filter-group .options { display: flex; flex-direction: column; gap: 0.6em; }
.filter-check { display: flex; align-items: center; gap: 0.6em; font-size: 0.92rem; cursor: pointer; }
.filter-check input { accent-color: var(--teal-700); width: 17px; height: 17px; }
.filter-check .count { margin-left: auto; color: var(--ink-300); font-size: 0.8rem; }
.price-range { display: flex; flex-direction: column; gap: 0.6em; }
.price-range input[type="range"] { accent-color: var(--teal-700); width: 100%; }

.toolbar {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: var(--space-3);
  margin-bottom: var(--space-5);
}
.toolbar .result-count { color: var(--ink-500); font-size: 0.9rem; }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: var(--space-4); }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 0.35em 0.9em;
  border-radius: var(--radius-pill);
  background: var(--teal-050);
  color: var(--teal-800);
  font-size: 0.8rem;
  font-weight: 600;
}
.chip button { font-weight: 900; }

.mobile-filter-toggle { display: none; }
@media (max-width: 900px) {
  .mobile-filter-toggle { display: inline-flex; }
  .filters-panel {
    position: fixed; inset: 0 20% 0 0; max-width: 360px;
    background: var(--paper-000);
    z-index: var(--z-drawer);
    padding: var(--space-5);
    transform: translateX(-100%);
    transition: transform var(--dur-med) var(--ease-in-out);
    overflow-y: auto;
  }
  .filters-panel.is-open { transform: translateX(0); }
}

/* ---------------------------- Pagination ---------------------------- */
.pagination { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: var(--space-7); }
.pagination button, .pagination span {
  min-width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  font-weight: 600;
  font-size: 0.9rem;
}
.pagination button:hover { background: var(--teal-050); }
.pagination button[aria-current="true"] { background: var(--teal-900); color: #fff; }

/* ---------------------------- Category tiles (home) ---------------------------- */
.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: var(--space-4);
}
.category-tile {
  display: flex; flex-direction: column; align-items: center; gap: var(--space-3);
  text-align: center;
  padding: var(--space-5) var(--space-3);
  border-radius: var(--radius-md);
  background: var(--paper-000);
  transition: transform var(--dur-med) var(--ease-out), box-shadow var(--dur-med);
}
.category-tile:hover { transform: translateY(-5px); box-shadow: var(--shadow-md); }
.category-tile img { width: 64px; height: 64px; object-fit: contain; }
.category-tile span { font-weight: 600; font-size: 0.88rem; }
.category-tile.is-soon { opacity: 0.55; }
.category-tile .soon-tag { font-size: 0.68rem; color: var(--coral-600); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 700; }

/* ---------------------------- Steps (how it works / checkout) ---------------------------- */
.steps-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-5); }
@media (max-width: 860px) { .steps-row { grid-template-columns: repeat(2, 1fr); } }
.step-card { text-align: center; }
.step-card .step-num {
  width: 52px; height: 52px; margin-inline: auto var(--space-3);
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: var(--teal-900); color: #fff;
  font-family: var(--font-display); font-weight: 700; font-size: 1.2rem;
}
.step-card h4 { margin-top: var(--space-3); }
.step-card p { font-size: 0.9rem; }

.checkout-steps { display: flex; align-items: center; justify-content: center; gap: var(--space-3); margin-bottom: var(--space-7); flex-wrap: wrap; }
.checkout-steps .cstep { display: flex; align-items: center; gap: 0.6em; font-size: 0.85rem; font-weight: 600; color: var(--ink-300); }
.checkout-steps .cstep.is-active { color: var(--teal-900); }
.checkout-steps .cstep .dot { width: 26px; height: 26px; border-radius: 50%; border: 2px solid currentColor; display: flex; align-items: center; justify-content: center; font-size: 0.78rem; }
.checkout-steps .sep { width: 30px; height: 1px; background: var(--border); }

/* ---------------------------- Modal ---------------------------- */
.modal-overlay { position: fixed; inset: 0; z-index: var(--z-modal); background: rgba(28,24,21,0.5); display: flex; align-items: center; justify-content: center; padding: var(--space-4); opacity: 0; pointer-events: none; transition: opacity var(--dur-med); }
.modal-overlay.is-open { opacity: 1; pointer-events: auto; }
.modal-panel { background: var(--paper-000); border-radius: var(--radius-lg); max-width: 480px; width: 100%; padding: var(--space-6); transform: scale(0.94); transition: transform var(--dur-med) var(--ease-out); }
.modal-overlay.is-open .modal-panel { transform: scale(1); }

/* ---------------------------- Ticket preview ---------------------------- */
.ticket {
  font-family: 'Courier New', monospace;
  background: var(--paper-000);
  border: 1.5px dashed var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-5);
  font-size: 0.86rem;
  white-space: pre-wrap;
  line-height: 1.6;
}
