/* ==========================================================================
   Base Styles & Reset
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --bg-page: #f8fafc;
  --card-bg: #ffffff;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-dim: #94a3b8;
  --border-light: #e2e8f0;
  --border-field: #cbd5e1;
  --primary-blue: #1d68ed;
  --primary-blue-hover: #1555c4;
  --primary-blue-light: #eff6ff;
  --active-tile-bg: #eef5ff;
  --active-tile-border: #2563eb;
  --success-color: #10b981;
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.05);
  --shadow-card: 0 4px 20px -2px rgba(15, 23, 42, 0.06), 0 2px 6px -1px rgba(15, 23, 42, 0.03);
  --shadow-hover: 0 8px 24px -4px rgba(15, 23, 42, 0.08);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-page);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ==========================================================================
   Header Bar
   ========================================================================== */
.checkout-header {
  background-color: #ffffff;
  border-bottom: 1px solid var(--border-light);
  padding: 16px 24px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.header-container {
  max-width: 1080px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--primary-blue);
}

.brand-icon {
  stroke: var(--primary-blue);
}

.brand-name {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #0f172a;
}

.brand-dot {
  color: var(--primary-blue);
}

.secure-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8125rem;
  font-weight: 600;
  color: #059669;
  background-color: #ecfdf5;
  padding: 6px 12px;
  border-radius: 9999px;
  border: 1px solid #a7f3d0;
}

/* ==========================================================================
   Main Wrapper & 2-Column Grid
   ========================================================================== */
.main-wrapper {
  flex: 1;
  padding: 40px 20px 80px;
  display: flex;
  justify-content: center;
}

.checkout-container {
  width: 100%;
  max-width: 1040px;
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 48px;
  align-items: start;
}

@media (max-width: 900px) {
  .checkout-container {
    grid-template-columns: 1fr;
    gap: 36px;
  }
}

/* ==========================================================================
   Left Column & Billing Information Form
   ========================================================================== */
.checkout-col {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.form-card {
  background: transparent;
}

.section-title-wrap {
  margin-bottom: 16px;
}

.section-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: #0f172a;
  letter-spacing: -0.02em;
}

.section-subtitle {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Segmented Inputs Container */
.input-grid {
  display: flex;
  flex-direction: column;
  background: #ffffff;
  border: 1px solid var(--border-field);
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.input-row-combined {
  display: grid;
  grid-template-columns: 95px 1fr 1fr;
  border-bottom: 1px solid var(--border-field);
}

@media (max-width: 520px) {
  .input-row-combined {
    grid-template-columns: 80px 1fr 1fr;
  }
}

.input-row-half {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.phone-row {
  display: grid;
  grid-template-columns: 130px 1fr;
  border-bottom: 1px solid var(--border-field);
}

.field-item {
  position: relative;
  display: flex;
  flex-direction: column;
}

.field-item label {
  display: none; /* Clean segmented look matching the visual reference */
}

.form-control {
  width: 100%;
  height: 46px;
  padding: 8px 14px;
  font-family: inherit;
  font-size: 0.9375rem;
  color: #1e293b;
  background-color: #ffffff;
  border: none;
  outline: none;
  transition: var(--transition);
}

.form-control::placeholder {
  color: #94a3b8;
}

.form-control:focus {
  background-color: #f8fafc;
  box-shadow: inset 0 0 0 1.5px var(--primary-blue);
  z-index: 2;
}

.input-row-combined .field-item:not(:last-child) {
  border-right: 1px solid var(--border-field);
}

.input-row-half .field-item:not(:last-child) {
  border-right: 1px solid var(--border-field);
}

.country-code-wrapper {
  border-right: 1px solid var(--border-field);
}

.field-full {
  border-bottom: 1px solid var(--border-field);
}

.input-grid > .field-full:last-child,
.input-grid > .input-row-half:last-child {
  border-bottom: none;
}

/* Select wrapper styling */
.select-wrapper {
  position: relative;
  width: 100%;
  height: 100%;
}

.select-wrapper select.form-control {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 28px;
  cursor: pointer;
  background-color: #ffffff;
}

.select-arrow {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  color: #64748b;
}

/* Trust features pills */
.trust-features {
  display: flex;
  gap: 16px;
  padding-top: 6px;
  flex-wrap: wrap;
}

.trust-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8125rem;
  font-weight: 500;
  color: #475569;
}

/* ==========================================================================
   Right Column & Visa Payment Method
   ========================================================================== */
.payment-card {
  background-color: transparent;
}

.payment-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.order-price-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  background-color: #eff6ff;
  border: 1px solid #bfdbfe;
  padding: 5px 14px;
  border-radius: 9999px;
  font-size: 0.875rem;
}

.price-label {
  color: #3b82f6;
  font-weight: 600;
}

.price-amount {
  color: #1e3a8a;
  font-weight: 800;
}

.methods-subheading {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #475569;
  margin-bottom: 12px;
}

/* Single Visa Card Method Card */
.single-method-card {
  background: var(--active-tile-bg);
  border: 1.5px solid var(--active-tile-border);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 0 0 1px var(--active-tile-border);
  margin-bottom: 18px;
  transition: var(--transition);
}

.sm-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.custom-radio {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--primary-blue);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.radio-inner {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background-color: var(--primary-blue);
}

.sm-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.visa-badge-large {
  font-size: 1.25rem;
  font-weight: 900;
  font-style: italic;
  color: #1a1f71;
  letter-spacing: -0.04em;
  background: #ffffff;
  padding: 3px 10px;
  border-radius: 4px;
  border: 1px solid #cbd5e1;
  box-shadow: var(--shadow-sm);
}

.sm-info {
  display: flex;
  flex-direction: column;
}

.sm-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.2;
}

