/* ============================================
   Trooth — Checkout Page Styles
   Shopify-inspired two-column layout
   ============================================ */

* { box-sizing: border-box; }

:root {
  --primary: #1F8AA7;
  --primary-dark: #176d86;
  --accent: #EB6BB0;
  --success: #22c55e;
  --error: #ef4444;
  --warning: #f59e0b;
  --text: #111827;
  --text-secondary: #6B7280;
  --text-muted: #9CA3AF;
  --border: #E5E7EB;
  --border-focus: #1F8AA7;
  --bg: #F9FAFB;
  --surface: #ffffff;
  --font-body: 'Inter', sans-serif;
  --font-heading: 'Outfit', sans-serif;
  --radius: 10px;
  --radius-sm: 6px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.08);
}

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--text);
  background: var(--bg);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ---- Checkout Shell ---- */
.checkout-shell {
  display: grid;
  grid-template-columns: 1fr 480px;
  min-height: 100vh;
}

/* ---- Left Column ---- */
.checkout-left {
  padding: 48px 56px 80px;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  max-width: 780px;
  width: 100%;
  justify-self: end;
}

/* ---- Right Column (Order Summary) ---- */
.checkout-right {
  background: #F3F4F6;
  border-left: 1px solid var(--border);
  padding: 64px 48px 80px;
  position: relative;
}

.checkout-right::before {
  content: '';
  position: fixed;
  top: 0;
  right: 0;
  width: 480px;
  height: 100%;
  background: #F3F4F6;
  z-index: -1;
}

/* ---- Logo / Breadcrumb ---- */
.checkout-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 40px;
  text-decoration: none;
}

.checkout-logo img {
  height: 38px;
  width: auto;
}

.checkout-logo span {
  font-family: var(--font-heading);
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
}

.checkout-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 32px;
  font-size: 13px;
  color: var(--text-muted);
}

.breadcrumb-step {
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 500;
}

.breadcrumb-step.active {
  color: var(--primary);
  font-weight: 600;
}

.breadcrumb-sep {
  color: var(--border);
}

/* ---- Section Titles ---- */
.checkout-section-title {
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

/* ---- Form Groups ---- */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-group {
  margin-bottom: 16px;
  position: relative;
}

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}

.form-input {
  width: 100%;
  padding: 13px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--text);
  background: var(--surface);
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
}

.form-input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(31, 138, 167, 0.12);
}

.form-input::placeholder {
  color: var(--text-muted);
}

select.form-input {
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239CA3AF' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 38px;
  cursor: pointer;
}

/* ---- Checkbox / Radio ---- */
.checkbox-label, .radio-label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text);
  margin-bottom: 4px;
}

.checkbox-label input[type="checkbox"],
.radio-label input[type="radio"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
  cursor: pointer;
}

/* ---- Payment Method Tabs ---- */
.payment-methods {
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 24px;
}

.payment-method-option {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  transition: background 0.15s;
}

.payment-method-option:last-child {
  border-bottom: none;
}

.payment-method-option:hover {
  background: #F9FAFB;
}

.payment-method-option.selected {
  background: rgba(31, 138, 167, 0.04);
}

.payment-method-radio {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: border-color 0.15s;
}

.payment-method-option.selected .payment-method-radio {
  border-color: var(--primary);
}

.payment-method-radio-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--primary);
  display: none;
}

.payment-method-option.selected .payment-method-radio-dot {
  display: block;
}

.payment-method-info {
  flex: 1;
}

.payment-method-name {
  font-weight: 600;
  font-size: 15px;
  color: var(--text);
}

.payment-method-desc {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.payment-method-icons {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-shrink: 0;
}

.payment-method-icons img,
.card-icon {
  height: 24px;
  border-radius: 4px;
  border: 1px solid var(--border);
  padding: 2px 4px;
  background: #fff;
}

/* ---- Payment Panels ---- */
.payment-panel {
  display: none;
  padding: 20px;
  background: #FAFAFA;
  border-top: 1px solid var(--border);
  border-radius: 0 0 var(--radius) var(--radius);
  animation: panelIn 0.2s ease;
}

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

.payment-panel.active {
  display: block;
}

/* ---- Stripe Card Element ---- */
#stripe-card-element {
  padding: 14px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  min-height: 48px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

#stripe-card-element.StripeElement--focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(31, 138, 167, 0.12);
}

