/**
 * Contact Form 7 Custom Styles for Challenger Tyre Theme
 * Ensures CF7 integrates seamlessly with the booking form design
 */

/* Remove CF7 default styles that conflict */
.wpcf7-form {
    margin: 0;
    padding: 0;
}

.wpcf7-form p {
    margin: 0;
}

/* Remove line breaks that CF7 adds */
.wpcf7-form br {
    display: none;
}

.wpcf7-form-control-wrap br {
    display: none;
}

/* Ensure quote-form wrapper applies proper styling - match original */
.quote-form .wpcf7 {
    /* Padding removed - using original .quote-form padding from main.css */
}

/* Tyre Specs - match original exactly */
.wpcf7 .tyre-specs {
    display: flex !important;
    gap: 1rem !important;
    margin-bottom: 1.5rem !important;
    align-items: flex-end !important;
    flex-wrap: wrap !important;
}

.wpcf7 .spec-group {
    flex: 1;
}

.wpcf7 .spec-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: #666;
    margin-bottom: 0.25rem !important;
}

.wpcf7 .spec-group select {
    margin: 0 !important;
    padding: 0.75rem !important;
}

/* Mobile: 2 rows of 2 for tyre specs */
@media (max-width: 768px) {
    .wpcf7 .spec-group {
        flex: 0 0 calc(50% - 0.5rem) !important;
        max-width: calc(50% - 0.5rem) !important;
    }
}

/* Form sections - tighter spacing */
.wpcf7 .form-section {
    margin-bottom: 1.5rem !important;
}

.wpcf7 .form-section:first-child {
    margin-bottom: 1.5rem !important;
}

.wpcf7 .form-section-title {
    margin-bottom: 1rem !important;
    font-size: 0.85rem !important;
}

/* Contact fields - with spacing between */
.wpcf7 .contact-fields {
    display: flex !important;
    flex-direction: column !important;
}

.wpcf7 .contact-fields > p {
    position: relative;
    margin: 0 0 1rem 0 !important;
}

.wpcf7 .contact-fields > p:last-child {
    margin-bottom: 0 !important;
}

.wpcf7 .contact-fields input,
.wpcf7 .contact-fields textarea {
    margin: 15px 0 0 0 !important;
    width: 100% !important;
}

/* Override focus styles for CF7 contact fields - use pink/magenta, not red */
.wpcf7 .contact-fields input:focus,
.wpcf7 .contact-fields textarea:focus {
    outline: none !important;
    border-color: #e91e8c !important;
    background: white !important;
    box-shadow: 0 0 0 3px rgba(233, 30, 140, 0.1) !important;
}

.wpcf7 .contact-fields textarea {
    margin-bottom: 0 !important;
}

.wpcf7 .contact-fields .wpcf7-not-valid-tip {
    display: block;
    margin-top: 0.5rem;
    position: static;
}

.wpcf7 .contact-fields textarea {
    height: 66px !important;
    min-height: 66px !important;
    max-height: 200px !important;
    resize: vertical;
}

/* Ensure booking form wrapper doesn't have extra padding/margins */
.wpcf7 .booking-form-wrapper {
    margin: 0;
    padding: 0;
}

/* Fix CF7 form responsiveness */
.wpcf7-form-control-wrap {
    display: block;
    width: 100%;
}

/* Ensure text inputs match original styling */
.wpcf7 input[type="text"],
.wpcf7 input[type="email"],
.wpcf7 input[type="tel"],
.wpcf7 textarea {
    width: 100%;
}

/* Fix select dropdowns - ensure proper width */
.wpcf7 select {
    width: 100% !important;
    min-width: 100px;
}

.wpcf7 .spec-group select {
    width: 100% !important;
}

/* Registration Input Styling - UK Plate Style */
.wpcf7 .reg-input-group {
    margin-bottom: 2.25rem;
    position: relative;
    min-height: 60px;
}

.wpcf7 .reg-input-cf7 {
    width: 100%;
    background: #ffd500;
    border: 3px solid #000;
    border-radius: 6px;
    padding: 0.5rem 0.5rem 0.5rem 3.5rem;
    font-size: 1.5rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-family: 'Montserrat', sans-serif;
    color: #000;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    text-align: left;
}

.wpcf7 .reg-input-cf7::placeholder {
    color: #666;
    font-weight: 600;
    letter-spacing: 1px;
}

.wpcf7 .reg-input-cf7:focus {
    outline: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
    border-color: #000;
}

/* GB badge positioned center-left in the yellow box */
.wpcf7 .reg-input-group::before {
    content: 'GB';
    position: absolute;
    left: 0.5rem;
    top: 25px;
    transform: translateY(-50%);
    background: #003399;
    color: #ffd500;
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    font-weight: 700;
    font-size: 0.9rem;
    z-index: 10;
    pointer-events: none;
}

