/* =========================================
   LAYOUT & STRUCTURAL CSS
========================================= */
body {
    margin: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh; 
}

header {
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--color-neutral-gray);
    background-color: var(--color-neutral-white);
}

.header-left img {
    height: 65px; 
    width: auto;
    display: block;
}

.header-logo-link {
    display: inline-block;
    text-decoration: none;
    line-height: 0;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.flag-dropdown {
    position: relative;
    display: inline-block;
}

/* Compact, flag-led trigger (matches genac.com's flag selector feel) */
.flag-btn {
    background-color: var(--color-neutral-white);
    border: 1px solid var(--form-border-default);
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    transition: border-color 0.2s ease, background-color 0.2s ease;
}

.flag-btn:hover {
    border-color: var(--color-brand-green);
}

.flag-dropdown.is-open .flag-btn {
    border-color: var(--form-border-focus);
}

.flag-icon {
    width: 24px;
    height: auto;
    border-radius: 2px;
    display: block;
}

.dropdown-arrow {
    font-size: 0.65rem;
    color: var(--color-gray-500);
    transition: transform 0.2s ease;
}

.flag-dropdown.is-open .dropdown-arrow {
    transform: rotate(180deg);
}

.dropdown-content {
    display: none;
    position: absolute;
    right: 0; 
    top: 100%;
    background-color: var(--color-neutral-white);
    min-width: 72px;
    border: 1px solid var(--color-neutral-gray);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    border-radius: 6px;
    overflow: hidden;
    z-index: 30;
    margin-top: 8px;
    padding: 0;
}

/* Flag-only rows, centered (matches genac.com's flag selector) */
.dropdown-content a {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 12px;
    text-decoration: none;
    transition: background-color 0.15s ease;
}

/* Hovered / selected row uses a solid blue highlight, like genac.com */
.dropdown-content a:hover,
.dropdown-content a.is-selected {
    background-color: #2f6fed;
}

.flag-dropdown.is-open .dropdown-content {
    display: block;
}

.menu-icon {
    cursor: pointer;
    width: 28px;
    height: 28px;
}

/* =========================================
   HAMBURGER BUTTON & NAV MENU
========================================= */
.hamburger-btn {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-menu {
    max-height: 0;
    overflow: hidden;
    background-color: var(--color-neutral-white);
    border-bottom: 1px solid var(--color-neutral-gray);
    transition: max-height 0.3s ease;
}

.nav-menu.is-open {
    max-height: 300px;
}

.nav-menu-list {
    list-style: none;
    margin: 0;
    padding: 1rem 2rem;
}

.nav-menu-list li {
    margin-bottom: 1rem;
}

.nav-menu-list li:last-child {
    margin-bottom: 0;
}

.nav-menu-link {
    text-decoration: none;
    display: block;
    padding: 0.5rem 0;
    font-weight: var(--font-weight-semi-bold);
    transition: color 0.2s ease;
}

.nav-menu-link:hover {
    color: var(--color-brand-green) !important;
}

main {
    flex: 1; 
    padding: var(--section-spacing) var(--main-padding);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.content-wrapper {
    width: 100%;
    max-width: 1008px;
    display: flex;
    flex-direction: column;
}

h1 {
    margin-bottom: 2rem;
    text-align: left;
}

.form-card {
    background-color: var(--color-neutral-white);
    padding: var(--card-padding);
    border-radius: var(--card-radius);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    width: 100%;
    box-sizing: border-box; 
}

.input-group {
    margin-bottom: 2rem;
}

.input-group:last-child {
    margin-bottom: 0;
}

.form-card label {
    display: block;
    margin-bottom: 0.75rem;
    font-weight: var(--font-weight-bold);
}

input {
    width: 100%;
    padding: 1rem;
    border: 1px solid var(--color-neutral-gray);
    border-radius: 8px;
    box-sizing: border-box;
    background-color: var(--color-neutral-white);
    color: var(--color-neutral-charcoal);
}

input::placeholder {
    color: var(--color-neutral-medium-light-gray);
}

input:focus {
    outline: none;
    border-color: var(--color-brand-green);
}

.button-container {
    display: flex;
    justify-content: flex-end;
    margin-top: 2rem;
}

button.btn-primary {
    background-color: var(--color-green-500); 
    color: var(--color-neutral-white);
    border: none;
    padding: 1rem 2.5rem;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: background-color 0.3s ease, transform 0.1s ease;
}

button.btn-primary:hover {
    background-color: var(--color-green-600); 
}

button.btn-primary:active {
    transform: translateY(1px);
}

button.btn-inactive {
    background-color: var(--color-green-100); 
    color: var(--color-neutral-white);
    cursor: not-allowed;
    box-shadow: none;
}

button.btn-inactive:hover {
    background-color: var(--color-green-100); 
    transform: none; 
}

footer {
    background-color: var(--color-gray-900);
    color: var(--color-neutral-white);
    padding: 1.25rem 2rem;
    display: flex;
    justify-content: center;
    align-items: center;
}

.footer-links {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.footer-link {
    color: var(--color-neutral-white);
    text-decoration: none;
    transition: opacity 0.2s ease;
}

.footer-link:hover {
    opacity: 0.8;
}

.footer-divider {
    color: var(--color-gray-500);
    user-select: none;
}

@media (max-width: 768px) {
    footer {
        padding: 1rem;
    }
    .footer-links {
        gap: 1.5rem;
    }
}


/* =========================================
   RADIO CARDS & BADGES
========================================= */
.radio-group-label {
    display: block;
    margin-bottom: 1rem;
    font-weight: var(--font-weight-bold);
}

.required-asterisk {
    color: #E74C3C; 
    margin-left: 2px;
}

.form-card label.radio-card {
    display: flex;
    flex-direction: row; /* Forces side-by-side layout */
    align-items: flex-start; /* Aligns the circle to the top of the text block */
    padding: 1.25rem 1.5rem;
    border: 1px solid var(--color-neutral-gray);
    border-radius: 8px;
    margin-bottom: 1rem;
    cursor: pointer;
    transition: border-color 0.2s ease, background-color 0.2s ease;
    background-color: var(--color-neutral-white);
    font-weight: normal; /* Removes the bolding inherited from standard labels */
}
.form-card label.radio-card:last-child {
    margin-bottom: 0;
}

.form-card label.radio-card:hover {
    border-color: var(--color-brand-green);
    background-color: var(--color-neutral-warm-white);
}

/* --- NEW EXACT CUSTOM RADIO BUTTON STYLES --- */

/* 1. The Outer Circle */
.radio-card input[type="radio"] {
    appearance: none; 
    -webkit-appearance: none;
    box-sizing: border-box;
    width: 16px; 
    height: 16px;
    padding: 0; 
    border: 1px solid var(--color-neutral-medium-gray);
    border-radius: 50%;
    margin: 0; 
    margin-top: 0.25rem; /* Nudges it down slightly to center with the heading text */
    margin-right: 1rem; /* Creates the space between the circle and the text */
    cursor: pointer;
    position: relative;
    background-color: var(--color-neutral-white);
    flex-shrink: 0; 
    outline: none;
}

/* Change outer border to green when selected */
.radio-card input[type="radio"]:checked {
    border-color: var(--color-brand-green);
}

/* 2. The Inner Circle (8x8px) */
.radio-card input[type="radio"]:checked::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%); 
    width: 8px; /* Slightly smaller for a crisp inner dot */
    height: 8px;
    background-color: var(--color-brand-green);
    border-radius: 50%;
}

/* 3. Style the parent card when the radio inside is checked */
.radio-card:has(input[type="radio"]:checked) {
    border-color: var(--color-brand-green);
    background-color: var(--color-neutral-white);
}

/* --- INLINE RADIO OPTIONS (e.g. Yes / No question) --- */
.radio-inline {
    display: flex;
    align-items: center;
    margin-bottom: 0.75rem;
    cursor: pointer;
    font-weight: normal;
}
.radio-inline:last-child {
    margin-bottom: 0;
}

.radio-inline input[type="radio"] {
    appearance: none;
    -webkit-appearance: none;
    box-sizing: border-box;
    width: 16px;
    height: 16px;
    padding: 0;
    border: 1px solid var(--color-neutral-medium-gray);
    border-radius: 50%;
    margin: 0;
    margin-right: 0.75rem;
    cursor: pointer;
    position: relative;
    background-color: var(--color-neutral-white);
    flex-shrink: 0;
    outline: none;
}

.radio-inline input[type="radio"]:checked {
    border-color: var(--color-brand-green);
}

.radio-inline input[type="radio"]:checked::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 8px;
    height: 8px;
    background-color: var(--color-brand-green);
    border-radius: 50%;
}

/* ------------------------------------------- */

.radio-card-content {
    flex: 1; 
}

.radio-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.25rem;
}