.sm-sub {
  font-size: 0.775rem;
  color: #475569;
}

.sm-right {
  display: flex;
  align-items: center;
}

/* Card Details Box */
.card-details-box {
  background: #ffffff;
  border: 1px solid var(--border-field);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
}

.card-box-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-light);
}

.cb-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: #1e293b;
}

.currency-tag {
  font-size: 0.8rem;
  color: #64748b;
  background-color: #f1f5f9;
  padding: 2px 8px;
  border-radius: 4px;
}

.currency-tag strong {
  color: #0f172a;
}

.manual-card-inputs {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.manual-card-inputs .field-item label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: #334155;
  margin-bottom: 5px;
}

.manual-card-inputs .form-control {
  border: 1px solid var(--border-field);
  border-radius: var(--radius-sm);
}

.input-with-icon {
  position: relative;
}

.input-with-icon .form-control {
  padding-right: 64px;
}

.detected-card-icon {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
}

.visa-mini {
  font-size: 0.8125rem;
  font-weight: 900;
  font-style: italic;
  color: #1a1f71;
  background: #f1f5f9;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--border-field);
}

/* Terms note */
.terms-text {
  font-size: 0.78rem;
  color: #64748b;
  line-height: 1.45;
  margin-bottom: 20px;
}

.terms-text strong {
  color: #0f172a;
}

.legal-link {
  color: #2563eb;
  text-decoration: underline;
}

.legal-link:hover {
  color: #1d4ed8;
}

/* ==========================================================================
   Single Pay Now Button
   ========================================================================== */
.pay-action-wrap {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.btn-pay-now {
  width: 100%;
  height: 52px;
  background: var(--primary-blue);
  color: #ffffff;
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 700;
  border: none;
  border-radius: 9999px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: var(--transition);
  box-shadow: 0 4px 14px rgba(29, 104, 237, 0.35);
  position: relative;
  overflow: hidden;
}

.btn-pay-now:hover:not(:disabled) {
  background: var(--primary-blue-hover);
  box-shadow: 0 6px 18px rgba(29, 104, 237, 0.45);
  transform: translateY(-1px);
}

.btn-pay-now:active:not(:disabled) {
  transform: translateY(0);
}

/* Loading State for Button */
.btn-pay-now.loading {
  background: #1e40af;
  cursor: wait;
  pointer-events: none;
}

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

.btn-pay-now.loading .btn-spinner {
  display: inline-block;
}

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

.ssl-guarantee {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 0.775rem;
  font-weight: 600;
  color: #15803d;
}

/* ==========================================================================
   Toast Notification (Top-Right)
   ========================================================================== */
.toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 9999;
  pointer-events: none;
}

