@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&display=swap');

:root {
  --primary-color: #1773b0;
  --primary-hover: #135d8f;
  --accent-color: #2b825b;
  --accent-hover: #236a4a;
  --text-main: #2d3748;
  --text-muted: #718096;
  --border-color: #e2e8f0;
  --bg-sidebar: #f8fafc;
  --bg-main: #ffffff;
  --radius: 10px;
  --font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  
  /* Fallback aliases */
  --shopify-bg: var(--bg-main);
  --shopify-sidebar-bg: var(--bg-sidebar);
  --shopify-border: var(--border-color);
  --shopify-text: var(--text-main);
  --shopify-muted: var(--text-muted);
  --shopify-blue: var(--primary-color);
  --shopify-green: var(--accent-color);
}

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

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

/* RTL Support */
html[dir="rtl"] {
  direction: rtl;
  text-align: right;
}

/* 50/50 Native Layout */
.layout-wrapper, .checkout-split-layout {
  display: flex;
  min-height: 100vh;
  flex-direction: row;
  width: 100%;
}

.main-column, .main-content-column {
  flex: 1 1 56%;
  display: flex;
  justify-content: flex-end;
  padding: 40px 48px;
  background-color: var(--bg-main);
}

.main-content, .main-column-inner {
  width: 100%;
  max-width: 580px;
}

.sidebar-column, .summary-sidebar-column {
  flex: 1 1 44%;
  background-color: var(--bg-sidebar);
  border-left: 1px solid var(--border-color);
  padding: 40px 48px;
  display: flex;
  justify-content: flex-start;
}

html[dir="rtl"] .sidebar-column, html[dir="rtl"] .summary-sidebar-column {
  border-left: none;
  border-right: 1px solid var(--border-color);
}

.sidebar-content, .summary-sticky-content {
  width: 100%;
  max-width: 440px;
  position: sticky;
  top: 40px;
}

/* Header */
.store-header, .desktop-header {
  margin-bottom: 28px;
}

.store-brand-link {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.store-logo-img {
  max-height: 52px;
  max-width: 220px;
  object-fit: contain;
  vertical-align: middle;
}

.store-name-text, .store-brand-title {
  font-size: 24px;
  font-weight: 700;
  color: #1a202c;
  text-decoration: none;
  letter-spacing: -0.5px;
}

/* Breadcrumbs */
.checkout-breadcrumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 10px;
}

.breadcrumb-item.active {
  color: var(--primary-color);
}

.breadcrumb-item.current {
  color: var(--text-main);
  font-weight: 600;
}

/* Mobile Order Summary Toggle */
.mobile-summary-toggle, .mobile-summary-accordion {
  display: none;
  background-color: #f8fafc;
  border-top: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
  padding: 16px 20px;
  cursor: pointer;
  user-select: none;
}

.mobile-summary-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 580px;
  margin: 0 auto;
  width: 100%;
}

.mobile-summary-btn, .accordion-left {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--primary-color);
  font-weight: 600;
  font-size: 14px;
}

.mobile-summary-price, .mobile-total-price {
  font-size: 18px;
  font-weight: 700;
  color: #1a202c;
}

.mobile-checkout-header {
  display: none;
}

/* Step Cards */
.step-card {
  margin-bottom: 24px;
  transition: all 0.3s ease;
}

/* Sections */
.section-block, .checkout-section {
  margin-bottom: 28px;
}

.section-title {
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 14px;
  color: #1a202c;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.secure-tag {
  font-size: 12px;
  color: var(--accent-color);
  font-weight: 500;
}

/* Pre-filled Confirmed Summary Box */
.summary-review-box {
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 4px 18px;
  margin-bottom: 24px;
  background-color: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.02);
}

.review-row {
  display: flex;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid #edf2f7;
  font-size: 13px;
}

.review-row:last-child {
  border-bottom: none;
}

.review-label {
  width: 80px;
  color: var(--text-muted);
  font-weight: 500;
}

.review-content {
  flex: 1;
  color: #1a202c;
  word-break: break-word;
  padding-right: 12px;
  font-weight: 500;
}

html[dir="rtl"] .review-content {
  padding-right: 0;
  padding-left: 12px;
}

.btn-edit-link {
  background: none;
  border: none;
  color: var(--primary-color);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  font-family: inherit;
  text-decoration: underline;
}