.radio-card-title {
    margin: 0;
    font-weight: var(--font-weight-bold);
}

.radio-card-desc {
    margin: 0;
    color: var(--color-neutral-dark-gray);
}

.badge-recommended {
    background-color: var(--color-green-50);
    color: var(--color-green-700); 
    padding: 0.25rem 0.75rem;
    border-radius: 50px;
    white-space: nowrap;
    margin-left: 1rem; 
}

/* Wrapper around the badge pill. Lets the pill hug its text while the wrapper
   controls placement within the radio-card (right on desktop, full-width line
   on tablet/mobile). */
.badge-recommended-row {
    display: flex;
    align-items: flex-start;
}

.badge-recommended-row .badge-recommended {
    margin-left: 0;
}

/* The badge sits in a wrapper (.badge-recommended-row) that is a direct child
   of .radio-card, before the input in the DOM. On desktop/small-laptop the
   wrapper is pushed to the far right of the row, top-aligned. */
.radio-card.has-badge .badge-recommended-row {
    order: 3;
    margin-left: auto;
}


/* =========================================
   TWO-COLUMN FORM GRID
========================================= */
/* Allows the wrapper to expand for two columns on desktop */
.wrapper-xl { 
    max-width: 1300px; 
}

/* CHANGED: .payment-grid is now .form-grid */
.form-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    width: 100%;
}

