/* CSS Variables for theming */
:root {
    --color-text-primary: #1a202c;
    --color-text-secondary: #64748b;
    --color-text-muted: #a0aec0;
    --color-text-disabled: #94a3b8;
    --color-background: #ffffff;
    --color-background-secondary: #f8fafc;
    --color-background-tertiary: #f7fafc;
    --color-border: #e2e8f0;
    --color-border-light: #cbd5e0;
    --color-primary: #3182ce;
    --color-primary-dark: #2c5aa0;
    --color-primary-light: #63b3ed;
    --color-primary-pale: #f0f9ff;
    --color-success: #38a169;
    --color-success-dark: #2f855a;
    --color-error: #e53e3e;
    --color-shadow: rgba(0, 0, 0, 0.05);
    --color-shadow-primary: rgba(49, 130, 206, 0.15);
    --color-shadow-primary-focus: rgba(49, 130, 206, 0.1);
    --color-shadow-success: rgba(56, 161, 105, 0.1);
}

@media (prefers-color-scheme: dark) {
    :root {
        --color-text-primary: #e2e8f0;
        --color-text-secondary: #cbd5e0;
        --color-text-muted: #64748b;
        --color-text-disabled: #4a5568;
        --color-background: #1a202c;
        --color-background-secondary: #2d3748;
        --color-background-tertiary: #374151;
        --color-border: #4a5568;
        --color-border-light: #2d3748;
        --color-primary: #63b3ed;
        --color-primary-dark: #90cdf4;
        --color-primary-light: #3182ce;
        --color-primary-pale: #1e3a8a;
        --color-success: #48bb78;
        --color-success-dark: #38a169;
        --color-error: #fc8181;
        --color-shadow: rgba(0, 0, 0, 0.3);
        --color-shadow-primary: rgba(99, 179, 237, 0.2);
        --color-shadow-primary-focus: rgba(99, 179, 237, 0.15);
        --color-shadow-success: rgba(72, 187, 120, 0.15);
    }
}

html[data-theme="dark"] {
    --color-text-primary: #e2e8f0;
    --color-text-secondary: #cbd5e0;
    --color-text-muted: #64748b;
    --color-text-disabled: #4a5568;
    --color-background: #1a202c;
    --color-background-secondary: #2d3748;
    --color-background-tertiary: #374151;
    --color-border: #4a5568;
    --color-border-light: #2d3748;
    --color-primary: #63b3ed;
    --color-primary-dark: #90cdf4;
    --color-primary-light: #3182ce;
    --color-primary-pale: #1e3a8a;
    --color-success: #48bb78;
    --color-success-dark: #38a169;
    --color-error: #fc8181;
    --color-shadow: rgba(0, 0, 0, 0.3);
    --color-shadow-primary: rgba(99, 179, 237, 0.2);
    --color-shadow-primary-focus: rgba(99, 179, 237, 0.15);
    --color-shadow-success: rgba(72, 187, 120, 0.15);
}

html[data-theme="light"] {
    --color-text-primary: #1a202c;
    --color-text-secondary: #64748b;
    --color-text-muted: #a0aec0;
    --color-text-disabled: #94a3b8;
    --color-background: #ffffff;
    --color-background-secondary: #f8fafc;
    --color-background-tertiary: #f7fafc;
    --color-border: #e2e8f0;
    --color-border-light: #cbd5e0;
    --color-primary: #3182ce;
    --color-primary-dark: #2c5aa0;
    --color-primary-light: #63b3ed;
    --color-primary-pale: #f0f9ff;
    --color-success: #38a169;
    --color-success-dark: #2f855a;
    --color-error: #e53e3e;
    --color-shadow: rgba(0, 0, 0, 0.05);
    --color-shadow-primary: rgba(49, 130, 206, 0.15);
    --color-shadow-primary-focus: rgba(49, 130, 206, 0.1);
    --color-shadow-success: rgba(56, 161, 105, 0.1);
}

/* Reset and base styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

.hidden {
    display: none !important;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.5;
    color: var(--color-text-primary);
    background: var(--color-background-secondary);
    min-height: 100vh;
    padding: 2rem 1rem;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Layout */
