/* Copyright © 2026 CampaignComply. All rights reserved. */

/**
 * Form 470 Wizard Styles
 * Extends form410-styles.css base
 */

/* ==========================================
   MODAL & PROGRESS BAR
   ========================================== */

#form470Modal .form-builder-container {
    border-radius: 12px;
    overflow: visible;
}

#form470Modal .form-builder-body {
    max-height: calc(90vh - 160px);
}

@media (max-width: 768px) {
    #form470Modal .form-builder-body {
        max-height: calc(100vh - 140px);
    }
}

#form470Modal .form-builder-header {
    border-bottom: none;
    border-radius: 0;
    margin: 0;
}

/* Progress and validation styles now in form-wizard-enhancements.css */

/* ==========================================
   FORM TYPE SELECTION (Step 1)
   ========================================== */

.form-type-selection {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.form-type-card {
    border: 2px solid var(--border);
    border-radius: 0.75rem;
    padding: 1.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    background: white;
    position: relative;
}

.form-type-card:hover {
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(43, 74, 111, 0.1);
}

.form-type-card.selected {
    border-color: var(--primary);
    background: var(--bg-selected);
    box-shadow: 0 4px 12px rgba(43, 74, 111, 0.15);
}

.form-type-card.selected::after {
    content: '\2713';
    position: absolute;
    top: 12px;
    right: 12px;
    width: 24px;
    height: 24px;
    background: #2B4A6F;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: bold;
}

.form-type-card input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.form-type-card .card-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.form-type-card .card-icon {
    width: 48px;
    height: 48px;
    border-radius: 0.5rem;
    background: var(--border-light);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-light, #6B7280);
    transition: all 0.2s ease;
}

.form-type-card.selected .card-icon {
    background: #2B4A6F;
    color: white;
}

.form-type-card .card-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary, #1F2937);
    margin: 0;
}