.toast-notification {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  background: #ffffff;
  border: 1px solid #86efac;
  border-left: 5px solid #10b981;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  transform: translateX(120%);
  opacity: 0;
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
  max-width: 380px;
}

.toast-notification.show {
  transform: translateX(0);
  opacity: 1;
}

.toast-icon {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  background-color: #ecfdf5;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.toast-body {
  flex: 1;
}

.toast-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: #065f46;
  margin-bottom: 2px;
}

.toast-desc {
  font-size: 0.8125rem;
  color: #4b5563;
}

.toast-close {
  background: none;
  border: none;
  font-size: 1.25rem;
  line-height: 1;
  color: #9ca3af;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
}

.toast-close:hover {
  color: #4b5563;
}

/* ==========================================================================
   Success Modal (Single Done Button)
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.modal-backdrop.open {
  opacity: 1;
  visibility: visible;
}

.modal-dialog {
  width: 100%;
  max-width: 460px;
  transform: scale(0.92) translateY(12px);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-backdrop.open .modal-dialog {
  transform: scale(1) translateY(0);
}

.modal-card {
  background: #ffffff;
  border-radius: var(--radius-lg);
  padding: 34px 28px;
  box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.25);
  text-align: center;
}

.celebration-animation {
  margin-bottom: 16px;
}

.success-checkmark-circle {
  width: 68px;
  height: 68px;
  margin: 0 auto;
  border-radius: 50%;
  background: #ecfdf5;
  display: flex;
  align-items: center;
  justify-content: center;
}

.checkmark-svg {
  width: 48px;
  height: 48px;
}

.checkmark-circle-bg {
  stroke: #10b981;
  stroke-width: 2;
  stroke-dasharray: 166;
  stroke-dashoffset: 166;
  stroke-miterlimit: 10;
  animation: strokeCircle 0.6s cubic-bezier(0.65, 0, 0.45, 1) forwards;
}

.checkmark-check {
  transform-origin: 50% 50%;
  stroke: #10b981;
  stroke-width: 3.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 48;
  stroke-dashoffset: 48;
  animation: strokeCheck 0.4s cubic-bezier(0.65, 0, 0.45, 1) 0.6s forwards;
}

@keyframes strokeCircle {
  100% {
    stroke-dashoffset: 0;
  }
}

@keyframes strokeCheck {
  100% {
    stroke-dashoffset: 0;
  }
}

.modal-title {
  font-size: 1.4rem;
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 6px;
  letter-spacing: -0.02em;
}

.modal-subtitle {
  font-size: 0.92rem;
  color: #64748b;
  margin-bottom: 22px;
}

.receipt-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-md);
  padding: 16px 18px;
  text-align: left;
  margin-bottom: 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.receipt-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.875rem;
}

.r-label {
  color: #64748b;
}

.r-val {
  font-weight: 600;
  color: #1e293b;
}

.price-highlight {
  font-size: 1.15rem;
  font-weight: 800;
  color: #10b981;
}

.modal-actions {
  display: flex;
  flex-direction: column;
}

.btn-primary-blue {
  width: 100%;
  height: 48px;
  background-color: var(--primary-blue);
  color: #ffffff;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  border: none;
  border-radius: 9999px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: var(--transition);
  box-shadow: 0 2px 6px rgba(29, 104, 237, 0.25);
}

.btn-primary-blue:hover {
  background-color: var(--primary-blue-hover);
  box-shadow: 0 4px 12px rgba(29, 104, 237, 0.35);
}

/* ==========================================================================
   Confetti Canvas
   ========================================================================== */
#confetti-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1001;
}