#stripe-card-error {
  color: var(--error);
  font-size: 13px;
  margin-top: 8px;
  display: none;
}

/* ---- Bank Transfer Panel ---- */
.bank-details-grid {
  display: grid;
  gap: 12px;
}

.bank-detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: var(--surface);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.bank-detail-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.bank-detail-value {
  font-weight: 600;
  color: var(--text);
  font-size: 15px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.copy-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--primary);
  font-size: 13px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 4px;
  transition: background 0.15s;
}

.copy-btn:hover {
  background: rgba(31, 138, 167, 0.1);
}

.bank-note {
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.25);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 13px;
  color: #92400e;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-top: 12px;
}

/* ---- Place Order Button ---- */
.btn-place-order {
  width: 100%;
  padding: 17px 24px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff;
  font-family: var(--font-heading);
  font-size: 17px;
  font-weight: 700;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 4px 20px rgba(31, 138, 167, 0.35);
  letter-spacing: 0.01em;
  margin-top: 24px;
}

.btn-place-order:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(31, 138, 167, 0.4);
}

.btn-place-order:active {
  transform: translateY(0);
}

.btn-place-order:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn-place-order .spinner {
  width: 18px;
  height: 18px;
  border: 2.5px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: none;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.btn-place-order.loading .spinner { display: block; }
.btn-place-order.loading .btn-text { display: none; }

.secure-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 14px;
  font-size: 12px;
  color: var(--text-muted);
}

/* ---- Order Summary (Right) ---- */
.summary-title {
  font-family: var(--font-heading);
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 24px;
}

.summary-items {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 28px;
  max-height: 380px;
  overflow-y: auto;
  padding-right: 4px;
}

.summary-item {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.summary-item-img {
  position: relative;
  flex-shrink: 0;
}

.summary-item-img img {
  width: 64px;
  height: 64px;
  object-fit: contain;
  background: #fff;
  border-radius: 8px;
  border: 1px solid var(--border);
  padding: 6px;
}

.summary-item-qty {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 22px;
  height: 22px;
  background: var(--text);
  color: #fff;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.summary-item-details {
  flex: 1;
}

.summary-item-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
  line-height: 1.3;
}

.summary-item-variant {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.summary-item-price {
  font-weight: 700;
  font-size: 14px;
  color: var(--text);
  flex-shrink: 0;
}

.summary-divider {
  height: 1px;
  background: var(--border);
  margin: 20px 0;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  font-size: 14px;
  color: var(--text-secondary);
}

.summary-row.total {
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin-top: 16px;
  padding-top: 16px;
  border-top: 2px solid var(--border);
}

.summary-coupon {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}

.coupon-input {
  flex: 1;
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 14px;
  outline: none;
}

.coupon-input:focus {
  border-color: var(--primary);
}

.coupon-btn {
  padding: 11px 18px;
  background: var(--text);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s;
}

.coupon-btn:hover {
  background: var(--primary);
}

/* ---- Empty Cart State ---- */
.empty-cart-msg {
  text-align: center;
  padding: 40px 0;
  color: var(--text-secondary);
}

/* ---- Success Page ---- */
.success-screen {
  display: none;
  text-align: center;
  padding: 60px 20px;
}

.success-icon {
  width: 80px;
  height: 80px;
  background: rgba(34, 197, 94, 0.1);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 24px;
}

.success-icon svg {
  color: var(--success);
}

/* ---- Responsive ---- */
@media (max-width: 1024px) {
  .checkout-shell {
    grid-template-columns: 1fr;
  }

  .checkout-right {
    border-left: none;
    border-top: 1px solid var(--border);
    order: -1;
    padding: 32px 24px;
  }

  .checkout-right::before {
    display: none;
  }

  .checkout-left {
    padding: 32px 24px 60px;
    max-width: 100%;
    justify-self: auto;
  }

  .summary-items {
    max-height: none;
  }
}

@media (max-width: 480px) {
  .form-row {
    grid-template-columns: 1fr;
  }
}
