/* ==========================================================================
   Lead Magnet Shared Styles - UX/UI Improvements
   ========================================================================== */

/* ==========================================================================
   1. FOCUS STATES & ACCESSIBILITY
   ========================================================================== */

/* Visible focus for keyboard navigation */
.radio-option input:focus-visible + label,
.scale-option input:focus-visible + label,
.checkbox-item input:focus-visible + label,
.checklist-item:focus-visible,
.form-input:focus-visible,
.form-textarea:focus-visible,
.calc-input:focus-visible,
input[type="email"]:focus-visible,
input[type="number"]:focus-visible,
input[type="text"]:focus-visible,
textarea:focus-visible,
.bp-header:focus-visible,
.btn-primary:focus-visible,
.btn-back:focus-visible,
.btn-next:focus-visible,
.btn-calculate:focus-visible,
.btn-toolbar:focus-visible,
button:focus-visible {
    outline: 3px solid #d4af37;
    outline-offset: 2px;
}

/* Remove default focus for mouse users */
.radio-option input:focus:not(:focus-visible) + label,
.scale-option input:focus:not(:focus-visible) + label,
.checkbox-item input:focus:not(:focus-visible) + label,
input:focus:not(:focus-visible),
textarea:focus:not(:focus-visible),
button:focus:not(:focus-visible) {
    outline: none;
}

/* Skip link improvements */
.skip-link {
    position: absolute;
    top: -100px;
    left: 0;
    background: #d4af37;
    color: #0a0a0a;
    padding: 0.75rem 1.5rem;
    font-weight: 700;
    z-index: 10000;
    transition: top 0.2s ease;
    border-radius: 0 0 8px 0;
}

.skip-link:focus {
    top: 0;
}

/* Screen reader only text */
.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;
}

/* ==========================================================================
   2. TOUCH TARGETS & MOBILE IMPROVEMENTS
   ========================================================================== */

/* Minimum touch target size (44x44px) */
.radio-option label,
.scale-option label,
.checkbox-item,
.checklist-item {
    min-height: 48px;
    display: flex;
    align-items: center;
}

