/* ===================================
   W-4 Form 2026 - Government Form Styles
   Bootstrap Card Layout with Tight Spacing
   =================================== */

/* ===================================
   1. GLOBAL STYLES
   =================================== */
* {
    box-sizing: border-box;
}

body {
    font-family: Arial, Helvetica, sans-serif;
    font-size: 10px;
    line-height: 1.4;
    color: #000;
    background-color: #e8e8e8;
    margin: 0;
    padding: 0;
}

/* ===================================
   2. FORM CONTAINER (Centered Document)
   =================================== */
.form-container {
    max-width: 1000px;
    margin: 40px auto;
    background-color: #ffffff;
    padding: 30px 40px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
}

/* ===================================
   3. BOOTSTRAP CARD WRAPPER
   =================================== */
.form-card {
    border: none;
    border-radius: 0;
    box-shadow: none;
    background-color: transparent;
}

.form-card .card-body {
    padding: 0;
}

/* ===================================
   4. FORM HEADER
   =================================== */
.form-header {
    border-bottom: 2px solid #000;
    padding-bottom: 12px;
    margin-bottom: 16px;
}

.form-title {
    font-size: 20px;
    font-weight: bold;
    color: #000;
    margin: 0;
    line-height: 1.1;
}

.form-subtitle {
    font-size: 14px;
    font-weight: bold;
    color: #000;
    margin: 2px 0 6px 0;
    line-height: 1.1;
}

.form-instructions {
    font-size: 9px;
    line-height: 1.3;
}

.form-instructions p {
    margin: 1px 0;
}

.year-badge {
    font-size: 24px;
    font-weight: bold;
    color: #000;
    margin: 0;
    line-height: 1;
}

/* ===================================
   4. STEP SECTIONS
   =================================== */
.step-section {
    border: 1px solid #333;
    background-color: #fff;
    margin-bottom: 12px;
}

