/**
 * Campaign Builder Forms - ADA Compliant Styles
 * Mobile-first, accessible, high contrast
 */

/* ==========================================================================
   Form Base Styles
   ========================================================================== */

.cb-form {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    max-width: 600px;
    margin: 0 auto;
}

.cb-form * {
    box-sizing: border-box;
}

.cb-form-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 0 1.5rem 0;
    color: #1a1a1a;
}

/* ==========================================================================
   Form Fields
   ========================================================================== */

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

@media (min-width: 600px) {
    .cb-form-row {
        grid-template-columns: 1fr 1fr;
    }
}

.cb-form-field {
    display: flex;
    flex-direction: column;
}

.cb-form-field label {
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #374151;
}

.cb-form-field label .required {
    color: #dc2626;
}

.cb-form-field input,
.cb-form-field textarea,
.cb-form-field select {
    width: 100%;
    padding: 0.875rem 1rem;
    font-size: 1rem;
    line-height: 1.5;
    color: #1f2937;
    background-color: #ffffff;
    border: 2px solid #d1d5db;
    border-radius: 6px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.cb-form-field input:hover,
.cb-form-field textarea:hover,
.cb-form-field select:hover {
    border-color: #9ca3af;
}

.cb-form-field input:focus,
.cb-form-field textarea:focus,
.cb-form-field select:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

.cb-form-field input::placeholder,
.cb-form-field textarea::placeholder {
    color: #9ca3af;
}

.cb-form-field textarea {
    resize: vertical;
    min-height: 120px;
}

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

/* ==========================================================================
   Checkbox and Radio Styles
   ========================================================================== */

.cb-checkbox-group {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

@media (min-width: 600px) {
    .cb-checkbox-group {
        grid-template-columns: 1fr 1fr;
    }
}

.cb-checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    cursor: pointer;
    font-size: 0.9375rem;
    line-height: 1.5;
    color: #374151;
}

.cb-checkbox-label input[type="checkbox"],
.cb-checkbox-label input[type="radio"] {
    width: 20px;
    height: 20px;
    margin: 2px 0 0 0;
    flex-shrink: 0;
    cursor: pointer;
    accent-color: #2563eb;
}

.cb-checkbox-label span {
    flex: 1;
}

.cb-form-consent {
    margin: 1.25rem 0;
    padding: 1rem;
    background: #f9fafb;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
}

.cb-form-consent .cb-checkbox-label {
    font-size: 0.8125rem;
    color: #6b7280;
}

/* ==========================================================================
   Submit Button
   ========================================================================== */

.cb-form-submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 1rem 2rem;
    font-size: 1rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #ffffff;
    background-color: #1e3a5f;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.1s ease, box-shadow 0.2s ease;
}

.cb-form-submit:hover {
    filter: brightness(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.cb-form-submit:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.5), 0 0 0 5px currentColor;
}

.cb-form-submit:active {
    transform: translateY(1px);
}

.cb-form-submit:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.cb-form-submit.cb-loading {
    position: relative;
    color: transparent;
}

.cb-form-submit.cb-loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border: 2px solid transparent;
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: cb-spin 0.8s linear infinite;
}

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

/* ==========================================================================
   Form Messages
   ========================================================================== */

.cb-form-message {
    margin-top: 1rem;
    padding: 0;
    font-size: 0.9375rem;
    font-weight: 500;
    text-align: center;
    border-radius: 6px;
    transition: all 0.3s ease;
}

.cb-form-message:empty {
    display: none;
}

.cb-form-message.cb-success {
    padding: 1rem;
    color: #065f46;
    background-color: #d1fae5;
    border: 1px solid #6ee7b7;
}

.cb-form-message.cb-error {
    padding: 1rem;
    color: #991b1b;
    background-color: #fee2e2;
    border: 1px solid #fca5a5;
}

/* ==========================================================================
   Inline Form Style (Newsletter in Hero)
   ========================================================================== */

.cb-form-inline,
.cb-form-signup.cb-form-dark {
    max-width: 100%;
}

.cb-form-inline .cb-form-inline-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