@media (min-width: 900px) {
    .form-grid {
        gap: 3rem; /* 48px gap between columns */
    }
    
    /* Modifier class for the exact 1.4 ratio from Figma */
    .grid-payment { 
        grid-template-columns: 1.4fr 1fr; 
    }
}

.section-title {
    margin-top: 0;
    margin-bottom: 1.25rem;
}

/* CHANGED: Automatically spaces multiple cards inside ANY grid column */
.form-grid > div > .form-card {
    margin-bottom: 2.5rem;
}

.form-grid > div > .form-card:last-child {
    margin-bottom: 0;
}

/* Side-by-side inputs (e.g., CVV and Expiration Date) */
.input-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    /* Keep both inputs on the same line even when one label wraps to two
       lines (e.g. "Expiration Date (MM/YY)" on narrow screens). */
    align-items: end;
}

/* Each field in the row is a flex column so its input sits at the bottom,
   letting a taller (wrapped) label grow upward without shifting the input. */
.input-row .input-group {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    margin-bottom: 0;
}

/* =========================================
   SELECT MENUS & FLOATING LABELS
========================================= */
/* Standard Select */
select.standard-select {
    width: 100%;
    padding: 1rem;
    border: 1px solid var(--color-neutral-gray);
    border-radius: 8px;
    box-sizing: border-box;
    background-color: var(--color-neutral-white);
    color: var(--color-neutral-charcoal);
    appearance: none;
    -webkit-appearance: none;
    /* Custom chevron icon */
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="%23888888" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M6 9l6 6 6-6"/></svg>');
    background-repeat: no-repeat;
    background-position: right 1rem center;
    cursor: pointer;
}

/* Floating Label Outline (For "Select Country") */
.floating-outline-group {
    position: relative;
    margin-top: 0.5rem;
    margin-bottom: 2rem;
}

.floating-outline-group label {
    position: absolute;
    top: -0.6rem;
    left: 1rem;
    background: var(--color-neutral-white);
    padding: 0 0.4rem;
    color: var(--color-neutral-medium-gray);
    z-index: 1;
}

.custom-select-wrapper {
    position: relative;
    border: 1px solid var(--color-brand-green); 
    border-radius: 8px;
    display: flex;
    align-items: center;
    padding-left: 1rem;
    background-color: var(--color-neutral-white);
}

.inline-flag {
    width: 24px;
    height: auto;
    border-radius: 2px;
    margin-right: 0.5rem;
}

.custom-select {
    flex: 1;
    border: none;
    background: transparent;
    padding: 1rem 1rem 1rem 0;
    appearance: none;
    -webkit-appearance: none;
    color: var(--color-neutral-charcoal);
    cursor: pointer;
    outline: none;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="%23888888" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M6 9l6 6 6-6"/></svg>');
    background-repeat: no-repeat;
    background-position: right 1rem center;
}

/* =========================================
   FOOTER BUTTONS
========================================= */
.button-footer {
    grid-column: 1 / -1; 
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 1.5rem;
    margin-top: 1rem;
}

.btn-text {
    background: none;
    border: none;
    color: var(--color-neutral-charcoal);
    cursor: pointer;
    font-weight: var(--font-weight-bold);
    padding: 0.5rem 1rem;
    transition: color 0.2s ease;
}

.btn-text:hover {
    color: var(--color-brand-green);
}




/* =========================================
   RECEIPT & SUMMARY CARDS
========================================= */
/* Utility Classes */
.text-center { text-align: center; }
.text-right { text-align: right; }
.mb-2 { margin-bottom: 2rem; }

/* Success Icon Wrapper */
.success-icon-wrapper {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 48px;
    height: 48px;
    background-color: var(--color-brand-green);
    border-radius: 50%;
    margin-bottom: 1rem;
    color: var(--color-neutral-white);
}

/* 2x2 Data Grid */
.summary-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.summary-item label {
    display: block;
    color: var(--color-neutral-medium-gray);
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
    font-weight: normal;
}

