/**
 * TiviFlex - Standalone Two-Tone Split Checkout Stylesheet
 * 
 * Strict Brand & Layout Standards:
 * - Desktop: 50/50 Viewport Split (Left #635BFF Blue-Violet, Right #FFFFFF White)
 * - Mobile: Brand-Colored Top (#635BFF), Clean White Lower Area (#FFFFFF)
 * - Visual Flow Mobile: Choose a plan -> Enter details -> Order summary -> Submit
 * - Standalone: Excludes visible header & footer markup
 */

:root {
  --ck-brand: #635BFF;
  --ck-brand-hover: #534AE6;
  --ck-brand-light: #F8F7FF;
  --ck-brand-border: #E5E3FE;
  --ck-text-dark: #0F172A;
  --ck-text-muted: #64748B;
  --ck-border: #E2E8F0;
  --ck-card-radius: 12px;
  --ck-item-radius: 8px;
}

/* ==========================================================================
   RESET & DOCUMENT SCOPE (STANDALONE)
   ========================================================================== */

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body.standalone-checkout-page {
  background-color: #FFFFFF;
  color: var(--ck-text-dark);
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

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

/* ==========================================================================
   DESKTOP 50/50 EQUAL BACKGROUND SPLIT
   ========================================================================== */

.checkout-main-section {
  width: 100%;
  min-height: 100vh;
  background: linear-gradient(to right, #635BFF 50%, #FFFFFF 50%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 0;
  box-sizing: border-box;
}

.checkout-container {
  max-width: 1080px;
  width: 100%;
  margin: 0 auto;
  padding: 0 24px;
  box-sizing: border-box;
}

/* Discreet Checkout Top Language Bar (Desktop right-aligned, Mobile centered) */
.checkout-top-bar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  margin-bottom: 24px;
  width: 100%;
  box-sizing: border-box;
}

.checkout-top-lang-wrap {
  display: inline-flex;
  align-items: center;
}

.checkout-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 48px;
  align-items: start;
  width: 100%;
  box-sizing: border-box;
}

.checkout-selection-col,
.checkout-order-col {
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
}

/* ==========================================================================
   LEFT COLUMN: OVER #635BFF BLUE-VIOLET (FORMULA & SUMMARY)
   ========================================================================== */

.checkout-selection-col {
  display: flex;
  flex-direction: column;
}

.checkout-section-header {
  margin-bottom: 20px;
}

.checkout-main-title {
  font-size: 1.75rem;
  font-weight: 800;
  color: #FFFFFF;
  margin: 0;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

/* Plans White Container */
.checkout-plans-list {
  background: #FFFFFF;
  border-radius: var(--ck-card-radius);
  padding: 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Plan Card */
.checkout-plan-card {
  position: relative;
  background: #FFFFFF;
  border: 1.5px solid var(--ck-border);
  border-radius: var(--ck-item-radius);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.checkout-plan-card:hover:not(.is-selected) {
  border-color: #CBD5E1;
  background-color: #FAFCFF;
}

.checkout-plan-card.is-selected {
  border-color: var(--ck-brand);
  border-width: 2px;
  background-color: var(--ck-brand-light);
}

.checkout-plan-card:focus-visible {
  outline: 2px solid #FFFFFF;
  outline-offset: 2px;
}

/* Popular Badge on 12 months */
.checkout-plan-badge-top {
  position: absolute;
  top: -10px;
  right: 20px;
  z-index: 5;
}

.checkout-badge-popular {
  background: var(--ck-brand);
  color: #FFFFFF;
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 3px 10px;
  border-radius: 20px;
  display: inline-block;
  line-height: 1.2;
}

/* Left side of card (Radio + Details) */
.checkout-plan-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.checkout-radio-indicator {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid #CBD5E1;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s ease;
  background: #FFFFFF;
}

.checkout-radio-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--ck-brand);
  opacity: 0;
  transform: scale(0.4);
  transition: all 0.2s ease;
}

.checkout-plan-card.is-selected .checkout-radio-indicator {
  border-color: var(--ck-brand);
}

.checkout-plan-card.is-selected .checkout-radio-dot {
  opacity: 1;
  transform: scale(1);
}

.checkout-plan-details {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.checkout-plan-duration {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--ck-text-dark);
  line-height: 1.2;
}

.checkout-plan-meta {
  font-size: 0.82rem;
  color: var(--ck-text-muted);
}

/* Right side of card (Price) */
.checkout-plan-price {
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--ck-text-dark);
}

.checkout-plan-card.is-selected .checkout-plan-price {
  color: var(--ck-brand);
}