@media (min-width: 500px) {
    .cb-form-inline .cb-form-inline-group {
        flex-direction: row;
    }
    
    .cb-form-inline .cb-form-field {
        flex: 1;
    }
    
    .cb-form-inline .cb-form-submit {
        width: auto;
        flex-shrink: 0;
    }
}

.cb-form-inline .cb-form-field input {
    padding: 0.875rem 1rem;
}

/* ==========================================================================
   Dark Form Style (for dark backgrounds like Ford's)
   ========================================================================== */

.cb-form-dark {
    background: transparent;
}

.cb-form-dark .cb-form-field input,
.cb-form-dark .cb-form-field textarea {
    background: #ffffff;
    border: none;
    border-radius: 0;
    padding: 1rem;
}

.cb-form-dark .cb-form-field input:focus,
.cb-form-dark .cb-form-field textarea:focus {
    box-shadow: inset 0 0 0 2px #2563eb;
}

.cb-form-dark .cb-form-submit {
    border-radius: 0;
    background: #C41E3A;
}

.cb-form-dark .cb-form-consent {
    background: transparent;
    border: none;
    padding: 0.75rem 0;
}

.cb-form-dark .cb-form-consent .cb-checkbox-label {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.75rem;
}

.cb-form-dark .cb-form-consent .cb-checkbox-label a {
    color: #ffffff;
    text-decoration: underline;
}

/* ==========================================================================
   Get Involved Form (Full with Image - Ford Style)
   ========================================================================== */

.cb-form-get-involved {
    max-width: none;
    padding: 3rem 2rem;
}

.cb-form-get-involved .cb-form-title {
    color: #ffffff;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
}

.cb-form-get-involved .cb-form-subtitle {
    color: #ffffff;
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
}

.cb-form-get-involved .cb-form-field input {
    background: transparent;
    border: none;
    border-bottom: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 0;
    color: #ffffff;
    padding: 0.75rem 0;
}

.cb-form-get-involved .cb-form-field input::placeholder {
    color: rgba(255, 255, 255, 0.7);
}

.cb-form-get-involved .cb-form-field input:focus {
    border-bottom-color: #ffffff;
    box-shadow: none;
}

.cb-form-get-involved .cb-form-field label {
    color: #ffffff;
}

.cb-form-get-involved .cb-form-submit {
    margin-top: 1rem;
    background: #C41E3A;
    width: 100%;
}

/* ==========================================================================
   Volunteer Form
   ========================================================================== */

.cb-form-volunteer .cb-checkbox-group {
    grid-template-columns: 1fr;
}

@media (min-width: 600px) {
    .cb-form-volunteer .cb-checkbox-group {
        grid-template-columns: 1fr 1fr;
    }
}

/* ==========================================================================
   High Contrast / Reduced Motion
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
    .cb-form *,
    .cb-form-submit,
    .cb-form-message {
        transition: none;
        animation: none;
    }
    
    .cb-form-submit.cb-loading::after {
        animation: none;
        border-color: #ffffff;
    }
}

@media (prefers-contrast: high) {
    .cb-form-field input,
    .cb-form-field textarea,
    .cb-form-field select {
        border-width: 3px;
        border-color: #000000;
    }
    
    .cb-form-field input:focus,
    .cb-form-field textarea:focus,
    .cb-form-field select:focus {
        border-color: #0000ff;
        box-shadow: 0 0 0 4px #ffff00;
    }
    
    .cb-form-submit:focus {
        box-shadow: 0 0 0 4px #ffff00;
    }
}

/* ==========================================================================
   Form Error States
   ========================================================================== */

.cb-form-field.cb-error input,
.cb-form-field.cb-error textarea {
    border-color: #dc2626;
    background-color: #fef2f2;
}

.cb-form-field .cb-field-error {
    margin-top: 0.375rem;
    font-size: 0.8125rem;
    color: #dc2626;
}

/* ==========================================================================
   Honeypot (hidden)
   ========================================================================== */

.cb-form-hp {
    position: absolute !important;
    left: -9999px !important;
    opacity: 0;
    pointer-events: none;
}