/* Better touch affordance for range sliders */
input[type="range"] {
    cursor: pointer;
    height: 32px;
    padding: 12px 0;
    background: transparent;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    background: #d4af37;
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid #fff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

input[type="range"]::-moz-range-thumb {
    width: 24px;
    height: 24px;
    background: #d4af37;
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid #fff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

/* Larger checkboxes for mobile */
input[type="checkbox"] {
    width: 22px;
    height: 22px;
    min-width: 22px;
    cursor: pointer;
}

/* ==========================================================================
   3. COLOR CONTRAST IMPROVEMENTS (WCAG AA)
   ========================================================================== */

/* Improve gray text contrast */
.step-description,
.card-subtitle,
.category-subtitle,
.bp-subtitle,
.question-hint,
.label-hint,
.form-group .hint,
.progress-stat,
.assumptions-note {
    color: #595959; /* Improved from #6b6b6b for better contrast */
}

/* Improve placeholder contrast */
::placeholder {
    color: #767676; /* WCAG AA compliant */
    opacity: 1;
}

:-ms-input-placeholder {
    color: #767676;
}

::-ms-input-placeholder {
    color: #767676;
}

/* Darker muted text */
.item-description {
    color: #595959;
}

/* Progress bar ensure visibility */
.progress-fill,
.progress-bar-fill {
    min-width: 4px; /* Always show some progress */
}

/* ==========================================================================
   4. FORM ACCESSIBILITY
   ========================================================================== */

/* Required field indicator */
.required-indicator::after {
    content: " *";
    color: #c62828;
    font-weight: 700;
}

label[for] {
    cursor: pointer;
}

/* Error states */
.form-input.error,
.form-textarea.error,
.calc-input.error,
input.error {
    border-color: #c62828;
    background-color: #fff5f5;
}

.error-message {
    color: #c62828;
    font-size: 0.85rem;
    margin-top: 0.35rem;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.error-message::before {
    content: "⚠";
}

/* Success states */
.form-input.success,
.form-textarea.success,
input.success {
    border-color: #2e7d32;
}

/* Field groups with proper spacing */
.form-group + .form-group,
.calc-form-group + .calc-form-group,
.question-group + .question-group {
    margin-top: 1.25rem;
}

/* ==========================================================================
   5. BUTTON STATES
   ========================================================================== */

/* Loading state */
button.loading,
.btn-primary.loading,
.btn-next.loading,
.btn-calculate.loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

button.loading::after,
.btn-primary.loading::after,
.btn-next.loading::after,
.btn-calculate.loading::after {
    content: "";
    position: absolute;
    width: 20px;
    height: 20px;
    top: 50%;
    left: 50%;
    margin-left: -10px;
    margin-top: -10px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Disabled state */
button:disabled,
.btn-primary:disabled,
.btn-next:disabled,
.btn-back:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* Hover states with reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ==========================================================================
   6. MOBILE LAYOUT IMPROVEMENTS
   ========================================================================== */

@media (max-width: 768px) {
    /* Better hero padding */
    .assessment-hero,
    .calculator-hero,
    .checklist-hero,
    .template-hero,
    .guide-hero {
        padding: 3.5rem 5vw 3rem;
    }

    /* Card padding consistency */
    .assessment-card,
    .calculator-input-card,
    .calculator-results-card,
    .checklist-category,
    .step-card,
    .bp-card {
        padding: 1.25rem;
    }

    /* Better form element sizing on mobile */
    .form-input,
    .form-textarea,
    .calc-input,
    input[type="email"],
    input[type="text"],
    input[type="number"],
    textarea {
        font-size: 16px; /* Prevents iOS zoom on focus */
        padding: 0.75rem;
    }

    /* Scale options - better mobile layout */
    .scale-options {
        gap: 0.4rem;
    }

    .scale-option {
        min-width: 52px;
    }

    .scale-option label {
        padding: 0.65rem 0.35rem;
        min-height: 60px;
        justify-content: center;
    }

    .scale-number {
        font-size: 1.1rem;
    }

    .scale-label {
        font-size: 0.65rem;
        line-height: 1.2;
        text-align: center;
    }

    /* Radio options - full width and tappable */
    .radio-option label {
        padding: 0.875rem 1rem;
        min-height: 52px;
    }

    .radio-option label span {
        font-size: 0.9rem;
        line-height: 1.4;
    }

    /* Progress container mobile */
    .progress-container,
    .template-toolbar {
        position: static; /* Remove sticky on mobile to avoid overlap issues */
        margin-bottom: 1.5rem;
    }

    /* Email forms stacked with better spacing */
    .email-form,
    .email-inline-form,
    .download-form {
        flex-direction: column;
        gap: 0.75rem;
    }

    .email-form input,
    .email-inline-form input,
    .download-form input {
        width: 100%;
    }

    .email-form button,
    .email-inline-form button,
    .download-form button {
        width: 100%;
        padding: 0.875rem;
    }

    /* Step headers - better wrapping */
    .step-header,
    .bp-header,
    .category-header {
        flex-wrap: wrap;
        gap: 0.75rem;
    }

    .step-status,
    .category-score {
        order: 10;
        margin-left: 0;
    }

    /* Do's and don'ts boxes - full width */
    .dos-donts {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    /* Priority grid - better mobile layout */
    .priority-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    /* Timeline grid - 2 columns on tablet, 1 on phone */
    .timeline-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    /* Results hero stats - 2x2 grid */
    .results-hero-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }

    /* Score breakdown - single column */
    .breakdown-grid,
    .score-breakdown {
        grid-template-columns: 1fr;
    }

    /* Savings grid - single column */
    .savings-grid {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }

    /* TOC list - single column */
    .toc-list {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    /* Even smaller screens */
    .assessment-hero,
    .calculator-hero,
    .checklist-hero,
    .template-hero,
    .guide-hero {
        padding: 3rem 4vw 2.5rem;
    }

    /* Hero stats wrap to single column */
    .assessment-hero-stats {
        flex-direction: column;
        gap: 1rem;
    }

    /* Smaller results score circle */
    .results-score {
        width: 130px;
        height: 130px;
    }

    .score-number {
        font-size: 2.75rem;
    }

    /* ROI metrics - single column */
    .roi-metrics {
        grid-template-columns: 1fr;
    }

    /* Hero stat cards smaller */
    .hero-stat {
        padding: 1rem;
    }

    .hero-stat-value {
        font-size: 1.5rem;
    }
}

/* ==========================================================================
   7. HIGH CONTRAST MODE SUPPORT
   ========================================================================== */

@media (forced-colors: active) {
    .progress-fill,
    .progress-bar-fill,
    .breakdown-fill,
    .bar-fill,
    .score-item-fill {
        background: CanvasText !important;
    }

    .radio-option input:checked + label,
    .scale-option input:checked + label,
    .checklist-item.checked {
        border: 3px solid CanvasText;
    }

    button,
    .btn-primary,
    .btn-next,
    .btn-calculate {
        border: 2px solid CanvasText;
    }
}

/* ==========================================================================
   8. PRINT STYLES
   ========================================================================== */

@media print {
    .header,
    .footer,
    .template-toolbar,
    .progress-container,
    .email-form,
    .email-inline-form,
    .download-form,
    .results-email-capture,
    .assessment-cta,
    .results-cta,
    .template-cta,
    .guide-bottom-cta,
    .chatbot-container {
        display: none !important;
    }

    .bp-card .bp-content {
        max-height: none !important;
    }

    body {
        font-size: 12pt;
    }
}

/* ==========================================================================
   9. CONSENT CHECKBOX STYLES
   ========================================================================== */

.consent-checkbox {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-top: 1rem;
    font-size: 0.875rem;
    color: #666;
    cursor: pointer;
}

.consent-checkbox input[type="checkbox"] {
    width: 20px;
    height: 20px;
    min-width: 20px;
    margin: 0;
    cursor: pointer;
    accent-color: #d4af37;
}

.consent-checkbox span {
    line-height: 1.5;
}

.consent-checkbox a {
    color: #d4af37;
    text-decoration: underline;
}

.consent-checkbox a:hover {
    color: #b8941f;
}

/* Form row layout for inline forms with consent */
.email-form .form-row,
.email-inline-form .form-row,
.download-form .form-row {
    display: flex;
    gap: 0.75rem;
}

@media (max-width: 480px) {
    .email-form .form-row,
    .email-inline-form .form-row,
    .download-form .form-row {
        flex-direction: column;
    }
    
    .email-form .form-row button,
    .email-inline-form .form-row button,
    .download-form .form-row button {
        width: 100%;
    }
    
    .consent-checkbox {
        font-size: 0.8125rem;
    }
}

/* Modal form consent styling */
.modal-form .consent-checkbox {
    margin: 1rem 0;
}