/* Remove CF7 validation styles that conflict */
.wpcf7-not-valid-tip {
    color: #f00;
    font-size: 0.85rem;
    margin-top: 0.5rem;
    display: block;
}

/* Remove red borders from invalid fields */
.wpcf7-not-valid {
    border-color: #e5e7eb !important;
}

/* Only show red border when field is blurred and has validation error */
.wpcf7-form .wpcf7-not-valid:not(:focus) {
    border-color: #dc3545 !important;
}

/* While typing/focused, use normal focus styling */
.wpcf7-form input.wpcf7-not-valid:focus,
.wpcf7-form textarea.wpcf7-not-valid:focus,
.wpcf7-form select.wpcf7-not-valid:focus {
    border-color: #e91e8c !important;
    background: white !important;
    box-shadow: 0 0 0 3px rgba(233, 30, 140, 0.1) !important;
}

/* Ensure validation on reg input doesn't affect GB badge */
.wpcf7 .reg-input-cf7:invalid {
    /* Keep same styling even when invalid */
}

.wpcf7 .reg-input-group .wpcf7-not-valid-tip {
    margin-top: 0.5rem;
    margin-bottom: 0;
    position: absolute;
    bottom: -1.75rem;
    left: 0;
}

.wpcf7-validation-errors,
.wpcf7-mail-sent-ok {
    border: 2px solid #28a745;
    margin: 1rem 0 0 0;
    padding: 1rem;
    border-radius: 6px;
    background: #d4edda;
    color: #000;
}

.wpcf7-validation-errors {
    border-color: #dc3545;
    background: #f8d7da;
    color: #000;
    font-weight: 600;
}

/* Response output - base styling */
.wpcf7-response-output {
    padding: 1rem !important;
    border-radius: 6px !important;
    margin: 0.75rem 0 0 0 !important;
    font-weight: 600 !important;
    text-align: center !important;
    color: #000 !important;
}

/* Override hero section white text for all form elements */
.hero .wpcf7-response-output,
.hero .form-message,
.hero .quote-form,
.hero .quote-form *,
.hero .booking-card,
.hero .booking-card *,
.hero .form-section-title,
.hero label,
.hero input,
.hero select,
.hero textarea,
.hero .spec-group label {
    color: #000 !important;
}

/* Keep button text WHITE */
.hero .quote-submit-btn,
.hero .wpcf7-submit,
.hero input[type="submit"] {
    color: #fff !important;
}

/* Ensure placeholder text is visible */
.hero input::placeholder,
.hero textarea::placeholder {
    color: #666 !important;
    opacity: 1 !important;
}

/* Success message styling - GREEN border with BLACK text */
.wpcf7-mail-sent-ok {
    border: 2px solid #28a745 !important;
    background: #d4edda !important;
    color: #000 !important;
}

/* Error message styling - RED border with BLACK text */
.wpcf7-validation-errors,
.wpcf7-mail-sent-ng,
.wpcf7-spam-blocked {
    border: 2px solid #dc3545 !important;
    background: #f8d7da !important;
    color: #000 !important;
}

/* Additional CF7 response output styling */
.wpcf7 form.invalid .wpcf7-response-output,
.wpcf7 form.unaccepted .wpcf7-response-output,
.wpcf7 form.payment-required .wpcf7-response-output {
    border: 2px solid #dc3545 !important;
    background: #f8d7da !important;
    color: #000 !important;
}

.wpcf7 form.sent .wpcf7-response-output {
    border: 2px solid #28a745 !important;
    background: #d4edda !important;
    color: #000 !important;
}

/* Remove padding/margin from p tag around submit button */
.wpcf7-form p:has(.quote-submit-btn) {
    margin: 0 !important;
    padding: 0 !important;
}

/* Ensure submit button inherits theme styles */
.wpcf7 .quote-submit-btn {
    width: 100%;
    background: #000;
    color: white;
    padding: 1.25rem;
    border: none;
    border-radius: 6px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    letter-spacing: 1px;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    margin-top: 1rem;
    margin-bottom: 0 !important;
}

.wpcf7 .quote-submit-btn:hover {
    background: #000;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.wpcf7 .quote-submit-btn:active {
    transform: translateY(0);
}

/* Fix spinner positioning */
.wpcf7 .ajax-loader {
    display: inline-block;
    margin-left: 1rem;
}

/* Ensure form sections maintain spacing */
.wpcf7 .form-section {
    margin-bottom: 1.5rem;
}

.wpcf7 .form-section:last-child {
    margin-bottom: 0;
}