.step-header-bar {
    display: flex;
    align-items: center;
    background: linear-gradient(180deg, #e8e8e8 0%, #d8d8d8 100%);
    border-bottom: 1px solid #333;
    padding: 6px 12px;
    gap: 8px;
}

.step-number-badge {
    font-weight: bold;
    font-size: 11px;
    color: #000;
}

.step-title-text {
    font-weight: bold;
    font-size: 11px;
    color: #000;
}

.step-body {
    padding: 12px 16px;
}

/* ===================================
   5. FORM LABELS
   =================================== */
.form-label-inline {
    font-size: 9px;
    font-weight: normal;
    color: #000;
    margin-bottom: 2px;
    line-height: 1.3;
    display: block;
}

.form-label-inline.fw-bold {
    font-weight: bold;
}

/* ===================================
   6. FORM CONTROLS
   =================================== */
.form-control,
.form-control-sm {
    font-size: 10px;
    border: 1px solid #666;
    border-radius: 0;
    padding: 3px 6px;
    height: auto;
    line-height: 1.4;
    background-color: #fff;
    width: 100%; /* Fill the column width */
    max-width: 100%;
}

.form-control:focus,
.form-control-sm:focus {
    border-color: #0066cc;
    box-shadow: 0 0 0 2px rgba(0, 102, 204, 0.15);
    outline: none;
}

.form-control:disabled,
.form-control[readonly],
.form-control-sm:disabled,
.form-control-sm[readonly] {
    background-color: #f5f5f5;
    border-color: #999;
    cursor: not-allowed;
    color: #555;
}

textarea.form-control,
textarea.form-control-sm {
    resize: vertical;
    min-height: 60px;
    width: 100%;
}

/* ===================================
   7. INPUT GROUPS (Currency Fields)
   =================================== */
.input-group {
    display: flex;
    width: 100%; /* Fill the column width */
}

.input-group-sm .input-group-text {
    font-size: 9px;
    padding: 3px 6px;
}

.input-group-text {
    background-color: #e9ecef;
    border: 1px solid #666;
    border-right: none;
    font-weight: 600;
    font-size: 10px;
    padding: 3px 8px;
    display: flex;
    align-items: center;
    white-space: nowrap;
    color: #000;
    flex-shrink: 0;
}

.input-group .form-control,
.input-group .form-control-sm {
    border-left: none;
    flex: 1 1 auto;
    width: auto; /* Override to let flex handle it */
}

.currency-input {
    font-family: 'Courier New', Courier, monospace;
    text-align: right;
}

/* ===================================
   8. CHECKBOXES & RADIO BUTTONS
   =================================== */
.form-check {
    padding-left: 1.2rem;
    margin-bottom: 6px;
}

.form-check-input {
    margin-top: 0.15rem;
    width: 13px;
    height: 13px;
}

.form-check-label {
    font-size: 9px;
    line-height: 1.4;
    color: #000;
}

.filing-status-group {
    padding: 6px 0;
}

/* ===================================
   9. INFORMATION BOXES
   =================================== */
.info-note {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    padding: 4px 6px;
    font-size: 8px;
    line-height: 1.3;
    color: #666;
}

.caution-box {
    border: 2px solid #000;
    padding: 8px;
    background-color: #fff;
    display: flex;
    gap: 6px;
}

.caution-box .box-label {
    font-weight: bold;
    font-size: 10px;
    text-transform: uppercase;
    flex-shrink: 0;
}

.caution-box .box-text {
    font-size: 9px;
    line-height: 1.4;
}

.tip-box {
    border: 1px solid #666;
    padding: 8px;
    background-color: #f9f9f9;
    display: flex;
    gap: 6px;
}

.tip-box .box-label {
    font-weight: bold;
    font-size: 10px;
    text-transform: uppercase;
    flex-shrink: 0;
}

.tip-box .box-text {
    font-size: 9px;
    line-height: 1.4;
}

.note-box-gray {
    background-color: #f5f5f5;
    border-left: 3px solid #666;
    padding: 6px 8px;
    font-size: 9px;
    line-height: 1.4;
}

.instructions-note {
    font-style: italic;
    color: #333;
    padding: 6px 8px;
    background-color: #fafafa;
    border: 1px solid #ddd;
    font-size: 9px;
    line-height: 1.4;
}

/* ===================================
   10. OPTIONS & LISTS
   =================================== */
.options-list {
    padding: 4px 0;
}

.option-item {
    font-size: 9px;
    line-height: 1.4;
}

.option-letter {
    font-weight: bold;
    margin-right: 3px;
}

.checkbox-option-box {
    border: 1px solid #ccc;
    padding: 6px 8px;
    background-color: #fafafa;
}

/* ===================================
   11. EXEMPT SECTION
   =================================== */
.exempt-box {
    border: 1px solid #000;
    padding: 8px;
    background-color: #f9f9f9;
}

.exempt-box .form-check {
    margin-bottom: 0;
}

.exempt-box .form-check-label {
    font-size: 9px;
}

/* ===================================
   12. SIGNATURE LINE
   =================================== */
.signature-line {
    border-bottom: 2px solid #000 !important;
    border-top: none !important;
    border-left: none !important;
    border-right: none !important;
    border-radius: 0 !important;
    background-color: transparent !important;
    padding-left: 0 !important;
}

/* ===================================
   13. EMPLOYER SECTION
   =================================== */
.employer-section {
    background-color: #fafafa;
    border: 2px solid #333;
    padding: 0;
}

.employer-header-bar {
    background: linear-gradient(180deg, #e0e0e0 0%, #d0d0d0 100%);
    border-bottom: 1px solid #333;
    padding: 6px 12px;
}

.employer-title-text {
    font-size: 11px;
    font-weight: bold;
    color: #000;
}

.employer-body {
    padding: 12px 16px;
}

/* ===================================
   14. FORM ACTIONS
   =================================== */
.form-actions {
    padding: 20px 0 10px 0;
    text-align: center;
    border-top: 2px solid #ddd;
    margin-top: 16px;
}

.btn {
    font-size: 12px;
    font-weight: 600;
    padding: 8px 20px;
    border-radius: 3px;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-lg {
    font-size: 13px;
    padding: 10px 28px;
}

.btn-secondary {
    background-color: #6c757d;
    color: #fff;
}

.btn-secondary:hover {
    background-color: #5a6268;
}

.btn-primary {
    background-color: #0066cc;
    color: #fff;
}

.btn-primary:hover {
    background-color: #0052a3;
}

.btn:focus {
    outline: 2px solid #0066cc;
    outline-offset: 2px;
}

/* ===================================
   15. FORM FOOTER
   =================================== */
.form-footer {
    font-size: 8px;
    color: #666;
    text-align: center;
    padding-top: 12px;
    border-top: 1px solid #ddd;
}

/* ===================================
   16. VALIDATION FEEDBACK
   =================================== */
.invalid-feedback {
    display: none;
    font-size: 9px;
    color: #dc3545;
    margin-top: 2px;
}

.was-validated .form-control:invalid ~ .invalid-feedback,
.was-validated .form-check-input:invalid ~ .invalid-feedback,
.form-control.is-invalid ~ .invalid-feedback {
    display: block;
}

.was-validated .form-control:invalid,
.form-control.is-invalid {
    border-color: #dc3545;
}

.was-validated .form-check-input:invalid,
.form-check-input.is-invalid {
    border-color: #dc3545;
}

#filingStatusError {
    display: none;
    margin-top: 6px;
    padding: 6px 8px;
    background-color: #f8d7da;
    border: 1px solid #dc3545;
    color: #721c24;
    font-size: 9px;
    border-radius: 2px;
}

#filingStatusError.show {
    display: block;
}

/* ===================================
   17. ALERTS
   =================================== */
.alert {
    font-size: 10px;
    padding: 10px 12px;
    margin-bottom: 12px;
    border-radius: 3px;
    border: 1px solid transparent;
}

.alert-success {
    background-color: #d4edda;
    border-color: #c3e6cb;
    color: #155724;
}

.alert-danger {
    background-color: #f8d7da;
    border-color: #f5c6cb;
    color: #721c24;
}

.alert-info {
    background-color: #d1ecf1;
    border-color: #bee5eb;
    color: #0c5460;
}

.alert-dismissible .btn-close {
    padding: 6px;
    font-size: 9px;
}

/* ===================================
   18. BOOTSTRAP GRID OVERRIDES
   =================================== */
.row.g-1 {
    --bs-gutter-x: 0.25rem;
    --bs-gutter-y: 0.25rem;
}

.row.g-2 {
    --bs-gutter-x: 0.5rem;
    --bs-gutter-y: 0.5rem;
}

/* ===================================
   19. UTILITY CLASSES
   =================================== */
.small {
    font-size: 9px !important;
}

.text-muted {
    color: #6c757d !important;
}

.text-danger {
    color: #dc3545 !important;
}

.fw-bold {
    font-weight: bold !important;
}

.fst-italic {
    font-style: italic !important;
}

.text-end {
    text-align: right !important;
}

.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: 4px !important; }
.mb-2 { margin-bottom: 8px !important; }
.mb-3 { margin-bottom: 12px !important; }
.mt-1 { margin-top: 4px !important; }
.mt-2 { margin-top: 8px !important; }
.me-2 { margin-right: 8px !important; }