.container {
    max-width: 600px;
    margin: 0 auto;
    background: var(--color-background);
    border-radius: 8px;
    box-shadow: 0 4px 6px var(--color-shadow);
    overflow: hidden;
    transition: background-color 0.3s ease;
}

.header {
    padding: 2rem 1.5rem;
    border-bottom: 1px solid var(--color-border);
    background: var(--color-background-secondary);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.header-wrapper {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    max-width: 600px;
    margin: 0 auto;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    flex: 1;
}

.header-logo {
    width: 80px;
    height: auto;
    flex-shrink: 0;
}

.header-text {
    text-align: center;
}

.header-text h1 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--color-text-primary);
    margin-bottom: 0.5rem;
    transition: color 0.3s ease;
}

.header-text p {
    color: var(--color-text-secondary);
    transition: color 0.3s ease;
}

/* Dark mode toggle button */
.dark-mode-toggle {
    background: none;
    border: 2px solid var(--color-border);
    border-radius: 6px;
    padding: 0.5rem;
    cursor: pointer;
    font-size: 1.25rem;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    color: var(--color-text-primary);
    flex-shrink: 0;
    margin-top: 0.25rem;
}

.dark-mode-toggle:hover {
    background-color: var(--color-background-secondary);
    border-color: var(--color-primary);
    transform: scale(1.05);
}

.dark-mode-toggle:active {
    transform: scale(0.95);
}

.toggle-icon {
    display: inline-block;
    transition: transform 0.3s ease;
}

/* Mobile responsive header */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 1rem;
    }

    .header-logo {
        width: 60px;
    }

    .header-text h1 {
        font-size: 1.75rem;
    }
}

/* Progress indicator */
.progress-container {
    padding: 1.5rem;
    background: var(--color-background-secondary);
    border-bottom: 1px solid var(--color-border);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    font-size: 0.875rem;
    color: var(--color-text-secondary);
    transition: color 0.3s ease;
}

.progress-percentage {
    font-weight: 600;
    color: var(--color-primary);
    transition: color 0.3s ease;
}

.progress-time {
    font-style: italic;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--color-border);
    border-radius: 4px;
    margin-bottom: 1.5rem;
    overflow: hidden;
    transition: background-color 0.3s ease;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--color-primary), var(--color-primary-light));
    border-radius: 4px;
    transition: width 0.3s ease;
}

.progress-steps {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
}

.progress-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    flex: 1;
    text-align: center;
    transition: all 0.3s ease;
}

.progress-step.completing {
    animation: stepComplete 0.6s ease-out;
}

.progress-step.completing .step-icon {
    animation: checkmarkPulse 0.6s ease-out;
}

.step-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 0.875rem;
    font-weight: 600;
    transition: all 0.2s ease;
}

.step-label {
    font-size: 0.75rem;
    font-weight: 500;
    line-height: 1.2;
    max-width: 100%;
    word-wrap: break-word;
}

/* Step states */
.progress-step.complete {
    cursor: pointer;
}

.progress-step.complete:hover .step-icon {
    background: var(--color-success-dark);
}

.progress-step.current {
    cursor: pointer;
}

.progress-step.current:hover .step-icon {
    background: var(--color-primary-dark);
}

.progress-step.complete .step-icon {
    background: var(--color-success);
    color: var(--color-background);
}

.progress-step.current .step-icon {
    background: var(--color-primary);
    color: var(--color-background);
    box-shadow: 0 0 0 3px var(--color-shadow-primary-focus);
}

.progress-step.pending .step-icon {
    background: var(--color-border);
    color: var(--color-text-secondary);
}

.progress-step.complete .step-label
    {
        color: var(--color-success);
}

.progress-step.current .step-label
    {
        color: var(--color-primary);
    font-weight: 600;
}

.progress-step.pending .step-label
    {
        color: var(--color-text-secondary);
}

/* Form styles */
.step {
    padding: 2rem 1.5rem;
}

.step.hidden {
    display: none;
}

.step h2
    {
        color: var(--color-text-primary);
}