.summary-item p {
    margin: 0;
    font-weight: var(--font-weight-bold);
    color: var(--color-neutral-charcoal);
}

/* Dashed horizontal divider */
.dashed-divider {
    border: none;
    border-top: 1px dashed var(--color-neutral-medium-light-gray);
    margin: 2rem 0;
}

/* Receipt Line Items */
.summary-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1rem;
    color: var(--color-neutral-dark-gray);
}

.summary-total {
    font-weight: var(--font-weight-bold);
    color: var(--color-neutral-charcoal);
    font-size: 1.125rem;
    margin-top: 1.5rem;
    margin-bottom: 2.5rem;
}

/* Green Inline Links */
.link-green-italic {
    color: var(--color-brand-green);
    text-decoration: underline;
    font-weight: var(--font-weight-bold);
    font-style: italic;
}

/* Action Card (Text Left, Button Right) */
.action-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2rem;
}

.action-card-text h3 {
    margin-top: 0;
    margin-bottom: 0.5rem;
}
    
.action-card-text p {
    margin: 0;
    color: var(--color-neutral-dark-gray);
}

.btn-with-icon {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
}

/* Receipt page responsive adjustments (Mobile <= 767px).
   The Transaction Summary grid stays 2 columns with the right column still
   right-aligned; the action card stacks (text above the button) but the
   Download button keeps its natural width. */
@media (max-width: 767px) {
    .action-card {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* =========================================
   CONFIRMATION & SUMMARY LAYOUTS
========================================= */
.confirmation-box {
    border: 1px solid var(--color-accent-links-teal);
    border-radius: 8px;
    padding: 24px 16px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 24px;
}

.confirmation-box p {
    line-height: 160%;
    margin: 0 !important;
}

.payment-option-col {
    width: 180px;
    text-align: left;
    flex-shrink: 0;
    white-space: nowrap;
}

.fees-section-padded {
    padding: 0 81px 0 49px;
}

.fees-section-padded .summary-row {
    margin-bottom: 8px;
}

.fees-section-padded .summary-row span:last-child {
    text-align: right;
    white-space: nowrap;
}

.fees-divider {
    border: none !important;
    border-top: 1px dashed #E0E0E0 !important;
    margin: 16px 0 !important;
}

/* =========================================
   SELECT AMOUNT FORM LAYOUTS
========================================= */
.policy-item-wrapper {
    position: relative;
    width: 100%;
    max-width: 750px;
}

.policy-item-select {
    width: 100%;
    height: 54px;
    padding: 16px 60px 16px 24px;
    border-radius: 8px;
    border: 1px solid var(--color-neutral-gray);
    background-color: transparent;
    appearance: none;
    -webkit-appearance: none;
    box-sizing: border-box;
}

.select-chevron {
    position: absolute;
    right: 24px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
}

.form-card .payment-option-row {
    display: flex;
    align-items: flex-start;
    cursor: pointer;
}

.payment-option-row > div {
    flex: 1;
}

.payment-radio-input {
    width: auto;
    padding: 0;
    border: none;
    background: none;
    margin: 4px 8px 0 0;
    flex-shrink: 0;
}

.custom-amount-wrapper {
    margin-top: 8px;
    position: relative;
}

.custom-amount-currency {
    position: absolute;
    left: 0;
    top: 0.5rem;
    pointer-events: none;
}

.custom-amount-input {
    width: 100%;
    max-width: 350px;
    border: none;
    border-bottom: 1px solid var(--color-neutral-charcoal);
    border-radius: 0;
    padding: 0.5rem 0 0.5rem 1rem;
    background: transparent;
    outline: none;
}

/* =========================================
   SPECIFIC MARGIN/PADDING UTILITIES
========================================= */
.mb-0_25 { margin-bottom: 0.25rem !important; }
.mb-0_5 { margin-bottom: 0.5rem !important; }
.my-1_5 { margin: 1.5rem 0 !important; }
.pl-1 { padding-left: 8px !important; }

/* =========================================
   SELECT AMOUNT - RADIO OVERRIDES
========================================= */
#payment-options input[type="radio"] {
    appearance: none;
    -webkit-appearance: none;
    width: 16px !important;
    height: 16px !important;
    min-width: 16px !important;
    max-width: 16px !important;
    min-height: 16px !important;
    max-height: 16px !important;
    padding: 0 !important;
    border-radius: 50%;
    border: 2px solid #aaaaaa;
    background-color: var(--color-neutral-white);
    cursor: pointer;
    display: inline-block;
    vertical-align: middle;
    flex-shrink: 0;
    box-sizing: border-box;
    transition: border-color 0.15s, background-color 0.15s, box-shadow 0.15s;
}

#payment-options input[type="radio"]:checked {
    background-color: var(--color-green-500);
    border: 2px solid var(--color-neutral-white);
    box-shadow: 0 0 0 2px var(--color-green-500);
}

