/* ============================================================
   COMPONENTS
   ============================================================ */

/* ── Buttons ────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 20px; border-radius: var(--radius);
  font-size: 14px; font-weight: 600; cursor: pointer;
  transition: var(--transition); border: none; font-family: inherit;
  white-space: nowrap;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary   { background: var(--blue);  color: var(--white); }
.btn-primary:hover:not(:disabled)  { background: var(--blue-dark); transform: translateY(-1px); }
.btn-success   { background: var(--green); color: var(--white); }
.btn-success:hover:not(:disabled)  { background: #15803D; }
.btn-danger    { background: var(--red);   color: var(--white); }
.btn-danger:hover:not(:disabled)   { background: #B91C1C; }
.btn-outline   { background: transparent; color: var(--gray-700); border: 1.5px solid var(--gray-200); }
.btn-outline:hover:not(:disabled)  { border-color: var(--blue); color: var(--blue); }
.btn-sm  { padding: 6px 14px; font-size: 13px; }
.btn-lg  { padding: 14px 28px; font-size: 16px; }
.btn-full { width: 100%; }
.btn-icon-only { width: 36px; height: 36px; padding: 0; border-radius: var(--radius-sm); }

/* ── Shop — Category Filter ─────────────────────────────── */
.shop-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; margin-bottom: 32px; flex-wrap: wrap;
}
.category-tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.cat-tab {
  padding: 7px 18px; border-radius: 50px;
  border: 1.5px solid var(--gray-200);
  font-size: 13px; font-weight: 600; color: var(--gray-600);
  background: var(--white); cursor: pointer; transition: var(--transition);
}
.cat-tab:hover { border-color: var(--blue); color: var(--blue); }
.cat-tab.active { background: var(--blue); color: var(--white); border-color: var(--blue); box-shadow: var(--shadow-sm); }

.shop-search-wrap { position: relative; }
.shop-search-wrap svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--gray-400); pointer-events: none; }
.shop-search {
  padding: 9px 14px 9px 38px;
  border: 1.5px solid var(--gray-200); border-radius: var(--radius);
  background: var(--white); font-size: 14px; width: 220px; outline: none;
  transition: var(--transition);
}
.shop-search:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(37,99,235,.1); }
.shop-search::placeholder { color: var(--gray-400); }

.results-info { font-size: 13px; color: var(--gray-500); margin-bottom: 24px; }
.results-info strong { color: var(--blue); }

/* ── Product Grid ────────────────────────────────────────── */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 24px;
}

.product-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  border: 1px solid var(--gray-200);
  overflow: hidden;
  transition: var(--transition-slow);
  display: flex; flex-direction: column;
  cursor: pointer;
}
.product-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
  border-color: var(--blue);
}

.product-img-wrap {
  aspect-ratio: 1;
  background: linear-gradient(135deg, var(--gray-100), var(--gray-200));
  display: flex; align-items: center; justify-content: center;
  position: relative; overflow: hidden;
  font-size: 72px; line-height: 1;
}
.product-img-wrap img { width:100%; height:100%; object-fit:cover; }

.product-ribbon {
  position: absolute; top: 12px; left: 0;
  background: var(--orange); color: var(--white);
  padding: 3px 10px 3px 8px; font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .5px;
  clip-path: polygon(0 0, 100% 0, 90% 100%, 0 100%);
}
.product-ribbon.popular { background: var(--purple); }

.product-card-body { padding: 16px; flex: 1; display: flex; flex-direction: column; gap: 8px; }
.product-category { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; font-weight: 700; color: var(--blue); }
.product-name { font-size: 15px; font-weight: 700; color: var(--gray-900); line-height: 1.3; }
.product-desc { font-size: 12px; color: var(--gray-500); line-height: 1.5; flex: 1; }
.product-rating { display: flex; align-items: center; gap: 4px; }
.stars { color: var(--yellow); font-size: 13px; }
.rating-count { font-size: 11px; color: var(--gray-400); }