.step h3 {
    margin-bottom: 1rem;
}

.step > p
    {
        color: var(--color-text-secondary);
    margin-bottom: 2rem;
}

/* Checkbox styling */
.billing-checkbox {
    margin-bottom: 1rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    color: var(--color-text-primary);
    gap: 0.75rem;
    position: relative;
    padding: 0.5rem;
    border-radius: 6px;
    transition: background-color 0.2s ease;
}

.checkbox-label:hover {
    background-color: var(--color-background-secondary);
}

.checkbox-label input[type="checkbox"] {
    margin: 0;
}

.checkmark {
    height: 20px;
    width: 20px;
    background-color: var(--color-background);
    border: 2px solid var(--color-border);
    border-radius: 4px;
    position: relative;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.checkbox-label input[type="checkbox"]:checked ~ .checkmark {
    background-color: var(--color-primary);
    border-color: var(--color-primary);
}

.checkmark:after {
    content: "";
    position: absolute;
    display: none;
    left: 6px;
    top: 2px;
    width: 6px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.checkbox-label input[type="checkbox"]:checked ~ .checkmark:after {
    display: block;
}

.checkbox-label:hover .checkmark {
    border-color: var(--color-border-light);
}

.checkbox-label input[type="checkbox"]:checked ~ .checkmark:hover {
    background-color: var(--color-primary-dark);
    border-color: var(--color-primary-dark);
}

/* Disabled billing fields styling */
.billing-fields-disabled {
    opacity: 0.6;
    pointer-events: none;
}

.billing-fields-disabled input,
.billing-fields-disabled select {
    background-color: var(--color-background-tertiary);
    border-color: var(--color-border);
    color: var(--color-text-muted);
    cursor: not-allowed;
}

.billing-fields-disabled .field::after {
    display: none;
}

.billing-fields-disabled label {
    color: var(--color-text-muted);
}

.billing-fields-disabled .error {
    display: none;
}

/* Form grid */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 1rem;
}

.form-grid:last-child {
    margin-bottom: 2rem;
}

.field {
    position: relative;
    margin-bottom: 1.75rem;
}

.input-wrapper {
    position: relative;
}

.field label {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-text-secondary);
    font-size: 1rem;
    font-weight: 500;
    pointer-events: none;
    transition: all 0.2s ease;
    background: var(--color-background);
    padding: 0 0.25rem;
    z-index: 1;
}

.field input:focus + label,
.field input:not(:placeholder-shown) + label,
.field select:focus + label,
.field select:not([value=""]) + label,
.field label.float {
    top: -0.5rem;
    left: 0.5rem;
    font-size: 0.875rem;
    color: var(--color-primary);
    font-weight: 600;
    transform: none;
}

/* Pre-float labels for dropdowns */
#country + label,
#stateProvince + label,
#product + label {
    top: -0.5rem;
    left: 0.5rem;
    font-size: 0.875rem;
    color: var(--color-primary);
    font-weight: 600;
    transform: none;
}

.field input,
.field select {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--color-border);
    border-radius: 6px;
    font-size: 16px; /* Prevent iOS zoom on focus */
    background: var(--color-background);
    color: var(--color-text-primary);
    transition: border-color 0.2s ease, background-color 0.2s ease, color 0.2s ease;
}

.field input[type="text"]:not([required]) {
    border-style: dashed;
}

.field input:focus,
.field select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-shadow-primary-focus);
}

/* Valid field states */
.field.valid input,
.field.valid select {
    border-color: var(--color-success);
    box-shadow: 0 0 0 3px var(--color-shadow-success);
}

.field.valid::after {
    content: '✓';
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-success);
    font-size: 1.125rem;
    font-weight: bold;
    pointer-events: none;
}

/* Stripe Elements */
.stripe-card-element {
    padding: 0.75rem;
    border: 2px solid var(--color-border);
    border-radius: 6px;
    background: var(--color-background);
    color: var(--color-text-primary);
    transition: border-color 0.2s ease, background-color 0.2s ease, color 0.2s ease;
}

.stripe-card-element.StripeElement--focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-shadow-primary-focus);
}