#payment-options input[type="radio"]:focus {
    outline: none;
    border-color: #aaaaaa;
}


/* =========================================
   FORM STATE CLASSES
========================================= */

/* Default state */
input,
select.standard-select,
textarea {
    border: 1px solid var(--form-border-default);
    transition: border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}

input::placeholder,
textarea::placeholder {
    color: var(--form-text-placeholder);
}

/* Focus state */
input:focus,
select.standard-select:focus,
textarea:focus,
input.is-focus,
select.is-focus,
textarea.is-focus {
    border-color: var(--form-border-focus);
    outline: none;
    box-shadow: none;
}

/* Active state - field has valid content */
input.is-active,
select.is-active,
textarea.is-active {
    border-color: var(--form-border-default);
    background-color: var(--color-neutral-white);
}

/* Uneditable / disabled state */
input.is-uneditable,
select.is-uneditable,
textarea.is-uneditable,
input[disabled],
select[disabled],
textarea[disabled] {
    background-color: var(--form-bg-uneditable);
    border-color: var(--form-border-default);
    color: var(--text-tertiary);
    cursor: not-allowed;
}

/* Error / Required validation state */
input.input-error,
select.input-error,
textarea.input-error {
    border-color: var(--form-border-error);
    background-color: var(--form-bg-error-fill);
}

/* Validation message below field */
.validation-message {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin-top: 4px; /* 4px vertical gap between field and validation text */
    color: var(--color-error-hex);
    font-size: 0.75rem; /* 12px */
    font-weight: var(--font-weight-semi-bold);
}

.validation-message .validation-icon {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

/* Inline field error text (Django form errors + JS-rendered messages) */
.error-text {
    display: block;
    margin-top: 4px; /* 4px vertical gap between field and validation text */
    color: var(--color-error-hex);
    font-size: 0.75rem; /* 12px */
    font-weight: var(--font-weight-semi-bold);
}

/* Django renders form errors as a <ul class="errorlist">; keep them inline-styled */
.error-text ul,
ul.errorlist {
    list-style: none;
    margin: 0;
    padding: 0;
}

/* Error icon inside field (absolute positioned) */
.input-group-with-icon {
    position: relative;
}

.input-group-with-icon .field-icon-right {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: var(--color-error-hex);
    pointer-events: none;
}

/* Field wrapper for inline error icon (payment page) */
.field-wrap {
    position: relative;
}

.field-wrap .field-error-icon {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-error-hex);
    font-size: 1.125rem;
    display: none;
    pointer-events: none;
}

.field-wrap .field-error-icon.is-visible {
    display: block;
}

/* Leave room for the error icon so text doesn't sit under it */
.field-wrap input.input-error {
    padding-right: 2.75rem;
}

/* Success fill (for valid states if needed) */
input.is-success,
select.is-success {
    background-color: var(--form-bg-success-fill);
    border-color: var(--form-active);
}

/* =========================================
   BUTTON STATES - LOADING & DISABLED
========================================= */
button.btn-primary.btn-loading {
    background-color: var(--color-green-100);
    color: var(--color-green-700);
    cursor: wait;
    pointer-events: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

button.btn-primary.btn-loading::before {
    content: '';
    width: 16px;
    height: 16px;
    border: 2px solid var(--color-green-700);
    border-top-color: transparent;
    border-radius: 50%;
    animation: btn-spin 0.6s linear infinite;
}

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

button.btn-primary.btn-disabled,
button.btn-primary[disabled] {
    background-color: var(--form-disabled-btn);
    color: var(--color-neutral-white);
    cursor: not-allowed;
    box-shadow: none;
}

button.btn-primary.btn-disabled:hover,
button.btn-primary[disabled]:hover {
    background-color: var(--form-disabled-btn);
    transform: none;
}

/* =========================================
   RESPONSIVE LAYOUT OVERRIDES
========================================= */

/* Utility: hidden */
.d-none { display: none !important; }
.d-block { display: block !important; }

/* Utility: margin-top */
.mt-1 { margin-top: 1rem !important; }
.mt-2 { margin-top: 2rem !important; }
.mb-1 { margin-bottom: 1rem !important; }
.mb-3 { margin-bottom: 3rem !important; }
.m-0 { margin: 0 !important; }
.mt-0 { margin-top: 0 !important; }

/* =========================================
   FADE ANIMATIONS (for quick-pay reveals)
========================================= */
.fade-section {
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    margin: 0;
    transition: opacity 0.25s ease, max-height 0.3s ease;
    pointer-events: none;
}

/* A collapsed fade-section must not contribute any spacing (its child
   input-group's margin would otherwise leak out and push content down,
   creating a phantom gap at the top of the card). */
.fade-section:not(.is-visible) > .input-group {
    margin: 0;
}

.fade-section.is-visible {
    opacity: 1;
    max-height: 1000px;
    pointer-events: auto;
}

/* 24px gap between the Policy Number field and "Choose how you want to pay" */
#qp-payment-method.is-visible {
    margin-top: 24px;
}