.product-card-footer {
  padding: 12px 16px 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.product-price {
  font-size: 20px; font-weight: 800; color: var(--gray-900);
  font-family: var(--font-display);
}
.product-price-old {
  font-size: 12px; color: var(--gray-400); text-decoration: line-through;
  margin-left: 4px;
}

.btn-add-to-cart {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: var(--radius);
  background: var(--blue); color: var(--white);
  font-size: 13px; font-weight: 700;
  transition: var(--transition); flex-shrink: 0;
}
.btn-add-to-cart:hover { background: var(--blue-dark); transform: scale(1.04); }
.btn-add-to-cart.added { background: var(--green); }

/* ── Empty state ─────────────────────────────────────────── */
.empty-state {
  grid-column: 1/-1; text-align: center;
  padding: 60px 24px; color: var(--gray-400);
}
.empty-state-icon { font-size: 64px; margin-bottom: 16px; opacity: .4; }
.empty-state h3 { font-size: 20px; color: var(--gray-600); margin-bottom: 8px; }
.empty-state p { font-size: 14px; }

/* ── Cart Page ───────────────────────────────────────────── */
.cart-layout {
  display: grid; grid-template-columns: 1fr 340px;
  gap: 32px; align-items: start;
}

.cart-table-wrap {
  background: var(--white); border-radius: var(--radius-lg);
  border: 1px solid var(--gray-200); overflow: hidden;
}

.cart-table { width: 100%; border-collapse: collapse; }
.cart-table th {
  background: var(--gray-50); padding: 12px 20px;
  font-size: 11px; text-transform: uppercase; letter-spacing: .8px;
  color: var(--gray-500); font-weight: 700; text-align: left;
  border-bottom: 1px solid var(--gray-200);
}
.cart-table td { padding: 16px 20px; border-bottom: 1px solid var(--gray-100); vertical-align: middle; }
.cart-table tr:last-child td { border-bottom: none; }

.cart-product-cell { display: flex; align-items: center; gap: 14px; }
.cart-thumb {
  width: 64px; height: 64px; border-radius: var(--radius);
  background: var(--gray-100); display: flex; align-items: center;
  justify-content: center; font-size: 36px; flex-shrink: 0;
  overflow: hidden;
}
.cart-thumb img { width:100%; height:100%; object-fit:cover; }
.cart-product-name { font-size: 14px; font-weight: 600; color: var(--gray-800); }
.cart-product-sku  { font-size: 11px; color: var(--gray-400); margin-top: 2px; }
.cart-price { font-size: 15px; font-weight: 700; color: var(--gray-800); }

/* Qty control in cart */
.qty-stepper { display: flex; align-items: center; gap: 8px; }
.qty-stepper-btn {
  width: 30px; height: 30px; border-radius: var(--radius-sm);
  border: 1.5px solid var(--gray-200); color: var(--gray-700);
  font-size: 18px; display: flex; align-items: center; justify-content: center;
  transition: var(--transition); line-height: 1;
}
.qty-stepper-btn:hover { border-color: var(--blue); color: var(--blue); }
.qty-stepper-val { font-size: 15px; font-weight: 700; width: 24px; text-align: center; }

.cart-remove-btn { color: var(--gray-400); font-size: 13px; text-decoration: underline; cursor: pointer; transition: var(--transition); background: none; border: none; padding: 0; }
.cart-remove-btn:hover { color: var(--red); }

/* Order summary card */
.order-summary {
  background: var(--white); border-radius: var(--radius-lg);
  border: 1px solid var(--gray-200); padding: 24px;
  position: sticky; top: calc(var(--header-h) + 16px);
}
.order-summary h3 { font-size: 17px; margin-bottom: 20px; }
.summary-row { display: flex; justify-content: space-between; font-size: 14px; color: var(--gray-600); margin-bottom: 12px; }
.summary-row.total { font-size: 18px; font-weight: 800; color: var(--gray-900); border-top: 1px solid var(--gray-200); padding-top: 12px; margin-top: 4px; }
.summary-row.total span:last-child { color: var(--blue); }
.shipping-note { font-size: 12px; color: var(--green); font-weight: 600; text-align: center; padding: 8px; background: var(--green-light); border-radius: var(--radius-sm); margin: 12px 0; }

/* Empty cart */
.cart-empty {
  background: var(--white); border-radius: var(--radius-lg);
  border: 1px solid var(--gray-200); padding: 60px 24px; text-align: center;
  grid-column: 1/-1;
}

/* ── Checkout Form ───────────────────────────────────────── */
.checkout-layout { display: grid; grid-template-columns: 1fr 340px; gap: 32px; align-items: start; }
.form-card { background: var(--white); border-radius: var(--radius-lg); border: 1px solid var(--gray-200); padding: 28px; margin-bottom: 20px; }
.form-card-title { font-size: 16px; font-weight: 700; margin-bottom: 20px; display: flex; align-items: center; gap: 10px; }
.form-step-badge { width: 26px; height: 26px; border-radius: 50%; background: var(--blue); color: var(--white); font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center; font-family: var(--font-sans); flex-shrink: 0; }
.form-grid { display: grid; gap: 16px; }
.form-grid-2 { grid-template-columns: 1fr 1fr; }
.form-grid-3 { grid-template-columns: 2fr 1fr 1fr; }

/* Field */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12px; font-weight: 700; color: var(--gray-600); text-transform: uppercase; letter-spacing: .5px; }
.field input, .field select { padding: 10px 14px; border: 1.5px solid var(--gray-200); border-radius: var(--radius); font-size: 14px; background: var(--gray-50); outline: none; transition: var(--transition); width: 100%; }
.field input:focus, .field select:focus { border-color: var(--blue); background: var(--white); box-shadow: 0 0 0 3px rgba(37,99,235,.08); }
.field input.invalid, .field select.invalid { border-color: var(--red); background: var(--red-light); }
.field-error { font-size: 11.5px; color: var(--red); font-weight: 600; display: none; }
.field.has-error .field-error { display: block; }
.field.has-error input, .field.has-error select { border-color: var(--red); }
.card-logos { display: flex; gap: 6px; }
.card-logo { padding: 3px 8px; border-radius: 4px; font-size: 9px; font-weight: 800; }
.card-logo.visa { background: #1A1F71; color: #fff; }
.card-logo.mc   { background: #EB001B; color: #fff; }
.card-logo.amex { background: #2E77BC; color: #fff; }

/* ── Contact Page ────────────────────────────────────────── */
.contact-layout { display: grid; grid-template-columns: 1fr 1.6fr; gap: 48px; align-items: start; }
.contact-info h2 { font-size: 28px; margin-bottom: 12px; }
.contact-info p { font-size: 15px; color: var(--gray-600); line-height: 1.7; margin-bottom: 28px; }
.contact-detail { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 18px; }
.contact-detail-icon { width: 44px; height: 44px; border-radius: var(--radius); background: var(--blue-light); color: var(--blue); display: flex; align-items: center; justify-content: center; font-size: 20px; flex-shrink: 0; }
.contact-detail-text strong { font-size: 14px; color: var(--gray-800); display: block; margin-bottom: 2px; }
.contact-detail-text span { font-size: 13px; color: var(--gray-500); }
.contact-form-card { background: var(--white); border-radius: var(--radius-lg); border: 1px solid var(--gray-200); padding: 32px; }
.contact-form-card h3 { font-size: 20px; margin-bottom: 24px; }
.field textarea { padding: 10px 14px; border: 1.5px solid var(--gray-200); border-radius: var(--radius); font-size: 14px; background: var(--gray-50); outline: none; transition: var(--transition); width: 100%; resize: vertical; min-height: 120px; font-family: inherit; }
.field textarea:focus { border-color: var(--blue); background: var(--white); box-shadow: 0 0 0 3px rgba(37,99,235,.08); }
.contact-success { text-align: center; padding: 48px 24px; }
.contact-success-icon { font-size: 64px; margin-bottom: 16px; }
.contact-success h3 { font-size: 22px; margin-bottom: 10px; }
.contact-success p { font-size: 14px; color: var(--gray-500); }

/* ── Auth Modal ──────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 800;
  background: rgba(17,24,39,.6);
  backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center; padding: 24px;
  opacity: 0; pointer-events: none; transition: opacity .25s ease;
}
.modal-backdrop.open { opacity: 1; pointer-events: all; }
.modal-box {
  background: var(--white); border-radius: var(--radius-xl);
  width: 100%; max-width: 420px;
  padding: 36px; box-shadow: var(--shadow-xl);
  transform: scale(.94) translateY(16px);
  transition: transform .25s cubic-bezier(.4,0,.2,1);
}
.modal-backdrop.open .modal-box { transform: scale(1) translateY(0); }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 28px; }
.modal-title { font-size: 22px; font-weight: 800; }
.modal-close { width: 32px; height: 32px; border-radius: 50%; background: var(--gray-100); font-size: 18px; display: flex; align-items: center; justify-content: center; transition: var(--transition); }
.modal-close:hover { background: var(--gray-200); }
.modal-tabs { display: flex; gap: 0; border: 1.5px solid var(--gray-200); border-radius: var(--radius); overflow: hidden; margin-bottom: 24px; }
.modal-tab { flex: 1; padding: 9px; text-align: center; font-size: 14px; font-weight: 600; color: var(--gray-600); cursor: pointer; transition: var(--transition); }
.modal-tab.active { background: var(--blue); color: var(--white); }
.modal-form { display: flex; flex-direction: column; gap: 14px; }
.modal-divider { text-align: center; font-size: 12px; color: var(--gray-400); margin: 4px 0; }

/* ── Confirmation page ───────────────────────────────────── */
.confirm-page { max-width: 640px; margin: 0 auto; padding: 64px 24px; text-align: center; }
.confirm-check { width: 90px; height: 90px; border-radius: 50%; background: linear-gradient(135deg, var(--green), #15803D); display: flex; align-items: center; justify-content: center; font-size: 44px; margin: 0 auto 28px; box-shadow: 0 12px 40px rgba(22,163,74,.3); animation: popIn .55s cubic-bezier(.34,1.56,.64,1); }
@keyframes popIn { from{transform:scale(0);opacity:0} to{transform:scale(1);opacity:1} }
.confirm-page h1 { font-size: 38px; margin-bottom: 10px; }
.confirm-order-num { font-size: 17px; color: var(--gray-500); margin-bottom: 36px; }
.confirm-order-num strong { color: var(--blue); }
.confirm-card { background: var(--white); border: 1px solid var(--gray-200); border-radius: var(--radius-lg); padding: 28px; text-align: left; margin-bottom: 28px; }
.confirm-card h3 { font-size: 15px; margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--gray-200); }
.confirm-item { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.confirm-item:last-child { margin-bottom: 0; }
.confirm-item-img { width: 48px; height: 48px; border-radius: var(--radius-sm); background: var(--gray-100); display: flex; align-items: center; justify-content: center; font-size: 28px; flex-shrink: 0; }
.confirm-item-name { flex: 1; font-size: 14px; font-weight: 600; }
.confirm-item-qty { font-size: 12px; color: var(--gray-500); }
.confirm-item-price { font-size: 14px; font-weight: 700; color: var(--blue); }
.delivery-box { display: flex; align-items: center; gap: 12px; background: var(--green-light); border: 1px solid #BBF7D0; border-radius: var(--radius); padding: 14px 18px; margin-bottom: 28px; text-align: left; }
.delivery-box-icon { font-size: 28px; flex-shrink: 0; }
.delivery-box-label { font-size: 12px; color: var(--gray-500); }
.delivery-box-date  { font-size: 15px; font-weight: 700; color: var(--green); }

/* ── Toast ───────────────────────────────────────────────── */
#toast-container {
  position: fixed; top: calc(var(--header-h) + 14px); right: 20px;
  z-index: 9999; display: flex; flex-direction: column; gap: 10px;
}
.toast {
  background: var(--gray-900); color: var(--white);
  padding: 12px 18px; border-radius: var(--radius);
  font-size: 13px; font-weight: 600;
  display: flex; align-items: center; gap: 10px;
  box-shadow: var(--shadow-lg); max-width: 320px;
  animation: toastIn .32s cubic-bezier(.34,1.56,.64,1);
}
.toast.success { border-left: 4px solid var(--green); }
.toast.error   { border-left: 4px solid var(--red); }
.toast.info    { border-left: 4px solid var(--blue); }
.toast.out     { animation: toastOut .28s ease forwards; }
@keyframes toastIn  { from{opacity:0;transform:translateX(40px) scale(.9)} to{opacity:1;transform:translateX(0) scale(1)} }
@keyframes toastOut { from{opacity:1;transform:translateX(0) scale(1)} to{opacity:0;transform:translateX(40px) scale(.9)} }

/* ── API Explorer ────────────────────────────────────────── */
.api-toggle-btn {
  position: fixed; bottom: 20px; right: 20px; z-index: 7000;
  padding: 10px 18px; border-radius: 50px;
  background: #1E1E1E; color: #C4A882; border: 1px solid #444;
  font-size: 12px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase;
  cursor: pointer; box-shadow: 0 4px 20px rgba(0,0,0,.4); font-family: monospace;
  transition: var(--transition);
}
.api-toggle-btn:hover { background: #2C4A3E; border-color: #C4A882; }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 960px) {
  .cart-layout, .checkout-layout, .contact-layout { grid-template-columns: 1fr; }
  .order-summary { position: static; }
}
@media (max-width: 640px) {
  .shop-toolbar { flex-direction: column; align-items: stretch; }
  .shop-search { width: 100%; }
  .form-grid-2, .form-grid-3 { grid-template-columns: 1fr; }
  .cart-table thead { display: none; }
  .cart-table tr { display: flex; flex-direction: column; padding: 16px 0; border-bottom: 1px solid var(--gray-100); }
  .cart-table td { padding: 4px 20px; border: none; }
}
