/* Form-specific CSS for RateDriven Forms */

/* Import Google Fonts for better typography */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* Override font family for forms */
.form-container {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Progress Bar for Simple Form */
.progress-container {
    max-width: 600px;
    margin: 0 auto;
}

.progress-bar-custom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    margin-bottom: 2rem;
}

.progress-bar-custom::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 2px;
    background: #e9ecef;
    transform: translateY(-50%);
    z-index: 1;
}

.progress-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    z-index: 2;
    background: white;
    padding: 0 10px;
}

.step-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #e9ecef;
    color: #6c757d;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 8px;
    transition: all 0.3s ease;
}

.progress-step.active .step-circle {
    background: var(--primary-color, #0066cc);
    color: white;
}

.progress-step.completed .step-circle {
    background: #28a745;
    color: white;
}

.step-label {
    font-size: 12px;
    font-weight: 500;
    color: #6c757d;
    text-align: center;
    white-space: nowrap;
}

.progress-step.active .step-label {
    color: var(--primary-color, #0066cc);
    font-weight: 600;
}

/* Form Card */
.form-card {
    padding: 3rem;
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    min-height: 600px;
}

/* Form Header */
.form-header h2 {
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    font-size: 1.75rem;
    line-height: 1.3;
    margin-bottom: 1rem;
}

.form-header p {
    font-size: 1rem;
    color: #6c757d;
}

/* Form Steps */
.form-step {
    display: none;
    animation: fadeInUp 0.5s ease-out;
}

.form-step.active {
    display: block;
}

/* Form Controls */
.form-control-lg, .form-select-lg {
    padding: 0.875rem 1rem;
    font-size: 1rem;
    border-radius: 8px;
    border: 2px solid #e9ecef;
    font-family: 'Inter', sans-serif;
    font-weight: 400;
    transition: all 0.3s ease;
}

.form-control-lg:focus, .form-select-lg:focus {
    border-color: var(--primary-color, #0066cc);
    box-shadow: 0 0 0 0.2rem rgba(0, 102, 204, 0.25);
    outline: none;
}

.form-control-lg.is-invalid, .form-select-lg.is-invalid {
    border-color: #dc3545;
}

.form-control-lg.is-valid, .form-select-lg.is-valid {
    border-color: #28a745;
}

/* Form Labels */
.form-label {
    font-weight: 600;
    color: #495057;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    font-family: 'Inter', sans-serif;
}

/* Input Groups */
.input-group-text {
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-right: none;
    font-weight: 500;
    color: #495057;
}

.input-group .form-control-lg {
    border-left: none;
}

.input-group .form-control-lg:focus + .input-group-text,
.input-group-text + .form-control-lg:focus {
    border-color: var(--primary-color, #0066cc);
}

/* Buttons */
.btn-lg {
    padding: 0.75rem 2rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 8px;
    font-family: 'Inter', sans-serif;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
}

.btn-primary {
    background: var(--gradient-primary);
    border: none;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.25);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
    background: var(--gradient-secondary);
}

.btn-outline-secondary {
    border: 2px solid #6c757d;
    color: #6c757d;
    background: transparent;
}

.btn-outline-secondary:hover {
    background: #6c757d;
    border-color: #6c757d;
    color: white;
    transform: translateY(-1px);
}

.btn.rounded-pill {
    border-radius: 50px !important;
    padding: 0.75rem 2.5rem;
}

/* OTP Inputs */
.otp-container {
    max-width: 400px;
    margin: 0 auto;
}

.otp-inputs {
    gap: 1rem;
}

.otp-input {
    width: 60px;
    height: 60px;
    font-size: 1.5rem;
    font-weight: 700;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    text-align: center;
    transition: all 0.3s ease;
}

.otp-input:focus {
    border-color: var(--primary-color, #0066cc);
    box-shadow: 0 0 0 0.2rem rgba(0, 102, 204, 0.25);
    transform: scale(1.05);
}

/* Housing Status Buttons */
.housing-status-buttons {
    margin: 2rem 0;
}

.housing-option {
    flex: 1;
}

.housing-option .btn {
    width: 100%;
    min-height: 120px;
    border: 2px solid #e9ecef;
    background: white;
    color: #6c757d;
    transition: all 0.3s ease;
}

.housing-option .btn:hover {
    border-color: var(--primary-color, #0066cc);
    color: var(--primary-color, #0066cc);
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 102, 204, 0.15);
}

.housing-option input[type="radio"]:checked + .btn {
    background: var(--primary-color, #0066cc);
    border-color: var(--primary-color, #0066cc);
    color: white;
}

.housing-icon {
    transition: all 0.3s ease;
}

.housing-option:hover .housing-icon i {
    transform: scale(1.1);
}

/* Selected Vehicle Card */
.selected-vehicle-card {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 1px solid #dee2e6;
    border-radius: 12px;
}

/* Vehicle Accessories */
.vehicle-accessories .form-check {
    padding: 1rem;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.vehicle-accessories .form-check:hover {
    border-color: var(--primary-color, #0066cc);
    background: rgba(0, 102, 204, 0.05);
}

.vehicle-accessories .form-check-input:checked + .form-check-label {
    color: var(--primary-color, #0066cc);
    font-weight: 600;
}

/* Offer Cards */
.offers-container {
    margin: 2rem 0;
}

.offer-card {
    transition: all 0.3s ease;
    border-radius: 12px;
    overflow: hidden;
}

.offer-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.15);
}

.offer-header {
    background: linear-gradient(135deg, var(--primary-color, #0066cc) 0%, #004d99 100%);
}

.offer-amount h2 {
    font-size: 2.5rem;
    font-weight: 700;
}

.badge.bg-success {
    background: #28a745 !important;
    font-weight: 600;
    padding: 0.5rem 1rem;
    border-radius: 20px;
}

/* Consent Section */
.consent-section {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.consent-section .form-check {
    margin-bottom: 1rem;
}

.consent-section .form-check-label {
    font-size: 0.9rem;
    line-height: 1.5;
    color: #495057;
}

.consent-section .form-check-input {
    margin-top: 0.3rem;
}

.consent-section a {
    color: var(--primary-color, #0066cc);
    text-decoration: none;
    font-weight: 500;
}

.consent-section a:hover {
    text-decoration: underline;
}

/* Form Actions */
.form-actions {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid #e9ecef;
}

/* Next Steps Styling */
.success-icon {
    animation: bounceIn 0.8s ease-out;
}

.next-steps .step-item {
    border-left: 3px solid var(--primary-color, #0066cc);
}

.next-steps .step-number {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.1rem;
    background: var(--primary-color, #0066cc) !important;
}

/* Offer Footer */
.offer-footer {
    border-top: 2px solid #e9ecef;
    padding-top: 2rem;
}

.offer-disclaimers {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    font-size: 0.85rem;
    line-height: 1.6;
}

/* Enhanced Mobile Responsive Design for Forms */
@media (max-width: 992px) {
    .form-container {
        padding: 2rem 0;
    }

    .form-card {
        margin: 1rem;
        box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    }

    .progress-container {
        margin-bottom: 1.5rem;
    }
}

@media (max-width: 768px) {
    /* Form container and card adjustments */
    .form-container {
        padding: 1rem 0;
    }

    .form-card {
        padding: 2rem 1.5rem;
        min-height: auto;
        margin: 0.5rem;
        border-radius: 12px;
    }

    /* Form header improvements */
    .form-header {
        margin-bottom: 2rem;
    }

    .form-header h2 {
        font-size: 1.4rem;
        line-height: 1.3;
        margin-bottom: 1rem;
    }

    .form-header p {
        font-size: 0.9rem;
        margin-bottom: 0;
    }

    /* Progress bar mobile optimization */
    .progress-container {
        margin-bottom: 2rem;
    }

    .progress-bar-custom {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }

    .progress-bar-custom::before {
        display: none;
    }

    .progress-step {
        flex-direction: row;
        align-items: center;
        justify-content: flex-start;
        padding: 0.75rem 1rem;
        background: #f8f9fa;
        border-radius: 8px;
        border: 2px solid transparent;
        transition: all 0.3s ease;
    }

    .progress-step.active {
        background: rgba(0, 102, 204, 0.1);
        border-color: var(--primary-color, #0066cc);
    }

    .progress-step.completed {
        background: rgba(40, 167, 69, 0.1);
        border-color: #28a745;
    }

    .step-circle {
        margin-bottom: 0;
        margin-right: 1rem;
        width: 35px;
        height: 35px;
        font-size: 13px;
    }

    .step-label {
        white-space: normal;
        text-align: left;
        font-size: 0.9rem;
        margin: 0;
    }

    /* Form input improvements */
    .form-control-lg, .form-select-lg {
        padding: 1rem;
        font-size: 1rem;
        border-radius: 10px;
        margin-bottom: 0.5rem;
    }

    .form-label {
        font-size: 0.9rem;
        font-weight: 600;
        margin-bottom: 0.5rem;
    }

    /* Row spacing adjustments */
    .row.g-3 {
        --bs-gutter-x: 1rem;
        --bs-gutter-y: 1rem;
    }

    /* Input group improvements */
    .input-group {
        border-radius: 10px;
        overflow: hidden;
    }

    .input-group-text {
        padding: 1rem 0.75rem;
        font-size: 0.9rem;
    }

    /* Housing status buttons */
    .housing-status-buttons {
        flex-direction: column;
        gap: 1rem;
        margin: 1.5rem 0;
    }

    .housing-option .btn {
        min-height: 90px;
        padding: 1rem;
        border-radius: 12px;
        font-size: 0.95rem;
    }

    .housing-icon {
        margin-bottom: 0.5rem;
    }

    .housing-icon i {
        font-size: 1.8rem !important;
    }

    /* OTP inputs mobile optimization */
    .otp-container {
        margin: 2rem auto;
    }

    .otp-inputs {
        gap: 0.5rem;
        justify-content: center;
    }

    .otp-input {
        width: 45px;
        height: 45px;
        font-size: 1.1rem;
        border-radius: 8px;
    }

    .otp-actions {
        margin-top: 1.5rem;
    }

    .otp-actions .btn {
        margin: 0.25rem;
        min-width: 120px;
    }

    /* Offer cards mobile optimization */
    .offers-container {
        margin: 1.5rem 0;
    }

    .offers-container .row {
        gap: 1rem;
    }

    .offer-card {
        margin-bottom: 1rem;
        border-radius: 12px;
    }

    .offer-amount h2 {
        font-size: 1.8rem;
        margin-bottom: 0.5rem;
    }

    .offer-details p {
        font-size: 0.9rem;
        margin-bottom: 0.5rem;
    }

    .offer-header h5 {
        font-size: 1rem;
        margin: 0;
    }

    /* Vehicle accessories */
    .vehicle-accessories .row {
        gap: 0.75rem;
    }

    .vehicle-accessories .form-check {
        padding: 0.75rem;
        border-radius: 8px;
        font-size: 0.9rem;
    }

    /* Consent section */
    .consent-section {
        padding: 1.25rem;
        border-radius: 10px;
        margin-top: 1.5rem;
    }

    .consent-section .form-check-label {
        font-size: 0.85rem;
        line-height: 1.4;
    }

    /* Form actions */
    .form-actions {
        margin-top: 1.5rem;
        padding-top: 1.5rem;
        gap: 1rem;
    }

    .form-actions.d-flex {
        flex-direction: column;
    }

    .form-actions .btn {
        width: 100%;
        margin: 0;
    }

    /* Selected vehicle card */
    .selected-vehicle-card {
        padding: 1.25rem;
        border-radius: 10px;
        margin-bottom: 1.5rem;
    }

    .selected-vehicle-card h4, .selected-vehicle-card h5 {
        font-size: 1rem;
        margin-bottom: 0.5rem;
    }

    /* Address search improvements */
    .col-md-8 + .col-md-4 {
        margin-top: 0.5rem;
    }

    /* Employment section improvements */
    .col-md-3 + .col-md-3 {
        margin-top: 0;
    }
}

@media (max-width: 576px) {
    /* Extra small screen form optimizations */
    .form-card {
        padding: 1.5rem 1rem;
        margin: 0.25rem;
        border-radius: 10px;
    }

    .form-header h2 {
        font-size: 1.25rem;
        line-height: 1.3;
        margin-bottom: 0.75rem;
    }

    .form-header p {
        font-size: 0.85rem;
    }

    /* Progress steps for very small screens */
    .progress-step {
        padding: 0.5rem 0.75rem;
    }

    .step-circle {
        width: 30px;
        height: 30px;
        font-size: 12px;
        margin-right: 0.75rem;
    }

    .step-label {
        font-size: 0.8rem;
    }

    /* Form controls for small screens */
    .form-control-lg, .form-select-lg {
        padding: 0.875rem;
        font-size: 1rem; /* Maintain 16px to prevent zoom */
        border-radius: 8px;
    }

    .form-label {
        font-size: 0.85rem;
        margin-bottom: 0.4rem;
    }

    /* Button improvements */
    .btn-lg {
        padding: 0.75rem 1.5rem;
        font-size: 0.95rem;
        border-radius: 8px;
    }

    .btn.rounded-pill {
        padding: 0.75rem 2rem;
    }

    /* Form actions for small screens */
    .form-actions {
        margin-top: 1.25rem;
        padding-top: 1.25rem;
        flex-direction: column;
        gap: 0.75rem;
    }

    .form-actions .btn {
        width: 100%;
        margin: 0;
    }

    /* OTP for very small screens */
    .otp-input {
        width: 40px;
        height: 40px;
        font-size: 1rem;
        border-radius: 6px;
    }

    .otp-inputs {
        gap: 0.4rem;
    }

    .otp-actions .btn {
        min-width: 100px;
        font-size: 0.9rem;
        padding: 0.625rem 1rem;
    }

    /* Housing buttons for small screens */
    .housing-option .btn {
        min-height: 75px;
        padding: 0.75rem;
    }

    .housing-icon i {
        font-size: 1.5rem !important;
    }

    /* Offer cards for small screens */
    .offer-amount h2 {
        font-size: 1.5rem;
    }

    .offer-header h5 {
        font-size: 0.9rem;
    }

    .offer-details p {
        font-size: 0.8rem;
    }

    .badge {
        font-size: 0.7rem;
        padding: 0.35rem 0.75rem;
    }

    /* Vehicle accessories for small screens */
    .vehicle-accessories .form-check {
        padding: 0.625rem;
        font-size: 0.85rem;
    }

    /* Consent section for small screens */
    .consent-section {
        padding: 1rem;
    }

    .consent-section .form-check-label {
        font-size: 0.8rem;
        line-height: 1.3;
    }

    /* Selected vehicle adjustments */
    .selected-vehicle-card {
        padding: 1rem;
    }

    .selected-vehicle-card .d-flex {
        flex-direction: column;
        text-align: center;
    }

    .selected-vehicle-card .me-4 {
        margin-right: 0 !important;
        margin-bottom: 1rem;
    }

    /* Input group adjustments */
    .input-group-text {
        padding: 0.875rem 0.625rem;
        font-size: 0.85rem;
    }

    /* Row adjustments for very small screens */
    .row.g-3 {
        --bs-gutter-x: 0.75rem;
        --bs-gutter-y: 0.75rem;
    }

    /* Form text adjustments */
    .form-text {
        font-size: 0.75rem;
        margin-top: 0.25rem;
    }

    /* Disclaimer text */
    .offer-disclaimers {
        padding: 1rem;
        font-size: 0.75rem;
        line-height: 1.4;
    }
}

/* Touch-specific form improvements */
@media (hover: none) and (pointer: coarse) {
    .form-control, .form-select, .btn {
        min-height: 44px;
        font-size: 16px; /* Prevents zoom on iOS */
    }

    .form-check-input {
        min-width: 20px;
        min-height: 20px;
    }

    .otp-input {
        min-height: 44px;
        min-width: 44px;
    }

    .housing-option .btn {
        min-height: 80px;
    }

    /* Improved touch targets */
    .form-check {
        padding: 0.75rem;
        margin-bottom: 0.75rem;
    }

    .form-check-label {
        padding-left: 0.5rem;
        cursor: pointer;
    }
}

/* Enhanced focus states for mobile */
@media (max-width: 768px) {
    .form-control:focus,
    .form-select:focus {
        box-shadow: 0 0 0 0.25rem rgba(0, 102, 204, 0.25);
        border-width: 2px;
    }

    .btn:focus {
        box-shadow: 0 0 0 0.25rem rgba(0, 102, 204, 0.25);
    }

    .form-check-input:focus {
        box-shadow: 0 0 0 0.25rem rgba(0, 102, 204, 0.25);
    }
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes bounceIn {
    0% {
        transform: scale(0.3);
        opacity: 0;
    }
    50% {
        transform: scale(1.05);
        opacity: 1;
    }
    70% {
        transform: scale(0.9);
    }
    100% {
        transform: scale(1);
    }
}

/* Loading states */
.btn.loading {
    position: relative;
    pointer-events: none;
    opacity: 0.7;
}

.btn.loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    margin: auto;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

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

/* Custom Select Arrows */
.form-select {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m1 6 7 7 7-7'/%3e%3c/svg%3e");
}

.form-select:focus {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%230066cc' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m1 6 7 7 7-7'/%3e%3c/svg%3e");
}

/* Form validation feedback */
.invalid-feedback {
    display: block;
    font-size: 0.875rem;
    color: #dc3545;
    margin-top: 0.25rem;
}

.valid-feedback {
    display: block;
    font-size: 0.875rem;
    color: #28a745;
    margin-top: 0.25rem;
}

/* Accessibility improvements */
.form-control:focus,
.form-select:focus,
.btn:focus {
    outline: 2px solid var(--primary-color, #0066cc);
    outline-offset: 2px;
}

/* Vehicle Model Autocomplete */
.model-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #dee2e6;
    border-top: none;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
}

.model-suggestion {
    padding: 0.75rem 1rem;
    cursor: pointer;
    border-bottom: 1px solid #f8f9fa;
    transition: background-color 0.2s ease;
}

.model-suggestion:hover,
.model-suggestion.highlighted {
    background-color: #f8f9fa;
}

.model-suggestion:last-child {
    border-bottom: none;
}

.model-suggestion.selected {
    background-color: var(--primary-color, #0066cc);
    color: white;
}

.model-suggestion .text-muted {
    font-size: 0.85em;
    color: #6c757d !important;
}

.model-suggestion:hover .text-muted,
.model-suggestion.highlighted .text-muted {
    color: #495057 !important;
}

/* Position relative for the model field container */
.model-input-container {
    position: relative;
}

/* Processing Modal Styles */
#processingModal .modal-content {
    border: none;
    border-radius: 16px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
}

#processingModal .modal-body {
    padding: 3rem 2rem;
}

.processing-spinner .spinner-border {
    border-width: 4px;
    animation: spin 1s linear infinite;
}

.processing-steps {
    max-width: 350px;
    margin: 0 auto;
    text-align: left;
}

.processing-step {
    display: flex;
    align-items: center;
    padding: 1rem 0;
    position: relative;
    opacity: 0.4;
    transition: all 0.5s ease;
    font-size: 0.9rem;
    font-weight: 500;
}

.processing-step.active {
    opacity: 1;
    color: var(--primary-color, #0066cc);
}

.processing-step.completed {
    opacity: 0.8;
    color: #28a745;
}

.processing-step i {
    width: 20px;
    text-align: center;
    font-size: 1rem;
}

.processing-step .step-check {
    position: absolute;
    right: 0;
    opacity: 0;
    color: #28a745;
    font-weight: bold;
    transition: opacity 0.3s ease;
}

.processing-step.completed .step-check {
    opacity: 1;
}

.processing-step:not(:last-child)::after {
    content: '';
    position: absolute;
    left: 10px;
    top: 100%;
    width: 2px;
    height: 1rem;
    background: #e9ecef;
    transition: background-color 0.5s ease;
}

.processing-step.completed:not(:last-child)::after {
    background: #28a745;
}

/* Modal backdrop enhancement */
.modal-backdrop.show {
    background-color: rgba(0, 0, 0, 0.6);
}

/* Responsive adjustments for modal */
@media (max-width: 768px) {
    #processingModal .modal-body {
        padding: 2rem 1.5rem;
    }

    .processing-steps {
        max-width: 280px;
    }

    .processing-step {
        font-size: 0.85rem;
    }

    .processing-spinner .spinner-border {
        width: 3rem !important;
        height: 3rem !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .form-control-lg,
    .form-select-lg {
        border-width: 3px;
    }

    .btn {
        border-width: 3px;
    }
}