/* Order Summary Box (Desktop: in Left Column) */
.summary-desktop-slot .checkout-summary-card {
  margin-top: 24px;
  background: #FFFFFF;
  border-radius: var(--ck-card-radius);
  padding: 22px 24px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
}

.checkout-summary-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--ck-brand);
  margin: 0 0 16px;
}

.checkout-summary-items {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.checkout-summary-line,
.checkout-summary-extra-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.95rem;
  color: var(--ck-text-dark);
}

.checkout-summary-extra-line.is-hidden {
  display: none !important;
}

.checkout-summary-line-item {
  font-weight: 500;
}

.checkout-summary-line-val {
  font-weight: 700;
}

.period-unit {
  font-size: 0.85rem;
  font-weight: normal;
  color: var(--ck-text-muted);
}

.checkout-summary-total-wrap {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--ck-border);
}

.checkout-summary-total-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.checkout-total-label {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--ck-text-dark);
}

.checkout-total-value {
  font-size: 1.55rem;
  font-weight: 800;
  color: var(--ck-brand);
}

/* ==========================================================================
   RIGHT COLUMN: OVER #FFFFFF WHITE (BILLING DETAILS FORM)
   ========================================================================== */

.checkout-order-col {
  display: flex;
  flex-direction: column;
}

/* Billing Card Container */
.checkout-billing-card {
  background: #FFFFFF;
  border: 1.5px solid #F1F5F9;
  border-radius: var(--ck-card-radius);
  padding: 28px 32px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.05);
  color-scheme: light;
}

/* Extra Connection Box */
.checkout-extra-card {
  background-color: var(--ck-brand-light);
  border: 1px solid var(--ck-brand-border);
  border-radius: 10px;
  padding: 16px 20px;
  margin-bottom: 22px;
  transition: all 0.2s ease;
}

.checkout-extra-card.is-hidden {
  display: none !important;
}

.checkout-extra-header {
  margin-bottom: 12px;
}

.checkout-extra-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--ck-text-dark);
  margin: 0 0 3px;
}

.checkout-extra-desc {
  font-size: 0.82rem;
  color: var(--ck-text-muted);
  margin: 0;
}

.checkout-extra-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.checkout-extra-rate {
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--ck-text-dark);
}

.checkout-extra-rate-period {
  font-size: 0.88rem;
  color: var(--ck-text-muted);
}

/* Stepper [- 0 +] */
.checkout-stepper {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.checkout-stepper-btn {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  border: 1px solid #CBD5E1;
  background: #FFFFFF;
  color: var(--ck-text-dark);
  font-size: 1.25rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  padding: 0;
}

.checkout-stepper-btn:hover:not(:disabled) {
  border-color: var(--ck-brand);
  color: var(--ck-brand);
}

.checkout-stepper-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.checkout-stepper-val {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--ck-text-dark);
  min-width: 24px;
  text-align: center;
}

/* Form Title */
.checkout-form-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--ck-brand);
  margin: 0 0 20px;
}

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

.checkout-form-label {
  display: block;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--ck-text-dark);
  margin-bottom: 6px;
}

.checkout-required-star {
  color: #EF4444;
}