.btn-edit-link:hover {
  color: var(--primary-hover);
}

/* Forms & Inputs */
.field-grid, .form-row-two {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 12px;
}

.field-grid-1 {
  grid-template-columns: 1fr;
}

.field-grid-3, .form-row-three {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}

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

.floating-label-custom {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.form-control, .shopify-input, .shopify-select {
  width: 100%;
  padding: 13px 15px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  font-size: 14px;
  font-family: inherit;
  color: var(--text-main);
  background-color: #fff;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}

.form-control:focus, .shopify-input:focus, .shopify-select:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(23, 115, 176, 0.15);
}

select.form-control, .shopify-select {
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23718096' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 16px;
  padding-right: 36px;
}

html[dir="rtl"] select.form-control, html[dir="rtl"] .shopify-select {
  background-position: left 14px center;
  padding-right: 15px;
  padding-left: 36px;
}

.checkbox-row {
  margin-top: 8px;
  margin-bottom: 12px;
}

.shopify-checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-main);
  cursor: pointer;
}

/* Shipping Method Selection */
.shipping-options-list, .shipping-box-options {
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  overflow: hidden;
  background: #fff;
}

.shipping-option-item, .shipping-radio-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
  transition: background 0.15s;
}

.shipping-option-item:last-child, .shipping-radio-item:last-child {
  border-bottom: none;
}

.shipping-option-item:hover, .shipping-radio-item:hover {
  background-color: #f8fafc;
}

.shipping-option-item.selected, .shipping-radio-item.selected {
  background-color: #f0f7fb;
  border-color: var(--primary-color);
}

.shipping-radio-label, .radio-content-left {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  flex: 1;
}

.shipping-method-name {
  display: block;
  font-weight: 600;
  color: var(--text-main);
}

.shipping-method-time {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
}

.shipping-rate-price, .shipping-method-price {
  font-weight: 600;
  color: #1a202c;
}

.free-text {
  color: var(--accent-color);
  font-weight: 700;
}

/* Buttons */
.btn-primary-action {
  display: block;
  width: 100%;
  padding: 16px 24px;
  background-color: var(--primary-color);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background-color 0.2s, transform 0.1s;
  text-align: center;
  margin-top: 24px;
  box-shadow: 0 4px 12px rgba(23, 115, 176, 0.2);
}

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

.btn-primary-action:active {
  transform: scale(0.99);
}

.btn-pay-now, .btn-shopify-pay {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 16px 24px;
  background-color: var(--accent-color);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 16px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background-color 0.2s, transform 0.1s;
  text-align: center;
  margin-top: 24px;
  box-shadow: 0 4px 14px rgba(43, 130, 91, 0.25);
}

.btn-pay-now:hover, .btn-shopify-pay:hover {
  background-color: var(--accent-hover);
}

.btn-pay-now:active, .btn-shopify-pay:active {
  transform: scale(0.99);
}

.btn-pay-now:disabled, .btn-primary-action:disabled, .btn-shopify-pay:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Payment Box / Frame */
.payment-box, .shopify-payment-box {
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 18px;
  background-color: #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,0.02);
}

.payment-box-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
}

.header-radio {
  display: flex;
  align-items: center;
  gap: 8px;
}

.credit-card-badges {
  display: flex;
  gap: 6px;
}

.card-pill {
  font-size: 10px;
  font-weight: 700;
  background: #edf2f7;
  color: #4a5568;
  padding: 2px 6px;
  border-radius: 4px;
}

.stripe-field-box {
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 13px 15px;
  background: #fff;
  transition: border-color 0.2s;
}

.stripe-field-box.StripeElement--focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(23, 115, 176, 0.15);
}

#payment-element {
  min-height: 160px;
}

/* Security Trust Badges */
.trust-badges, .shopify-guarantee-badges {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 20px;
  margin-top: 18px;
  color: var(--text-muted);
  font-size: 12px;
}

.trust-badge-item, .guarantee-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Order Summary Items (Right Column) */
.product-items-list, .order-items-wrapper {
  margin-bottom: 24px;
}

.product-item-row, .cart-item-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
  justify-content: space-between;
}

.product-img-wrapper {
  position: relative;
  width: 64px;
  height: 64px;
  flex-shrink: 0;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 10px;
}