/* Floating label for Stripe card element */
.stripe-card-element.StripeElement--focus ~ label,
.stripe-card-element.StripeElement--complete ~ label {
    top: -0.5rem;
    left: 0.5rem;
    font-size: 0.875rem;
    color: var(--color-primary);
    font-weight: 600;
}

.stripe-card-element.StripeElement--invalid {
    border-color: var(--color-error);
}

.error {
    color: var(--color-error);
    font-size: 0.875rem;
    margin-top: 0.25rem;
    display: block;
}

small {
    display: block;
    color: var(--color-text-secondary);
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

.field-help {
    display: block;
    color: var(--color-text-secondary);
    font-size: 0.75rem;
    margin-top: 0.25rem;
    font-style: italic;
}

/* Quantity section */
.quantity-section {
    margin-bottom: 2rem;
}

.quantity-buttons {
    display: flex;
    align-items: center;
    padding: 0.5rem 0.5rem !important;
    gap: 0.5rem;
    margin-top: 0.5rem;
    flex-wrap: wrap;
}

.quantity-buttons span {
    color: var(--color-text-secondary);
    font-size: 0.875rem;
    margin-right: 0.5rem;
}


.field input:disabled {
    background: var(--color-background-secondary);
    border-color: var(--color-border);
    color: var(--color-text-disabled);
    cursor: not-allowed;
}

/* Cost breakdown */
.cost-breakdown {
    background: var(--color-background-secondary);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    transition: opacity 0.2s ease;
}

.cost-breakdown.disabled {
    opacity: 0.6;
    background: var(--color-background-tertiary);
}

.cost-breakdown h3 {
    margin-bottom: 0.5rem;
    color: var(--color-text-primary);
    font-size: 1.125rem;
    font-weight: 600;
}

.cost-tier {
    color: var(--color-text-secondary);
    font-size: 0.875rem;
    margin-bottom: 1rem;
    font-style: italic;
}

.cost-items {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.cost-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.25rem 0;
    border-bottom: 1px solid var(--color-border);
}

.cost-item.total {
    border-bottom: none;
    font-weight: 600;
    font-size: 1.125rem;
    color: var(--color-primary);
    margin-top: 0.5rem;
    padding-top: 0.5rem;
}


/* Actions */
.actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--color-border);
    gap: 1rem;
}

.actions-right {
    justify-content: flex-end;
}

/* Horizontal button layout with simplified text */
.actions {
    gap: 1.25rem;
}

/* Primary action buttons */
.actions button[type="submit"],
.actions button.primary,
.actions button[type="button"]:last-child {
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(49, 130, 206, 0.15);
}

/* Override first-child for primary buttons */
.actions button.primary {
    background: transparent !important;
    color: var(--color-primary) !important;
    border-color: var(--color-primary) !important;
}

.actions button[type="submit"]:hover,
.actions button.primary:hover,
.actions button[type="button"]:last-child:hover {
    box-shadow: 0 4px 12px rgba(49, 130, 206, 0.25);
}

/* Secondary action button (left side) */
.actions button[type="button"]:first-child {
    background: rgba(49, 130, 206, 0.05);
    border: 2px solid var(--color-border);
    color: var(--color-text-secondary);
}

.actions button[type="button"]:first-child:hover:not(:disabled) {
    background: rgba(49, 130, 206, 0.1);
    border-color: var(--color-border-light);
    color: var(--color-primary);
}

/* Button container spacing */
.actions {
    margin-top: 1.5rem;
}


/* Primary navigation buttons */
button[type="button"] {
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    border: 2px solid var(--color-primary);
    background: transparent;
    color: var(--color-primary);
    transition: all 0.2s ease;
    min-height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

button[type="button"]:hover:not(:disabled) {
    background: rgba(49, 130, 206, 0.1);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(49, 130, 206, 0.2);
}

button[type="button"]:active:not(:disabled) {
    transform: translateY(0);
}

/* Quantity button styles - more specific selectors for proper override */
button.qty-btn {
    padding: 0.5rem 1rem;
    background: var(--color-background-secondary);
    border: 2px solid var(--color-border);
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 40px;
}

button.qty-btn:hover:not(:disabled):not(.active) {
    background: var(--color-background-secondary);
    border-color: var(--color-border-light);
    color: var(--color-text-secondary);
}

button.qty-btn.active {
    background: var(--color-primary);
    color: var(--color-background);
    border-color: var(--color-primary);
    box-shadow: 0 2px 4px rgba(49, 130, 206, 0.2);
}

button.qty-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: var(--color-background-secondary);
    color: var(--color-text-disabled);
}

