/* =========================
   Shared Cart + Checkout CSS
   File: /public/styles/checkout.css
   ========================= */

:root{
  --express-h: 48px;
  --radius: 6px;
  --radius-lg: 8px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  color: #111827;
  background: #ffffff;
}

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

.checkout-page { min-height: 100vh; }

.checkout-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 500px;
  padding: 60px 40px;
  text-align: center;
}

.empty-icon { color: #d1d5db; margin-bottom: 24px; }

.checkout-empty h2 {
  font-size: 1.875rem;
  font-weight: 600;
  margin-bottom: 12px;
}

.checkout-empty p { color: #6b7280; margin-bottom: 32px; }

.back-button {
  padding: 12px 32px;
  background: var(--black);
  color: white;
  text-decoration: none;
  border-radius: var(--radius);
  font-weight: 500;
  transition: background 0.2s;
}
.back-button:hover { background: var(--black-hover); }

.checkout-content {
  display: grid;
  grid-template-columns: 55% 45%;
  min-height: calc(100vh - 80px);
}

.checkout-left {
  background: #ffffff;
  border-right: 1px solid #e5e7eb;
}

.checkout-form {
  max-width: 640px;
  margin: 0 auto;
  padding: 40px 40px 40px 80px;
}

.checkout-right { background: #fafafa; }

.order-summary {
  padding: 24px 60px 40px 40px;
  position: sticky;
  top: 0;
}

/* =========================
   BREADCRUMB / SECTIONS
   ========================= */

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.875rem;
  margin-bottom: 32px;
}

.breadcrumb a { color: #2563eb; text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb .separator { color: #9ca3af; }
.breadcrumb .active { color: #111827; font-weight: 500; }

.form-section { margin-bottom: 32px; }

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.section-title {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #111827;
  margin-bottom: 16px;
}

.sign-in-link {
  color: #2563eb;
  font-size: 0.875rem;
  text-decoration: none;
}
.sign-in-link:hover { text-decoration: underline; }

/* =========================
   EXPRESS CHECKOUT (FIXED + DE-DUPED)
   ========================= */

/* grid that tolerates 2, 3, or 4 buttons without breaking anything */
.express-buttons{
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr;
  align-items: stretch;
  width: 100%;
  margin-bottom: 24px;
}

/* Make BOTH SDK mounts behave like identical "slots" */
#stripe-express-container,
#paypal-express-container{
  width: 100%;
  height: var(--express-h);
  min-height: var(--express-h);
  border-radius: var(--radius-lg);
  overflow: hidden;            /* THIS is what fixes weird corner rounding */
  display: flex;
  align-items: stretch;
  justify-content: stretch;
  background: transparent;
}

/* Stripe: force its wrapper/iframe to fill the slot */
#stripe-express-container > div{
  width: 100% !important;
  height: 100% !important;
}
#stripe-express-container iframe{
  width: 100% !important;
  height: 100% !important;
  display: block;
  border: 0;
}

/* PayPal: force zoid iframe to fill the slot */
#paypal-express-container > div{
  width: 100% !important;
  height: 100% !important;
}
#paypal-express-container iframe,
#paypal-express-container .zoid-component-frame,
#paypal-express-container .component-frame{
  width: 100% !important;
  height: 100% !important;
  display: block;
  border: 0;
}

/* IMPORTANT: do NOT globally set line-height/padding/height on "*" inside Stripe.
   That’s what causes odd clipping + layout glitches. */

.divider {
  position: relative;
  text-align: center;
  margin: 24px 0;
}

.divider::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 1px;
  background: #e5e7eb;
}

.divider span {
  position: relative;
  display: inline-block;
  padding: 0 12px;
  background: #ffffff;
  color: #9ca3af;
  font-size: 0.875rem;
}

.express-slot{
  height: 48px;
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  align-items: stretch;
}
#stripe-express-container,
#paypal-express-container{
  height: 100%;
  width: 100%;
}
#stripe-express-container iframe,
#paypal-express-container iframe{
  height: 100% !important;
  width: 100% !important;
  display: block;
  border: 0;
}

/* =========================
   FORMS
   ========================= */

.form-group { margin-bottom: 12px; }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}

.form-row-3 { grid-template-columns: 1fr 1fr 1fr; }