/* =========================================
   INFO ICON & TOOLTIP
========================================= */
.info-icon-wrapper {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    /* Sit at the top-right of the last letter, like a superscript */
    vertical-align: super;
    cursor: pointer;
    outline: none;
    /* Enlarge the hover hit-area*/
    padding: 0.5rem;
    margin-top: -0.5rem;
    margin-bottom: -0.5rem;
    margin-right: -0.5rem;
    margin-left: -0.45rem;
}

.info-icon-btn {
    color: #000000;
    font-size: 0.625rem;
    transition: color 0.2s ease;
}

.info-icon-wrapper:hover .info-icon-btn,
.info-icon-wrapper:focus .info-icon-btn {
    color: var(--color-brand-green);
}

/* Inline tooltip that expands in flow (pushes the input below it down) */
.info-tooltip {
    position: relative;
    max-width: 340px;
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    padding: 0 1.5rem;
    margin: 0;
    background-color: #3FD08F1A; /* Green-400 at 10% */
    color: var(--text-primary);
    border: 1px solid var(--color-brand-green); /* #3CB371 */
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    transition: max-height 0.25s ease, opacity 0.2s ease, padding 0.25s ease, margin 0.25s ease;
}

.info-tooltip.is-visible {
    max-height: 320px;
    opacity: 1;
    padding: 1.25rem 1.5rem;
    margin: 0.75rem 0 1rem;
}

/* Up-pointing arrow toward the info icon above (green border + tinted fill) */
.info-tooltip::before {
    content: '';
    position: absolute;
    left: 24px;
    top: -8px;
    border-width: 0 8px 8px 8px;
    border-style: solid;
    border-color: transparent transparent var(--color-brand-green) transparent;
}

.info-tooltip::after {
    content: '';
    position: absolute;
    left: 25px;
    top: -6px;
    border-width: 0 7px 7px 7px;
    border-style: solid;
    border-color: transparent transparent #3FD08F1A transparent; /* Green-400 at 10% */
}

.info-tooltip-title {
    margin: 0 0 0.5rem;
    font-weight: var(--font-weight-semi-bold);
    font-size: 1.125rem;
    line-height: 1.3;
    color: var(--text-primary);
}

.info-tooltip-body {
    margin: 0;
    font-size: 0.875rem;
    line-height: 1.5;
    font-weight: var(--font-weight-semi-bold);
    color: var(--text-secondary);
}


/* =========================================
   CUSTOM DROPDOWN (matches Figma, light-green hover)
========================================= */
.custom-dropdown {
    position: relative;
    width: 100%;
}

.custom-dropdown-trigger {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    border: 1px solid var(--form-border-default);
    border-radius: 8px;
    background-color: var(--color-neutral-white);
    color: var(--color-neutral-charcoal);
    cursor: pointer;
    text-align: left;
    font-family: var(--font-family-base);
    transition: border-color 0.2s ease;
}

.custom-dropdown-trigger:focus,
.custom-dropdown.is-open .custom-dropdown-trigger {
    outline: none;
    border-color: var(--form-border-focus);
}

.custom-dropdown-value {
    flex: 1;
}

.custom-dropdown-value.is-placeholder {
    color: var(--form-text-placeholder);
}