/* Primary submit button */
button[type="submit"] {
    padding: 0.875rem 2rem;
    border-radius: 8px;
    font-size: 1.125rem;
    font-weight: 600;
    cursor: pointer;
    border: 2px solid var(--color-primary);
    background: var(--color-primary);
    color: var(--color-background);
    transition: all 0.2s ease;
    min-height: 52px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(49, 130, 206, 0.2);
}

button[type="submit"]:hover:not(:disabled) {
    background: var(--color-primary-dark);
    border-color: var(--color-primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px var(--color-shadow-primary);
}

button[type="submit"]:active:not(:disabled) {
    transform: translateY(0);
}

/* Enhanced disabled state */
button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* Success button state */
button.success {
    background: var(--color-success) !important;
    color: var(--color-background) !important;
    border-color: var(--color-success) !important;
    box-shadow: 0 2px 8px var(--color-shadow-success) !important;
    transform: translateY(-1px);
    transition: all 0.3s ease;
}

.actions button.success {
    background: var(--color-success) !important;
    color: var(--color-background) !important;
    border-color: var(--color-success) !important;
    box-shadow: 0 2px 8px var(--color-shadow-success) !important;
    transform: translateY(-1px);
    transition: all 0.3s ease;
}

button.success:hover:not(:disabled) {
    background: var(--color-success-dark) !important;
    border-color: var(--color-success-dark) !important;
    box-shadow: 0 4px 12px rgba(56, 161, 105, 0.4) !important;
}

/* Focus states for accessibility */
button:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

/* Review section */
.review-section {
    background: var(--color-background-secondary);
    border-radius: 6px;
    padding: 1.5rem;
}

.review-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

.review-section h3 {
    margin-bottom: 1rem;
    color: var(--color-text-primary);
    font-size: 1.125rem;
    font-weight: 600;
}

.payment-description {
    color: var(--color-text-secondary);
    font-size: 0.875rem;
    line-height: 1.5;
    margin-bottom: 2.5rem;
    padding: 1rem;
    background: var(--color-background-secondary);
    border-radius: 6px;
    border-left: 3px solid var(--color-primary);
}

.payment-description a {
    color: var(--color-primary);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s ease;
}

.payment-description a:hover {
    color: var(--color-primary-dark);
    text-decoration: underline;
}

.payment-description strong {
    font-weight: 600;
}

.field-help {
    display: block;
    color: var(--color-text-secondary);
    font-size: 0.75rem;
    margin-top: 0.25rem;
    font-style: italic;
}

.review-item {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid #e2e8f0;
    align-items: flex-start;
}

.review-item.address {
    flex-direction: column;
    align-items: flex-start;
    padding: 0.75rem 0;
}

.review-item.address .review-label {
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--color-text-primary);
}

.review-item.address .review-value {
    line-height: 1.5;
    color: var(--color-text-disabled);
    font-size: 0.95rem;
}

.review-item.address .review-value br {
    margin-bottom: 0.25rem;
}

.review-item.address .review-value br:last-child {
    margin-bottom: 0;
}

.review-item.total {
    border-bottom: none;
    font-weight: 600;
    font-size: 1.125rem;
    color: var(--color-primary);
    margin-top: 0.5rem;
    padding-top: 0.5rem;
}

.review-item:last-child {
    border: none;
}