.form-type-card .card-subtitle {
    font-size: 0.875rem;
    color: var(--text-light, #6B7280);
    margin: 0;
}

.form-type-card .card-description {
    font-size: 0.875rem;
    color: #4B5563;
    line-height: 1.5;
    margin-bottom: 1rem;
}

.form-type-card .card-features {
    list-style: none;
    padding: 0;
    margin: 0;
}

.form-type-card .card-features li {
    font-size: 0.813rem;
    color: var(--text-light, #6B7280);
    padding: 0.25rem 0;
    padding-left: 1.25rem;
    position: relative;
}

.form-type-card .card-features li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0.5rem;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #D1D5DB;
}

.form-type-card.selected .card-features li::before {
    background: #2B4A6F;
}

/* ==========================================
   COMMITTEE SECTION
   ========================================== */

.committee-section {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

.committee-section h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary, #1F2937);
    margin-bottom: 0.5rem;
}

.committee-section .section-description {
    font-size: 0.875rem;
    color: var(--text-light, #6B7280);
    margin-bottom: 1rem;
}

.committee-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.committee-row {
    display: flex;
    gap: 1rem;
    padding: 1rem;
    background: var(--bg-subtle);
    border-radius: 0.5rem;
    border: 1px solid var(--border);
}

.committee-fields {
    flex: 1;
}

.committee-row .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.committee-row .form-row:last-child {
    margin-bottom: 0;
}

.committee-row .btn-remove {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    color: #9CA3AF;
    cursor: pointer;
    border-radius: 0.375rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    align-self: flex-start;
    margin-top: 1.75rem;
}

.committee-row .btn-remove:hover {
    background: #FEE2E2;
    color: #DC2626;
}

.btn-add-committee {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border: 2px dashed #D1D5DB;
    border-radius: 0.5rem;
    background: transparent;
    color: var(--text-light, #6B7280);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 0.5rem;
}

.btn-add-committee:hover {
    border-color: var(--primary);
    color: #2B4A6F;
    background: rgba(43, 74, 111, 0.05);
}

/* ==========================================
   THRESHOLD DATE SECTION (Form 470 Supplement)
   ========================================== */

.threshold-section {
    background: #FEF3C7;
    border: 1px solid #FCD34D;
    border-radius: 0.5rem;
    padding: 1.25rem;
    margin-top: 1.5rem;
}

.threshold-section h4 {
    color: #92400E;
    font-size: 0.875rem;
    font-weight: 600;
    margin: 0 0 0.5rem 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.threshold-section h4 svg {
    width: 18px;
    height: 18px;
}

.threshold-section p {
    font-size: 0.813rem;
    color: #92400E;
    margin: 0 0 1rem 0;
    line-height: 1.5;
}

/* ==========================================
   AMENDMENT SECTION
   ========================================== */

.amendment-section {
    margin-top: 1.5rem;
    padding: 1.25rem;
    background: #F9FAFB;
    border-radius: 0.5rem;
    border: 1px solid var(--border);
}

.amendment-checkbox {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.amendment-checkbox input[type="checkbox"] {
    margin-top: 0.25rem;
    width: 18px;
    height: 18px;
    accent-color: #2B4A6F;
}

.amendment-checkbox label {
    font-size: 0.875rem;
    color: #374151;
    line-height: 1.5;
}

.amendment-explanation {
    display: none;
}

.amendment-explanation.visible {
    display: block;
}

/* ==========================================
   REVIEW SECTION (Step 4)
   ========================================== */

.review-section {
    background: white;
    border-radius: 0.75rem;
    border: 1px solid var(--border);
    overflow: hidden;
}

.review-header {
    background: var(--border-light);
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
}

.review-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary, #1F2937);
}

.review-content {
    padding: 1.25rem;
}

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

.review-item {
    padding: 0.75rem 0;
    border-bottom: 1px solid #F3F4F6;
}

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

.review-item label {
    display: block;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-light, #6B7280);
    text-transform: uppercase;
    letter-spacing: 0.025em;
    margin-bottom: 0.25rem;
}

.review-item .value {
    font-size: 0.938rem;
    color: var(--text-primary, #1F2937);
    white-space: pre-line;
}

.review-item .value.empty {
    color: #9CA3AF;
    font-style: italic;
}

.review-committees {
    margin-top: 1.5rem;
}

.committee-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.committee-item {
    padding: 0.75rem;
    background: #F9FAFB;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    color: #374151;
    line-height: 1.5;
}

/* ==========================================
   DOWNLOAD SECTION
   ========================================== */

.download-section {
    display: none;
    margin-top: 2rem;
    padding: 1.5rem;
    background: #EFF6FF;
    border-radius: 0.75rem;
    border: 1px solid #BFDBFE;
}

.download-section h3 {
    color: #1E40AF;
    font-size: 1.125rem;
    margin: 0 0 0.5rem 0;
}

.download-section p {
    color: #3B82F6;
    font-size: 0.875rem;
    margin: 0 0 1.25rem 0;
}

.download-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.btn-download {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
}

.btn-download.primary {
    background: #2B4A6F;
    color: white;
}

.btn-download.primary:hover {
    background: #1E3A5F;
}

.btn-download.secondary {
    background: white;
    color: #2B4A6F;
    border: 1px solid #2B4A6F;
}

.btn-download.secondary:hover {
    background: rgba(43, 74, 111, 0.05);
}

/* ==========================================
   SAMPLE DATA MODAL
   ========================================== */

.sample-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.sample-modal-content {
    background: white;
    border-radius: 0.75rem;
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
}

.sample-modal-header {
    padding: 1.25rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sample-modal-header h3 {
    margin: 0;
    font-size: 1.125rem;
    color: var(--text-primary, #1F2937);
}

.sample-modal-close {
    background: none;
    border: none;
    color: var(--text-light, #6B7280);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 0.375rem;
}

.sample-modal-close:hover {
    background: var(--border-light);
    color: var(--text-primary, #1F2937);
}

.sample-modal-body {
    padding: 1.25rem;
}

.sample-options {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.sample-option {
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.sample-option:hover {
    border-color: var(--primary);
    background: rgba(43, 74, 111, 0.02);
}

.sample-option h4 {
    margin: 0 0 0.25rem 0;
    font-size: 0.938rem;
    color: var(--text-primary, #1F2937);
}

.sample-option p {
    margin: 0;
    font-size: 0.813rem;
    color: var(--text-light, #6B7280);
}

/* ==========================================
   INFO BOXES
   ========================================== */

.info-box {
    display: flex;
    gap: 0.75rem;
    padding: 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1.5rem;
}

.info-box.info {
    background: #EFF6FF;
    border: 1px solid #BFDBFE;
}

.info-box.warning {
    background: #FEF3C7;
    border: 1px solid #FCD34D;
}

.info-box.success {
    background: #ECFDF5;
    border: 1px solid #A7F3D0;
}

.info-box .icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
}

.info-box.info .icon {
    color: #3B82F6;
}

.info-box.warning .icon {
    color: #F59E0B;
}

.info-box.success .icon {
    color: #059669;
}

.info-box .content {
    flex: 1;
}

.info-box .content strong {
    display: block;
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
}

.info-box.info .content strong {
    color: #1E40AF;
}

.info-box.warning .content strong {
    color: #92400E;
}

.info-box.success .content strong {
    color: #065F46;
}

.info-box .content p {
    margin: 0;
    font-size: 0.813rem;
    line-height: 1.5;
}

.info-box.info .content p {
    color: #3B82F6;
}

.info-box.warning .content p {
    color: #B45309;
}

.info-box.success .content p {
    color: #047857;
}

/* ==========================================
   IMPORT FORM 410 BANNER
   ========================================== */

.import-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: linear-gradient(135deg, #EEF2FF 0%, #E0E7FF 100%);
    border: 1px solid #C7D2FE;
    border-radius: 0.5rem;
    margin-bottom: 1.5rem;
}

.import-banner .banner-text {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: #4338CA;
}

.import-banner .banner-text svg {
    width: 18px;
    height: 18px;
}

.import-banner .btn-import {
    padding: 0.5rem 1rem;
    background: #4338CA;
    color: white;
    border: none;
    border-radius: 0.375rem;
    font-size: 0.813rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s ease;
}

.import-banner .btn-import:hover {
    background: #3730A3;
}

/* ==========================================
   FORM INPUT OVERFLOW FIX
   ========================================== */

#form470Wizard input,
#form470Wizard select,
#form470Wizard textarea,
#form470Modal input,
#form470Modal select,
#form470Modal textarea {
    max-width: 100%;
    box-sizing: border-box;
}

#form470Wizard .form-group,
#form470Modal .form-group {
    max-width: 100%;
    overflow: hidden;
}

/* ==========================================
   RESPONSIVE
   ========================================== */

@media (max-width: 768px) {
    .form-type-selection {
        grid-template-columns: 1fr;
    }

    .committee-row .form-row {
        grid-template-columns: 1fr;
    }

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

    .download-buttons {
        flex-direction: column;
    }

    .btn-download {
        width: 100%;
        justify-content: center;
    }

    .import-banner {
        flex-direction: column;
        gap: 0.75rem;
        text-align: center;
    }

    .import-banner .btn-import {
        width: 100%;
    }

    /* Override inline grid styles that cause horizontal scroll on mobile */
    #form470Wizard .form-row[style*="grid-template-columns"],
    #form470Modal .form-row[style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
    }

    #form470Wizard div[style*="grid-template-columns"],
    #form470Modal div[style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
    }
}

@media (max-width: 480px) {
    .form-type-card {
        padding: 1rem;
    }

    .form-type-card .card-icon {
        width: 40px;
        height: 40px;
    }

    .committee-row {
        flex-direction: column;
    }

    .committee-row .btn-remove {
        align-self: flex-end;
        margin-top: 0;
    }

    /* Ensure form body doesn't overflow on small screens */
    #form470Wizard,
    #form470Modal .form-builder-body {
        padding: 1rem;
        overflow-x: hidden;
    }
}

/* ==========================================
   PRINT STYLESHEET
   ========================================== */
@media print {
    #form470Modal.form-builder-modal {
        display: block !important;
        position: static !important;
        background: white !important;
        overflow: visible !important;
    }

    #form470Modal .form-builder-header,
    #form470Modal .form-builder-progress,
    #form470Modal .form-builder-footer,
    #form470Modal .modal-overlay,
    #form470Modal .validation-error-panel,
    .no-print {
        display: none !important;
    }

    #form470Modal .form-builder-body {
        overflow: visible !important;
        max-height: none !important;
        padding: 20px !important;
    }

    #form470Modal .review-section {
        page-break-inside: avoid;
        background: white !important;
        box-shadow: none !important;
    }

    #form470Modal .review-section::after {
        content: "Printed from Campaign Comply - For reference only. Official filing must use generated PDF.";
        display: block;
        margin-top: 20px;
        padding-top: 10px;
        border-top: 1px solid #ccc;
        font-size: 9pt;
        color: #666;
        text-align: center;
    }
}