.custom-dropdown-chevron {
    color: var(--color-gray-500);
    font-size: 0.8rem;
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.custom-dropdown.is-open .custom-dropdown-chevron {
    transform: rotate(180deg);
}

.custom-dropdown-menu {
    list-style: none;
    margin: 0.5rem 0 0;
    padding: 0.5rem 0;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 30;
    background-color: var(--color-neutral-white);
    border: 1px solid var(--color-neutral-gray);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    max-height: 340px;
    overflow-y: auto;
    display: none;
}

.custom-dropdown.is-open .custom-dropdown-menu {
    display: block;
}

.custom-dropdown-option {
    padding: 0.85rem 1rem;
    cursor: pointer;
    color: var(--color-neutral-charcoal);
    transition: background-color 0.15s ease;
}

.custom-dropdown-option:hover,
.custom-dropdown-option.is-highlighted {
    background-color: var(--color-green-50);
}

.custom-dropdown-option.is-selected {
    background-color: var(--color-green-50);
    font-weight: var(--font-weight-semi-bold);
}

/* Allow popovers (dropdown menu, info tooltip) to overflow visible sections without clipping */
.fade-section.is-visible {
    overflow: visible;
}


/* =========================================
   VERIFY POLICY CARD (more spacious, matches Figma)
========================================= */
.verify-card {
    padding-top: 3.25rem;
    padding-bottom: 3.25rem;
}

.verify-card .input-group {
    margin-bottom: 1.75rem;
}

.verify-card .input-group:last-child {
    margin-bottom: 0;
}

.verify-card input {
    padding: 1.15rem 1rem;
}

@media (max-width: 768px) {
    .verify-card {
        padding-top: 2.5rem;
        padding-bottom: 2.5rem;
    }
}


/* =========================================
   COMBINED PAYMENT PAGE
========================================= */
/* Two even columns on desktop, stacked on smaller screens */
.grid-payment-summary {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    width: 100%;
}

/* Two columns only on Desktop (>= 1280px). Small Laptop, Tablet and Mobile
   stack Order Summary above Payment Information (single column). */
@media (min-width: 1280px) {
    .grid-payment-summary {
        grid-template-columns: 1fr 1fr;
        gap: 2rem;
    }
}

/* Spacing between stacked cards in a payment column (e.g. Email Letter + Order Summary) */
.grid-payment-summary > div > .form-card {
    margin-bottom: 2rem;
}

.grid-payment-summary > div > .form-card:last-child {
    margin-bottom: 0;
}

/* Order summary header row (title + Edit link) */
.order-summary-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.summary-desc {
    margin: 0 0 0.5rem;
    line-height: 1.5;
}

/* Edit / Change links */
.link-edit,
.link-change {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    color: var(--text-link);
    text-decoration: underline;
}

.link-edit:hover,
.link-change:hover {
    color: var(--color-green-600);
}

.link-change {
    display: inline-block;
    margin-top: 0.5rem;
}

/* Save (dark) / Cancel (outline) buttons */
.edit-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1.75rem;
}