/* ===================================
   20. RESPONSIVE DESIGN
   =================================== */
@media (max-width: 768px) {
    body {
        padding: 0;
    }

    .form-container {
        margin: 10px;
        padding: 16px 20px;
    }

    .form-card .card-body {
        padding: 0;
    }

    .form-title {
        font-size: 16px;
    }

    .form-subtitle {
        font-size: 12px;
    }

    .year-badge {
        font-size: 20px;
        margin-top: 6px;
    }

    .step-body {
        padding: 10px 12px;
    }

    .row.align-items-center {
        align-items: flex-start !important;
    }

    .form-label-inline.mb-0 {
        margin-bottom: 2px !important;
    }

    .btn-lg {
        width: 100%;
        margin-bottom: 8px;
    }

    .btn-lg.me-2 {
        margin-right: 0 !important;
    }

    /* Stack label and input on mobile */
    .row.g-2.align-items-center > [class*="col-md-"] {
        margin-bottom: 8px;
    }
}

/* ===================================
   21. PRINT STYLES
   =================================== */
@media print {
    body {
        background-color: #fff;
        padding: 0;
    }

    .form-container {
        max-width: 100%;
        margin: 0;
        padding: 16px;
        box-shadow: none;
    }

    .form-card {
        box-shadow: none;
        border: none;
    }

    .form-card .card-body {
        padding: 0;
    }

    .form-actions {
        display: none;
    }

    .btn {
        display: none;
    }

    .step-section {
        page-break-inside: avoid;
    }

    .alert {
        display: none;
    }
}

/* ===================================
   22. ACCESSIBILITY
   =================================== */
.form-control:focus,
.form-check-input:focus,
.btn:focus {
    outline: 2px solid #0066cc;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .step-section,
    .employer-section {
        border-width: 2px;
    }

    .form-control,
    .form-control-sm {
        border-width: 2px;
    }

    .step-header-bar,
    .employer-header-bar {
        border-bottom-width: 2px;
    }
}