/* Mobile responsive */
@media (max-width: 768px) {
    html {
        -webkit-text-size-adjust: 100%;
        -ms-text-size-adjust: 100%;
    }

    body {
        padding: 1rem 0.5rem;
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }

    .header {
        padding: 1.5rem 1rem;
    }

    .header h1 {
        font-size: 1.75rem;
    }

    .progress-container {
        padding: 1rem;
    }

    .progress-info {
        font-size: 0.75rem;
    }

    .progress-steps {
        gap: 0.25rem;
    }

    .step-icon {
        width: 36px;
        height: 36px;
        font-size: 0.875rem;
    }

    .step-label {
        font-size: 0.75rem;
        line-height: 1.3;
    }

    .step {
        padding: 1.5rem 1rem;
    }

    .step h2 {
        font-size: 1.375rem;
        margin-bottom: 0.75rem;
    }

    .step > p {
        margin-bottom: 1.5rem;
        font-size: 0.95rem;
    }

    .form-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .billing-checkbox {
        margin-bottom: 1.5rem;
    }

    .checkbox-label {
        font-size: 0.95rem;
        gap: 0.5rem;
        padding: 0.75rem;
    }

    .checkbox-label input[type="checkbox"] {
        margin-right: 0.5rem;
    }

    .checkmark {
        height: 24px;
        width: 24px;
    }

    .checkmark:after {
        left: 7px;
        top: 3px;
        width: 7px;
        height: 12px;
    }

    .field input[type="text"]:not([required]) {
        border-style: dashed;
        background: #fafbfc;
    }

    .actions {
        flex-direction: column-reverse;
        gap: 1rem;
        margin-top: 1.5rem;
        padding-top: 0.5rem;
    }

    .actions button.primary,
    .actions button[type="submit"],
    .actions button[type="button"]:last-child {
        font-size: 1.1rem;
        padding: 1.125rem 1.5rem;
    }

    .actions button[type="button"]:first-child {
        font-size: 1rem;
        padding: 1rem 1.5rem;
    }


    /* Enhanced touch-friendly buttons */
    button[type="button"] {
        width: 100%;
        min-height: 50px;
        padding: 1rem 1.5rem;
        font-size: 1.1rem;
        font-weight: 600;
        border-radius: 8px;
        margin-bottom: 0.5rem;
    }

    button[type="submit"] {
        width: 100%;
        min-height: 54px;
        padding: 1.125rem 2rem;
        font-size: 1.125rem;
        font-weight: 600;
        border-radius: 10px;
        margin-top: 1rem;
    }

    button:active:not(:disabled) {
        transform: scale(0.98);
        transition: transform 0.1s ease;
    }

    /* Remove hover effects on touch devices */
    @media (hover: none) {
        button[type="button"]:hover:not(:disabled) {
            transform: none;
            box-shadow: none;
        }

        button[type="submit"]:hover:not(:disabled) {
            transform: none;
            box-shadow: 0 2px 4px rgba(49, 130, 206, 0.2);
        }
    }

    /* Touch-friendly form controls */
    .field {
        margin-bottom: 1.75rem;
    }

    .field input,
    .field select {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 1rem 0.875rem;
        min-height: 48px;
        border-radius: 8px;
        border: 2px solid var(--color-border);
        transition: all 0.2s ease;
        -webkit-appearance: none;
        appearance: none;
    }

    .field select {
        background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
        background-position: right 0.75rem center;
        background-repeat: no-repeat;
        background-size: 1.5em 1.5em;
        padding-right: 2.5rem;
    }

    /* Touch-friendly quantity buttons */
    button.qty-btn {
        padding: 0.75rem 1rem;
        min-height: 48px;
        font-size: 0.95rem;
        border-radius: 6px;
        margin: 0;
        min-width: 48px;
        -webkit-tap-highlight-color: rgba(49, 130, 206, 0.1);
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .quantity-buttons {
        gap: 0.5rem;
        margin-top: 0.75rem;
        justify-content: center;
    }

    .quantity-buttons span {
        font-size: 0.875rem;
        margin-right: 0.75rem;
        align-self: center;
    }

    /* Mobile-specific input types */
    #phone {
        -webkit-appearance: none;
        appearance: none;
    }

    #email {
        -webkit-appearance: none;
        appearance: none;
    }

    #zipPostal {
        -webkit-appearance: none;
        appearance: none;
    }


    /* Better spacing for mobile review sections */
    .review-section {
        padding: 1.25rem;
        margin-bottom: 1.5rem;
    }

    .review-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .review-item {
        padding: 0.75rem 0;
        font-size: 0.95rem;
    }

    .review-item.address .review-value {
        font-size: 0.9rem;
    }

    .review-item.address {
        padding: 0.5rem 0;
    }

    .review-item.address .review-label {
        margin-bottom: 0.375rem;
    }

    .review-item.address .review-value {
        line-height: 1.4;
        font-size: 0.875rem;
    }



    /* Better mobile cost breakdown */
    .cost-breakdown {
        margin-bottom: 1.5rem;
    }

    .cost-breakdown h3 {
        font-size: 1rem;
        margin-bottom: 0.75rem;
    }

    .cost-items {
        gap: 0.75rem;
    }

    .cost-item {
        padding: 0.5rem 0;
        font-size: 0.9rem;
    }
}