.checkout-form-input {
  width: 100% !important;
  height: 48px !important;
  padding: 11px 14px !important;
  font-size: 0.95rem !important;
  font-family: inherit !important;
  line-height: 1.5 !important;
  color: #0F172A !important;
  -webkit-text-fill-color: #0F172A !important;
  caret-color: #0F172A !important;
  background-color: #FFFFFF !important;
  background: #FFFFFF !important;
  border: 1.5px solid var(--ck-border, #CBD5E1) !important;
  border-radius: 8px !important;
  box-sizing: border-box !important;
  opacity: 1 !important;
  color-scheme: light !important;
  box-shadow: none !important;
  transition: border-color 0.18s ease, box-shadow 0.18s ease !important;
}

.checkout-form-input:hover {
  border-color: #94A3B8 !important;
}

.checkout-form-input:focus,
.checkout-form-input:focus-visible {
  outline: none !important;
  background-color: #FFFFFF !important;
  background: #FFFFFF !important;
  color: #0F172A !important;
  -webkit-text-fill-color: #0F172A !important;
  caret-color: #635BFF !important;
  border-color: #635BFF !important;
  box-shadow: 0 0 0 3px rgba(99, 91, 255, 0.18) !important;
}

.checkout-form-input::placeholder {
  color: #94A3B8 !important;
  -webkit-text-fill-color: #94A3B8 !important;
  opacity: 1 !important;
}

.checkout-form-input::selection {
  background-color: #C7D2FE !important;
  color: #0F172A !important;
}

/* --- Browser Autofill Handling (Standard & Vendor - No Animation Hacks) --- */
.checkout-form-input:autofill {
  color: #0F172A !important;
  -webkit-text-fill-color: #0F172A !important;
  caret-color: #0F172A !important;
  border-color: #93C5FD !important;
  box-shadow: 0 0 0 1000px #EFF6FF inset !important;
}

.checkout-form-input:autofill:focus {
  color: #0F172A !important;
  -webkit-text-fill-color: #0F172A !important;
  caret-color: #635BFF !important;
  border-color: #635BFF !important;
  box-shadow: 0 0 0 1000px #FFFFFF inset, 0 0 0 3px rgba(99, 91, 255, 0.18) !important;
}

.checkout-form-input:-webkit-autofill,
.checkout-form-input:-webkit-autofill:hover {
  color: #0F172A !important;
  -webkit-text-fill-color: #0F172A !important;
  caret-color: #0F172A !important;
  border-color: #93C5FD !important;
  -webkit-box-shadow: 0 0 0 1000px #EFF6FF inset !important;
  box-shadow: 0 0 0 1000px #EFF6FF inset !important;
}

.checkout-form-input:-webkit-autofill:focus {
  color: #0F172A !important;
  -webkit-text-fill-color: #0F172A !important;
  caret-color: #635BFF !important;
  border-color: #635BFF !important;
  -webkit-box-shadow: 0 0 0 1000px #FFFFFF inset, 0 0 0 3px rgba(99, 91, 255, 0.18) !important;
  box-shadow: 0 0 0 1000px #FFFFFF inset, 0 0 0 3px rgba(99, 91, 255, 0.18) !important;
}

/* --- Validation & Error States --- */
.checkout-field-error {
  display: none;
  font-size: 0.8rem;
  font-weight: 600;
  color: #DC2626;
  margin-top: 5px;
}

.checkout-form-group.has-error .checkout-form-input {
  border-color: #DC2626 !important;
  background-color: #FEF2F2 !important;
  color: #0F172A !important;
  -webkit-text-fill-color: #0F172A !important;
}

.checkout-form-group.has-error .checkout-form-input:focus {
  border-color: #DC2626 !important;
  background-color: #FFFFFF !important;
  color: #0F172A !important;
  -webkit-text-fill-color: #0F172A !important;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.2) !important;
}

.checkout-form-group.has-error .checkout-field-error {
  display: block;
}

.checkout-email-contact-note {
  font-size: 0.82rem;
  color: var(--ck-text-muted);
  margin: 12px 0 18px;
  line-height: 1.4;
}

/* Mobile Slot for Order Summary (hidden on desktop) */
.summary-mobile-slot {
  display: none;
}

/* Submit Button */
.checkout-submit-btn {
  width: 100%;
  height: 48px;
  background: var(--ck-brand);
  color: #FFFFFF;
  border: none;
  border-radius: 6px;
  font-size: 0.95rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
  box-shadow: 0 4px 14px rgba(99, 91, 255, 0.28);
}

.checkout-submit-btn:hover:not(:disabled) {
  background: var(--ck-brand-hover);
  box-shadow: 0 6px 18px rgba(99, 91, 255, 0.38);
  transform: translateY(-1px);
}

.checkout-submit-btn:active:not(:disabled) {
  transform: translateY(0);
}

.checkout-submit-btn:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.checkout-reassurance-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px 14px;
  margin-top: 12px;
  font-size: 0.74rem;
  color: var(--ck-text-muted);
  flex-wrap: wrap;
  width: 100%;
  box-sizing: border-box;
  text-align: center;
}

.checkout-reassurance-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: normal;
  font-size: clamp(0.68rem, 2.4vw, 0.74rem);
  line-height: 1.35;
}

.checkout-reassurance-item i {
  color: var(--ck-brand);
  font-size: 0.76rem;
  flex-shrink: 0;
}

/* Feedback Box */
.checkout-demo-alert {
  display: none;
  padding: 14px 18px;
  border-radius: 8px;
  font-size: 0.88rem;
  margin-top: 18px;
  background-color: #F0FDF4;
  border: 1px solid #BBF7D0;
  color: #166534;
}

.checkout-demo-alert.is-visible {
  display: block;
}

.checkout-demo-alert-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  margin-bottom: 8px;
}

.checkout-demo-details-list {
  margin: 8px 0 0;
  padding-left: 20px;
  font-size: 0.82rem;
  line-height: 1.5;
}

/* ==========================================================================
   MOBILE LAYOUT: PLANS FIRST, FORM DIRECTLY BELOW (<= 900px)
   ========================================================================== */