.product-img-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 10px;
}

.product-qty-badge {
  position: absolute;
  top: -8px;
  right: -8px;
  background-color: #4a5568;
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  width: 21px;
  height: 21px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}

html[dir="rtl"] .product-qty-badge {
  right: auto;
  left: -8px;
}

.product-info-col {
  flex: 1;
}

.product-title-text {
  font-weight: 600;
  font-size: 14px;
  color: #1a202c;
  line-height: 1.3;
}

.product-variant-text {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 3px;
}

.product-price-col {
  font-weight: 600;
  font-size: 14px;
  color: #1a202c;
  text-align: right;
}

html[dir="rtl"] .product-price-col {
  text-align: left;
}

/* Coupon Box */
.discount-box-row, .discount-input-row {
  display: flex;
  gap: 10px;
  margin-bottom: 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border-color);
}

.btn-apply-discount, .btn-discount-apply {
  padding: 13px 20px;
  background-color: #edf2f7;
  color: #2d3748;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.2s;
  white-space: nowrap;
}

.btn-apply-discount:hover, .btn-discount-apply:hover {
  background-color: #e2e8f0;
}

.applied-coupons-container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: -16px;
  margin-bottom: 20px;
}

.coupon-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #e3f2fd;
  color: #0d47a1;
  padding: 4px 12px;
  border-radius: 16px;
  font-size: 12px;
  font-weight: 600;
}

.coupon-tag-remove {
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
}

/* Cost Breakdown Summary */
.summary-cost-table, .pricing-breakdown {
  width: 100%;
  margin-bottom: 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border-color);
}

.summary-cost-row, .breakdown-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  font-size: 14px;
  color: #4a5568;
}

.summary-cost-row:last-child {
  margin-bottom: 0;
}

.breakdown-divider {
  height: 1px;
  background-color: var(--border-color);
  margin: 14px 0;
}

.summary-total-row, .total-highlight {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding-top: 6px;
}

.total-label, .total-title {
  font-size: 16px;
  font-weight: 600;
  color: #1a202c;
}

.total-currency-indicator, .total-currency-code {
  font-size: 12px;
  color: var(--text-muted);
  margin-left: 4px;
}

.total-amount-large, .total-big-price {
  font-size: 24px;
  font-weight: 700;
  color: #1a202c;
}

.sidebar-trust-box {
  margin-top: 16px;
}

.trust-badge-pill {
  background: #f1f5f9;
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  text-align: center;
}

/* Footer Links */
.checkout-footer, .checkout-footer-links {
  margin-top: 36px;
  padding-top: 20px;
  border-top: 1px solid #edf2f7;
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 12px;
}

.checkout-footer a, .checkout-footer-links a {
  color: var(--primary-color);
  text-decoration: none;
}

.checkout-footer a:hover, .checkout-footer-links a:hover {
  text-decoration: underline;
}

/* Loading Spinner */
.button-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-left: 8px;
}

.hidden {
  display: none !important;
}

/* Loading Overlay */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.85);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  backdrop-filter: blur(3px);
}

.spinner-icon {
  width: 46px;
  height: 46px;
  border: 4px solid #edf2f7;
  border-top-color: var(--primary-color);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.error-alert-box, .payment-error-banner {
  display: none;
  background-color: #fff5f5;
  border: 1px solid #feb2b2;
  color: #c53030;
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-top: 14px;
  margin-bottom: 14px;
  font-size: 14px;
}

/* Responsive */
@media (max-width: 992px) {
  .layout-wrapper, .checkout-split-layout {
    flex-direction: column;
  }
  .main-column, .sidebar-column, .main-content-column, .summary-sidebar-column {
    flex: auto;
    padding: 24px 20px;
    justify-content: center;
    width: 100%;
  }
  .sidebar-column, .summary-sidebar-column {
    border-left: none;
    border-right: none;
    display: none; /* Collapsible on mobile */
  }
  .sidebar-column.mobile-open, .summary-sidebar-column.mobile-open {
    display: block;
  }
  .mobile-summary-toggle, .mobile-summary-accordion, .mobile-checkout-header {
    display: block;
  }
  .main-content, .sidebar-content, .main-column-inner, .summary-sticky-content {
    max-width: 100%;
  }
}