/* Loading state */
.loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Page loading overlay */
.page-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(2px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.page-loading-overlay.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.page-loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid #e2e8f0;
    border-top: 4px solid var(--color-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

.page-loading-text {
    color: var(--color-text-secondary);
    font-size: 1rem;
    font-weight: 500;
    text-align: center;
    max-width: 300px;
}

.page-loading-subtext {
    color: var(--color-text-disabled);
    font-size: 0.875rem;
    text-align: center;
    margin-top: 0.5rem;
    max-width: 300px;
}


/* Disabled form state */
.form-disabled {
    pointer-events: none;
    opacity: 0.6;
}

.form-disabled input,
.form-disabled select,
.form-disabled button {
    cursor: not-allowed !important;
}


/* Toast notifications */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    pointer-events: none;
}

.toast {
    background: white;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 1rem 1.25rem;
    margin-bottom: 0.75rem;
    border-left: 4px solid;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    pointer-events: auto;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    max-width: 400px;
}

.toast.show {
    transform: translateX(0);
}

.toast.success {
    border-left-color: var(--color-success);
}

.toast.error {
    border-left-color: var(--color-error);
}

.toast.warning {
    border-left-color: #d69e2e;
}

.toast.info {
    border-left-color: var(--color-primary);
}

.toast-message {
    flex: 1;
    font-size: 0.875rem;
    line-height: 1.4;
}

.toast-close {
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    opacity: 0.6;
    padding: 0;
    width: 1.5rem;
    height: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toast-close:hover {
    opacity: 1;
}

/* Screen reader only */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Skip links for keyboard navigation */
.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: var(--color-primary);
    color: var(--color-background);
    padding: 8px;
    text-decoration: none;
    border-radius: 4px;
    z-index: 1000;
    font-weight: 600;
}

.skip-link:focus {
    top: 6px;
}

/* Focus management */
.focus-visible:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .progress-step.complete .step-icon {
        background: black;
        color: var(--color-background);
    }

    .progress-step.current .step-icon {
        background: black;
        color: var(--color-background);
        border: 2px solid white;
    }

    .progress-step.pending .step-icon {
        background: white;
        color: black;
        border: 1px solid black;
    }
}

/* Error boundaries for graceful degradation */
.error-boundary {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    padding: 2rem;
    max-width: 400px;
    width: 90%;
    z-index: 10000;
    text-align: center;
    border: 1px solid var(--color-border);
}

.error-boundary.payment-error {
    border-left: 4px solid #d69e2e;
}

.error-boundary.csrf-error {
    border-left: 4px solid #e53e3e;
}

.error-boundary.adblocker-error {
    border-left: 4px solid #805ad5;
}

.error-boundary.adblocker-error .error-icon {
    color: #805ad5;
}

.error-details {
    background: var(--color-background-tertiary);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    padding: 1rem;
    margin: 1rem 0;
    font-size: 0.875rem;
    color: var(--color-text-disabled);
}

.help-link {
    color: var(--color-primary);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    border: 1px solid #3182ce;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    transition: all 0.2s ease;
    display: inline-block;
    margin-top: 0.5rem;
}