@media (max-width: 900px) {
  .checkout-main-section {
    background: #FFFFFF;
    padding: 0;
    min-height: 100vh;
    display: block;
    width: 100%;
    box-sizing: border-box;
  }

  .checkout-container {
    padding: 0;
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
  }

  /* Compact Centered Language Bar on Mobile - No Exit Links */
  .checkout-top-bar {
    display: flex;
    justify-content: center;
    align-items: center;
    background: #FFFFFF;
    padding: 12px 14px;
    margin: 0;
    width: 100%;
    box-sizing: border-box;
  }

  .checkout-top-lang-wrap {
    width: 100%;
    display: flex;
    justify-content: center;
  }

  .checkout-grid {
    display: flex;
    flex-direction: column;
    gap: 0;
    width: 100%;
    box-sizing: border-box;
  }

  /* 1. Top Section: Blue-Violet Background (#635BFF) with Centered Plans */
  .checkout-selection-col {
    background-color: var(--ck-brand);
    padding: 22px 16px 20px;
    width: 100%;
    box-sizing: border-box;
  }

  .checkout-selection-col .checkout-main-title {
    font-size: clamp(1.35rem, 5vw, 1.55rem);
    color: #FFFFFF;
    margin: 0 auto 16px;
    max-width: 460px;
    width: 100%;
    text-align: center; /* Centered on mobile */
    line-height: 1.25;
  }

  .checkout-plans-list {
    max-width: 460px;
    width: 100%;
    margin: 0 auto;
    padding: 12px;
    gap: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    box-sizing: border-box;
  }

  .checkout-plan-card {
    padding: 12px 14px;
  }

  .checkout-plan-duration {
    font-size: 1rem;
  }

  .checkout-plan-price {
    font-size: 1.35rem;
  }

  /* Desktop slot hidden on mobile */
  .summary-desktop-slot {
    display: none;
  }

  /* 2. Lower Section: Clean White Background with Billing Form */
  .checkout-order-col {
    background-color: #FFFFFF;
    padding: 18px 16px 24px;
    width: 100%;
    box-sizing: border-box;
  }

  .checkout-billing-card {
    max-width: 460px;
    width: 100%;
    margin: 0 auto;
    padding: 20px 18px 16px;
    border: 1px solid var(--ck-border);
    box-shadow: none;
    box-sizing: border-box;
  }

  .checkout-extra-card {
    padding: 14px 16px;
    margin-bottom: 18px;
    box-sizing: border-box;
  }

  .checkout-form-title {
    font-size: 1.2rem;
    margin-bottom: 16px;
  }

  /* 3. Mobile Slot: Compact Order Summary inside Form above button */
  .summary-mobile-slot {
    display: block;
    margin: 14px 0 12px;
    width: 100%;
    box-sizing: border-box;
  }

  .summary-mobile-slot .checkout-summary-card {
    background: #F8FAFC;
    border: 1px solid var(--ck-border);
    border-radius: 8px;
    padding: 14px 16px;
    margin: 0;
    box-shadow: none;
    box-sizing: border-box;
  }

  .summary-mobile-slot .checkout-summary-title {
    font-size: 1.05rem;
    margin: 0 0 10px;
  }

  .summary-mobile-slot .checkout-summary-line {
    font-size: 0.88rem;
  }

  .summary-mobile-slot .checkout-summary-total-wrap {
    margin-top: 10px;
    padding-top: 10px;
  }

  .summary-mobile-slot .checkout-total-label {
    font-size: 1.05rem;
  }

  .summary-mobile-slot .checkout-total-value {
    font-size: 1.35rem;
  }

  .checkout-reassurance-row {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px 12px;
    margin-top: 12px;
    width: 100%;
    box-sizing: border-box;
    text-align: center;
  }

  .checkout-reassurance-item {
    font-size: clamp(0.66rem, 2.5vw, 0.72rem);
    white-space: normal;
    line-height: 1.3;
    gap: 4px;
  }

  .checkout-reassurance-item i {
    font-size: 0.72rem;
  }
}

@media (max-width: 400px) {
  .checkout-billing-card {
    padding: 16px 14px 14px;
  }

  .checkout-plans-list {
    padding: 10px;
  }

  .checkout-plan-card {
    padding: 10px 12px;
  }

  .checkout-extra-card {
    padding: 12px 12px;
  }

  .checkout-top-bar {
    padding: 10px 8px;
  }
}

@media (max-width: 340px) {
  .checkout-selection-col {
    padding: 18px 10px 16px;
  }

  .checkout-order-col {
    padding: 14px 10px 20px;
  }

  .checkout-plan-card {
    padding: 10px 8px;
  }

  .checkout-plan-price {
    font-size: 1.2rem;
  }
}