.form-group input,
.form-group select {
  width: 100%;
  height: 48px;
  padding: 0 14px;
  border: 1px solid #d1d5db;
  border-radius: var(--radius);
  font-size: 0.9375rem;
  background: white;
  transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--black);
}

.form-group input::placeholder { color: #9ca3af; }

.checkbox-wrapper {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.875rem;
  color: #374151;
  margin-top: 12px;
  cursor: pointer;
}

.checkbox-wrapper input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  cursor: pointer;
  accent-color: var(--black);
}

/* =========================
   SHIPPING
   ========================= */

.shipping-methods { display: flex; flex-direction: column; gap: 12px; }

.shipping-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border: 1px solid #d1d5db;
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.2s;
}

.shipping-option:hover { border-color: var(--black); }

.shipping-option input[type="radio"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--black);
}

.shipping-details { flex: 1; }

.shipping-name {
  font-weight: 500;
  color: #111827;
  font-size: 0.9375rem;
  margin-bottom: 2px;
}

.shipping-time { font-size: 0.8125rem; color: #6b7280; }

.shipping-cost { font-weight: 600; color: #111827; }

/* =========================
   PAYMENT
   ========================= */

.payment-info {
  padding: 14px;
  background: #f9fafb;
  border-radius: var(--radius);
  font-size: 0.8125rem;
  color: #6b7280;
  text-align: center;
  margin-bottom: 16px;
}

.form-error {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: var(--radius);
  color: #991b1b;
  font-size: 0.875rem;
  margin-bottom: 16px;
}
.form-error svg { flex-shrink: 0; }

.payment-methods {
  border: 1px solid #d1d5db;
  border-radius: var(--radius);
  overflow: hidden;
}

.payment-method { border-bottom: 1px solid #d1d5db; }
.payment-method:last-child { border-bottom: none; }

.method-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  cursor: pointer;
  background: white;
  transition: background 0.2s;
}

.method-header:hover { background: #f9fafb; }
.payment-method.active .method-header { background: #f9fafb; }

.method-header input[type="radio"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--black);
}

.method-header label {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 500;
  cursor: pointer;
}

.method-content {
  padding: 20px;
  background: #fafafa;
  border-top: 1px solid #e5e7eb;
}

#payment-element { margin-bottom: 16px; }

.submit-button {
  width: 100%;
  height: 52px;
  background: var(--black);
  color: white;
  border: none;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.submit-button:hover:not(:disabled) { background: var(--black-hover); }
.submit-button:disabled { opacity: 0.5; cursor: not-allowed; }

.button-spinner svg { animation: spin 1s linear infinite; }
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

.back-to-cart { margin-top: 24px; }
.back-to-cart a {
  color: #2563eb;
  font-size: 0.875rem;
  text-decoration: none;
}
.back-to-cart a:hover { text-decoration: underline; }

/* =========================
   ORDER SUMMARY (CHECKOUT)
   ========================= */

.order-items { margin-bottom: 16px; }

.summary-item {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
  align-items: flex-start;
}

/* BULLETPROOF thumbnail sizing */
.item-image-container {
  flex: 0 0 80px !important;
  width: 80px !important;
  height: 80px !important;
}

.order-summary img.summary-thumb {
  display: block !important;
  width: 80px !important;
  height: 80px !important;
  max-width: 80px !important;
  max-height: 80px !important;
  object-fit: cover !important;
  border-radius: var(--radius);
  border: 1px solid #e5e7eb;
}

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

.item-title {
  font-size: 0.875rem;
  font-weight: 700;
  color: #111827;
  margin-bottom: 2px;
}

.item-variant { font-size: 0.8125rem; color: #6b7280; }

.item-total {
  font-weight: 600;
  color: #111827;
  font-size: 0.9375rem;
}

.promo-section {
  padding: 12px 0;
  border-top: 1px solid #e5e7eb;
  border-bottom: 1px solid #e5e7eb;
  margin-bottom: 12px;
}

.promo-input-wrapper { display: flex; gap: 8px; }

.promo-input {
  flex: 1;
  height: 44px;
  padding: 0 12px;
  border: 1px solid #d1d5db;
  border-radius: var(--radius);
  font-size: 0.875rem;
  background: white;
}
.promo-input:focus { outline: none; border-color: var(--black); }

.promo-button {
  height: 44px;
  padding: 0 20px;
  background: #f3f4f6;
  border: 1px solid #d1d5db;
  border-radius: var(--radius);
  font-weight: 600;
  color: #374151;
  cursor: pointer;
  font-size: 0.875rem;
  transition: all 0.2s;
}
.promo-button:hover { background: #e5e7eb; }

.summary-breakdown { display: flex; flex-direction: column; gap: 8px; }

.summary-breakdown .summary-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.9375rem;
  color: #6b7280;
}

.summary-total {
  display: flex;
  justify-content: space-between;
  padding-top: 10px;
  border-top: 1px solid #e5e7eb;
  margin-top: 4px;
  font-size: 1.125rem;
  font-weight: 600;
  color: #111827;
}

.total-amount { display: flex; align-items: baseline; gap: 6px; }

.currency {
  font-size: 0.75rem;
  font-weight: 500;
  color: #6b7280;
}

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

@media (max-width: 1024px) {
  .checkout-content { grid-template-columns: 1fr; min-height: auto; }
  .checkout-left { border-right: none; border-bottom: 1px solid #e5e7eb; }
  .checkout-right { order: -1; }
  .checkout-form { padding: 24px 20px; }
  .order-summary { padding: 24px 20px; position: static; }
}

@media (max-width: 640px) {
  .checkout-form { padding: 20px 16px; }
  .order-summary { padding: 20px 16px; background: #ffffff; }

  .item-image-container {
    flex: 0 0 60px !important;
    width: 60px !important;
    height: 60px !important;
  }

  .order-summary img.summary-thumb {
    width: 60px !important;
    height: 60px !important;
    max-width: 64px !important;
    max-height: 64px !important;
  }

  .breadcrumb { font-size: 0.8125rem; margin-bottom: 24px; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }

  .promo-section {
    background: #fafafa;
    padding: 16px;
    margin: 16px -16px;
  }
}

/* Prevent iOS input zoom */
@media (max-width: 768px) {
  input, select, textarea, button { font-size: 16px !important; }
}

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

.cart-page {
  padding: 40px 0 80px;
  min-height: 60vh;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

.cart-title {
  font-size: 2.25rem;
  font-weight: 700;
  margin-bottom: 32px;
  color: #111827;
  letter-spacing: -0.02em;
}

/* Empty State */
.empty-cart {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 400px;
}

.empty-content {
  text-align: center;
  max-width: 400px;
}

.empty-content h2 {
  font-size: 1.875rem;
  font-weight: 600;
  margin-bottom: 12px;
  color: #111827;
  letter-spacing: -0.01em;
}

.empty-content p {
  color: #6b7280;
  margin-bottom: 32px;
  font-size: 1rem;
}

.shop-button {
  display: inline-block;
  padding: 12px 32px;
  background: var(--black);
  color: white;
  text-decoration: none;
  border-radius: var(--radius);
  font-weight: 600;
  transition: all 0.2s ease;
}

.shop-button:hover {
  background: var(--black-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Cart layout */
.cart-content {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 40px;
  align-items: start;
}

.cart-items {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.cart-item {
  display: grid;
  grid-template-columns: 100px 1fr auto auto;
  gap: 24px;
  align-items: start;
  padding: 24px;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: var(--radius);
  transition: all 0.2s ease;
}

.cart-item:hover {
  border-color: #d1d5db;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.item-image {
  width: 100px;
  height: 100px;
  border-radius: var(--radius);
  overflow: hidden;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
}

.item-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.item-details {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.item-name {
  font-size: 1rem;
  font-weight: 700;
  margin: 0;
  color: #111827;
  line-height: 1.4;
}

.item-price {
  font-size: 0.875rem;
  color: #6b7280;
}

/* Quantity Controls */
.item-quantity {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
}

.qty-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: #374151;
}

.qty-controls {
  display: flex;
  align-items: center;
  border: 1px solid #d1d5db;
  border-radius: var(--radius);
  overflow: hidden;
}

.qty-btn {
  width: 36px;
  height: 36px;
  border: none;
  background: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #374151;
  transition: all 0.15s ease;
  border-right: 1px solid #e5e7eb;
}

.qty-btn:last-child {
  border-right: none;
  border-left: 1px solid #e5e7eb;
}

.qty-btn:hover { background: #f9fafb; }
.qty-btn:active { background: #f3f4f6; }

.qty-input {
  width: 50px;
  height: 36px;
  text-align: center;
  border: none;
  font-weight: 600;
  font-size: 0.9375rem;
  color: #111827;
  -moz-appearance: textfield;
}
.qty-input::-webkit-outer-spin-button,
.qty-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.qty-input:focus { outline: none; }

.item-remove {
  background: transparent;
  border: none;
  color: #6b7280;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.875rem;
  transition: all 0.15s ease;
}
.item-remove:hover { color: #dc2626; background: #fef2f2; }

.cart-item .item-total {
  font-size: 1.125rem;
  font-weight: 700;
  color: #111827;
  min-width: 100px;
  text-align: right;
}

/* Cart Summary (scoped so it doesn't fight checkout summary) */
.cart-summary {
  position: sticky;
  top: 20px;
  background: #fafafa;
  border: 1px solid #e5e7eb;
  border-radius: var(--radius);
  padding: 28px 24px;
}

.cart-summary h2 {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0 0 24px;
  color: #111827;
  letter-spacing: -0.01em;
}

.cart-summary .summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  font-size: 0.9375rem;
  color: #6b7280;
}

.shipping-free {
  color: #16a34a;
  font-weight: 600;
  font-size: 0.875rem;
}

.summary-divider {
  height: 1px;
  background: #e5e7eb;
  margin: 16px 0;
}

.cart-summary .summary-total {
  font-size: 1.125rem;
  font-weight: 700;
  color: #111827;
  padding-top: 4px;
}

.checkout-button {
  display: block;
  width: 100%;
  padding: 14px;
  background: var(--black);
  color: white;
  text-decoration: none;
  text-align: center;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 1rem;
  margin: 20px 0 12px;
  transition: all 0.2s ease;
}

.checkout-button:hover {
  background: var(--black-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.continue-shopping {
  display: block;
  text-align: center;
  color: #2563eb;
  text-decoration: none;
  padding: 10px;
  font-size: 0.875rem;
  transition: all 0.2s ease;
  font-weight: 500;
}
.continue-shopping:hover { color: #1d4ed8; text-decoration: underline; }

@media (max-width: 968px) {
  .cart-content { grid-template-columns: 1fr; }
  .cart-summary { position: static; }
}

@media (max-width: 640px) {
  .cart-item { grid-template-columns: 80px 1fr; gap: 16px; }
  .item-image { width: 80px; height: 80px; }

  .item-quantity {
    grid-column: 1 / -1;
    flex-direction: row;
    justify-content: space-between;
    width: 100%;
  }

  .cart-item .item-total {
    grid-column: 1 / -1;
    text-align: left;
    font-size: 1.25rem;
  }
}


/* ===========================
   EXPRESS CHECKOUT — FINAL OVERRIDES
   Put this at the *very bottom* of checkout.css
   =========================== */

.express-buttons{
  display: grid !important;
  grid-template-columns: 1fr !important;
  gap: 12px !important;
  align-items: stretch !important;
  width: 100% !important;
  margin-bottom: 24px !important;
}

/* the slot defines the shape */
.express-slot{
  height: 48px !important;
  border-radius: 10px !important;
  overflow: hidden !important;
  display: flex !important;
  align-items: stretch !important;
  width: 100% !important;
  /* if anything peeks through, it should still look clean */
  background: #000 !important;
}

/* containers must fill the slot */
#stripe-express-container,
#paypal-express-container{
  width: 100% !important;
  height: 100% !important;
  display: block !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* make iframes truly fill and remove inline gaps */
#stripe-express-container iframe,
#paypal-express-container iframe{
  width: 100% !important;
  height: 100% !important;
  display: block !important;
  border: 0 !important;
}

/* Stripe sometimes mounts an extra wrapper div */
#stripe-express-container > div{
  width: 100% !important;
  height: 100% !important;
}

/* Tiny vertical nudge for Apple Pay (Stripe Express Checkout iframe) */
#stripe-express-container iframe {
  position: relative !important;
  top: 2px !important; /* try 1px or 2px */
}


.express-slot--stripe,
#stripe-express-container {
  background: transparent !important;
  border: 0 !important;
  outline: 0 !important;
  box-shadow: none !important;
  padding: 0 !important;
}
#stripe-express-container iframe { border: 0 !important; }



.field-hint{
  margin-top: 6px;
  font-size: 0.875rem;
  color: #6b7280;
}