.help-link:hover {
    background: var(--color-primary);
    color: var(--color-background);
}

.error-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    display: block;
}

.error-boundary h3 {
    color: var(--color-text-primary);
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.error-boundary p {
    color: var(--color-text-secondary);
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

.error-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    flex-wrap: wrap;
}

.error-actions button {
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    border: 2px solid;
    transition: all 0.2s ease;
}

.error-actions .retry-btn {
    background: var(--color-primary);
    color: var(--color-background);
    border-color: var(--color-primary);
}

.error-actions .retry-btn:hover {
    background: #2c5aa0;
}

.error-actions .continue-btn {
    background: transparent;
    color: #38a169;
    border-color: #38a169;
}

.error-actions .continue-btn:hover {
    background: rgba(56, 161, 105, 0.1);
}

.contact-info {
    font-size: 0.875rem;
    color: var(--color-text-secondary);
    margin-top: 1rem;
    font-style: italic;
}

/* Enhanced error messages */
.error.warning {
    color: #d69e2e;
    background: #fefcbf;
    border-color: #f6e05e;
    padding: 0.75rem;
    border-radius: 4px;
    font-size: 0.875rem;
}

/* Error toast with retry */
.error-with-retry .toast-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-top: 0.5rem;
}

.toast-retry-btn {
    background: var(--color-primary);
    color: var(--color-background);
    border: none;
    padding: 0.375rem 0.75rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s ease;
}

.toast-retry-btn:hover {
    background: #2c5aa0;
}

/* Mobile responsive error boundaries */
@media (max-width: 768px) {
    .error-boundary {
        padding: 1.5rem;
        max-width: 90%;
    }

    .error-boundary h3 {
        font-size: 1.125rem;
    }

    .error-actions {
        flex-direction: column;
    }

    .error-actions button {
        width: 100%;
        min-height: 48px;
        font-size: 1rem;
    }
}

/* Thank You Screen */
.thank-you-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    text-align: center;
}

.thank-you-screen.hidden {
    display: none;
}

.thank-you-content {
    max-width: 400px;
    margin: 0 auto;
    background: white;
    padding: 3rem 2rem;
    border-radius: 12px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.thank-you-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.thank-you-screen h2 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--color-text-primary);
    margin-bottom: 1rem;
}

.thank-you-screen p {
    color: var(--color-text-secondary);
    margin-bottom: 2rem;
    line-height: 1.6;
}

.thank-you-actions {
    display: flex;
    justify-content: center;
}

.thank-you-actions button {
    background: var(--color-primary);
    color: var(--color-background);
    border: 2px solid var(--color-primary);
    padding: 0.75rem 2rem;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s ease;
}

.thank-you-actions button:hover:not(:disabled) {
    background: #2c5aa0;
}

/* Mobile responsive thank you screen */
@media (max-width: 768px) {
    .thank-you-content {
        padding: 2rem 1.5rem;
        margin: 1rem;
        max-width: none;
    }

    .thank-you-icon {
        font-size: 3rem;
    }

    .thank-you-screen h2 {
        font-size: 1.75rem;
    }

    .thank-you-actions button {
        width: 100%;
        min-height: 48px;
        font-size: 1.1rem;
    }
}

/* Progress step animations */
@keyframes stepComplete {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
        color: #38a169;
    }
    100% {
        transform: scale(1);
        color: #38a169;
    }
}

@keyframes checkmarkPulse {
    0% {
        transform: scale(0.8);
        opacity: 0;
    }
    50% {
        transform: scale(1.2);
        opacity: 1;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .progress-fill {
        transition: none;
    }

    .toast {
        transition: none;
    }

    .page-loading-overlay {
        transition: none;
    }

    .loading::after {
        animation: none;
    }

    .page-loading-spinner {
        animation: none;
    }

    .api-loading-indicator .spinner {
        animation: none;
    }

    .error-boundary {
        animation: none;
    }

    .progress-step.completing {
        animation: none;
    }

    .progress-step.completing .step-icon {
        animation: none;
    }
}