.btn-dark {
    flex: 1;
    background-color: var(--color-gray-900);
    color: var(--color-neutral-white);
    border: none;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.btn-dark:hover {
    background-color: var(--color-gray-700);
}

.btn-outline {
    flex: 1;
    background-color: var(--color-neutral-white);
    color: var(--color-gray-900);
    border: 1px solid var(--color-gray-300);
    padding: 1rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.btn-outline:hover {
    background-color: var(--color-gray-50);
    border-color: var(--color-gray-500);
}

/* Full-width Complete Purchase button (rectangle, not pill) */
button.complete-purchase-btn {
    width: 100%;
    border-radius: 8px;
    margin-top: 0.5rem;
    box-shadow: none;
}

/* reCAPTCHA spacing on the payment page */
.recaptcha-wrap {
    margin: 1.25rem 0;
}

/* General payment error message */
#payment-error {
    margin-bottom: 1rem;
}


/* =========================================
   ERROR PAGE — ALERT BANNER & REGION DROPDOWN
========================================= */
.alert-banner {
    background-color: var(--form-bg-error-fill);
    border: 1px solid var(--color-error-hex);
    border-radius: 8px;
    padding: 1rem 1.25rem;
    margin-bottom: 2rem;
}

.alert-banner p {
    color: var(--text-secondary);
    line-height: 1.6;
}

.alert-link {
    color: var(--color-brand-green);
    font-weight: var(--font-weight-semi-bold);
    text-decoration: underline;
}

.alert-link:hover {
    color: var(--color-green-600);
}

/* Region dropdown trigger with flag */
.region-trigger-content {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    min-width: 0;
}

.region-trigger-content .inline-flag {
    margin-right: 0;
}


/* =========================================
   NO BALANCE DUE PAGE
========================================= */
.no-balance-banner {
    background-color: var(--color-green-50);
    border-radius: 12px;
    padding: 2.75rem 1.75rem;
    margin-top: 1.5rem;
}

.no-balance-divider {
    border: none;
    border-top: 1px solid var(--color-neutral-gray);
    margin: 1.5rem 0;
}

/*The Back/Next buttons separation from the card on page */
.no-balance-page .button-footer {
    margin-top: 2.5rem;
}

.need-insurance-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.btn-quote {
    display: inline-block;
    background-color: var(--color-neutral-white);
    color: var(--color-brand-green);
    border: 1px solid var(--color-brand-green);
    border-radius: 50px;
    padding: 0.625rem 1.5rem;
    text-decoration: none;
    white-space: nowrap;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.btn-quote:hover {
    background-color: var(--color-green-50);
}

/* =========================================
   PAYMENT: REFUND POLICY + PROCESSOR LOGOS
========================================= */
.refund-policy-note {
    margin: 1rem 0 0;
}

.refund-policy-link {
    color: var(--color-brand-green);
    font-weight: var(--font-weight-semi-bold);
    text-decoration: underline;
}

.refund-policy-link:hover {
    color: var(--color-green-600);
}

.payment-processor-logos {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.payment-processor-logo {
    display: block;
    max-width: 6rem;
    height: auto;
}

.payment-processor-logo-lg {
    max-width: 10rem;
}


/* =========================================================================
   RESPONSIVE BREAKPOINTS
   Desktop is the base (no query, >=1280px). Each tier below overrides it.
   Breakpoint cutoffs (change here to retune all tiers):
     Small Laptop : max-width 1279px
     Tablet       : max-width 1023px
     Mobile       : max-width 767px
   ========================================================================= */

/* ---------- SMALL LAPTOP (<= 1279px) ---------- */
@media (max-width: 1279px) {
    /* Quick Pay: layout matches desktop (card centered, Next right-aligned,
       Recommended badge on the right). Wrapper stays within the viewport. */
    .content-wrapper {
        padding-left: 2rem;
        padding-right: 2rem;
    }
}

/* ---------- TABLET (<= 1023px) ---------- */
@media (max-width: 1023px) {
    /* Quick Pay: Next stays right-aligned; the Recommended badge becomes a
       full-width row above the radio + content, so the radio circle aligns
       with the title rather than the badge. */
    .radio-card.has-badge {
        flex-wrap: wrap;
    }

    .radio-card.has-badge .badge-recommended-row {
        order: 0;
        flex-basis: 100%; /* full-width line forces radio + content below */
        margin-left: 0;
        margin-bottom: 0.75rem;
    }
}

/* ---------- MOBILE (<= 767px) ---------- */
@media (max-width: 767px) {
    /* Quick Pay: card goes near full-width with tighter side padding, and the
       Next button becomes full-width. Recommended badge stays above the title
       (inherited from the tablet rule). */
    .content-wrapper {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .button-container {
        margin-top: 1.5rem;
    }

    /* Full-width, squared-off Next button (not a pill) on mobile. */
    .button-container .btn-primary {
        width: 100%;
        border-radius: 8px;
    }

    /* Shared footer (Back link + primary button) used by payment-options,
       verify-details, verify-policy, custom-amount, other-details, etc.
       On mobile the primary button stacks on top (full-width, squared) and the
       Back link sits centered below it, styled green with a leading chevron. */
    .button-footer {
        flex-direction: column-reverse;
        align-items: stretch;
        gap: 1rem;
    }

    .button-footer .btn-primary {
        width: 100%;
        border-radius: 8px;
    }

    .button-footer .btn-text {
        color: var(--color-brand-green);
        text-align: center;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 0.5rem;
    }

    /* CSS-drawn left chevron (no font dependency), shown only on mobile. */
    .button-footer .btn-text::before {
        content: '';
        display: inline-block;
        width: 0.5em;
        height: 0.5em;
        border-left: 2px solid currentColor;
        border-bottom: 2px solid currentColor;
        transform: rotate(45deg);
    }
}


/* =========================================
   PAYMENT FAILURE PAGE
========================================= */
/* Red circular X icon (mirrors .success-icon-wrapper but in the error colour) */
.failure-icon-wrapper {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 48px;
    height: 48px;
    background-color: var(--color-error-hex);
    border-radius: 50%;
    margin-bottom: 1rem;
    color: var(--color-neutral-white);
}

/* Outlined "Try Payment Again" button (error colour) */
.btn-try-again {
    display: inline-block;
    margin-top: 1.5rem;
    padding: 0.875rem 2rem;
    border: 1px solid var(--color-error-hex);
    border-radius: 8px;
    background-color: var(--color-neutral-white);
    color: var(--color-error-hex);
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.btn-try-again:hover {
    background-color: var(--form-bg-error-fill);
    color: var(--color-error-hex);
}

/* "Need Assistance Now?" section */
.assistance-section {
    margin-top: 2.5rem;
}

.assistance-hours {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 0.25rem;
}

.assistance-status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--color-brand-green);
}

.assistance-contacts {
    display: flex;
    justify-content: center;
    gap: 3rem;
    margin-top: 1.5rem;
    flex-wrap: wrap;
}

.assistance-contact {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.assistance-contact-icon {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: var(--color-brand-green);
    color: var(--color-neutral-white);
    flex-shrink: 0;
}

.assistance-contact-text {
    display: flex;
    flex-direction: column;
    text-align: left;
}

/* Mobile: stack the two contacts, each centered with the icon above the text */
@media (max-width: 767px) {
    .assistance-contacts {
        flex-direction: column;
        align-items: center;
        gap: 1.5rem;
    }

    .assistance-contact {
        flex-direction: column;
        align-items: center;
        gap: 0.5rem;
    }

    .assistance-contact-text {
        text-align: center;
    }
}
