/* ==========================================================================
   CONTACT FORM FIXES - Server Deployment Compatibility - AGGRESSIVE VERSION
   ========================================================================== */

/* Force load highest priority for contact form styles */
.contact-form,
.contact-form-wrapper {
    position: relative !important;
    z-index: 1 !important;
}

/* HOMEPAGE CONTACT FORM - AGGRESSIVE FIXES */
html body .contact-section .contact-form,
html body .site-main .contact-form,
html body .contact-form {
    background-color: #f8f9fa !important;
    padding: 40px !important;
    border-radius: 15px !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05) !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
}

/* CONTACT PAGE FORM - AGGRESSIVE FIXES */
html body .main-contact-section .contact-form-wrapper,
html body .contact-form-wrapper {
    background: white !important;
    border-radius: 15px !important;
    padding: 30px !important;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1) !important;
    margin-bottom: 30px !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
}

/* AGGRESSIVE FORM CONTROL STYLING - ALL ENVIRONMENTS */
html body .contact-form .form-control,
html body .contact-form-wrapper .form-control,
html body .contact-section .form-control,
html body .main-contact-section .form-control,
.contact-form input[type="text"],
.contact-form input[type="email"], 
.contact-form input[type="tel"],
.contact-form textarea,
.contact-form select,
.contact-form-wrapper input[type="text"],
.contact-form-wrapper input[type="email"], 
.contact-form-wrapper input[type="tel"],
.contact-form-wrapper textarea,
.contact-form-wrapper select {
    width: 100% !important;
    min-width: 100% !important;
    max-width: 100% !important;
    padding: 15px 20px !important;
    border: 2px solid #e0e0e0 !important;
    border-radius: 8px !important;
    font-size: 16px !important;
    line-height: 1.5 !important;
    background-color: #ffffff !important;
    color: #333333 !important;
    transition: all 0.3s ease !important;
    box-sizing: border-box !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
    margin: 0 !important;
    outline: none !important;
}

/* Force textarea specific styling */
html body .contact-form textarea.form-control,
html body .contact-form-wrapper textarea.form-control {
    resize: vertical !important;
    min-height: 120px !important;
    height: auto !important;
    overflow: auto !important;
}

/* Force select dropdown styling */
html body .contact-form select.form-control,
html body .contact-form-wrapper select.form-control {
    background-image: url('data:image/svg+xml;charset=US-ASCII,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 4 5"><path fill="%23999" d="M2 0L0 2h4zm0 5L0 3h4z"/></svg>') !important;
    background-repeat: no-repeat !important;
    background-position: right 15px center !important;
    background-size: 12px !important;
    padding-right: 40px !important;
    cursor: pointer !important;
}

/* AGGRESSIVE FOCUS STATES */
html body .contact-form .form-control:focus,
html body .contact-form-wrapper .form-control:focus {
    outline: none !important;
    border-color: #ffc107 !important;
    box-shadow: 0 0 0 3px rgba(255, 193, 7, 0.2) !important;
}

/* AGGRESSIVE PLACEHOLDER STYLING */
html body .contact-form .form-control::placeholder,
html body .contact-form-wrapper .form-control::placeholder {
    color: #999999 !important;
    opacity: 1 !important;
    font-size: 15px !important;
}

/* AGGRESSIVE FORM GROUP LAYOUT */
html body .contact-form .form-group,
html body .contact-form-wrapper .form-group {
    margin-bottom: 25px !important;
    width: 100% !important;
    max-width: 100% !important;
    position: relative !important;
    box-sizing: border-box !important;
}

/* HOMEPAGE FORM ROW LAYOUT - AGGRESSIVE */
html body .contact-form .form-row {
    display: flex !important;
    flex-wrap: wrap !important;
    margin: 0 -10px !important;
    width: calc(100% + 20px) !important;
    box-sizing: border-box !important;
}

html body .contact-form .form-row .form-group {
    padding: 0 10px !important;
    box-sizing: border-box !important;
    margin-bottom: 25px !important;
}

html body .contact-form .form-row .col-md-6 {
    flex: 0 0 50% !important;
    max-width: 50% !important;
    width: 50% !important;
    box-sizing: border-box !important;
}

/* CONTACT PAGE VERTICAL LAYOUT - AGGRESSIVE */
html body .contact-form-wrapper .form-group {
    width: 100% !important;
    max-width: 100% !important;
    flex: 0 0 100% !important;
    padding: 0 !important;
    margin-bottom: 20px !important;
}

html body .contact-form-wrapper .row .col-md-6 {
    width: 100% !important;
    max-width: 100% !important;
    flex: 0 0 100% !important;
    padding: 0 !important;
    margin-bottom: 15px !important;
}

/* PRIVACY POLICY CHECKBOX - ULTRA AGGRESSIVE FIXES */
html body .contact-form .form-check,
html body .contact-form-wrapper .form-check,
html body .contact-section .form-check,
html body .main-contact-section .form-check {
    display: flex !important;
    align-items: flex-start !important;
    gap: 12px !important;
    margin-bottom: 20px !important;
    width: 100% !important;
    max-width: 100% !important;
    text-align: left !important;
    flex-wrap: nowrap !important;
    box-sizing: border-box !important;
}

html body .contact-form .form-check-input,
html body .contact-form-wrapper .form-check-input,
html body .contact-section .form-check-input,
html body .main-contact-section .form-check-input {
    margin: 2px 0 0 0 !important;
    width: 20px !important;
    height: 20px !important;
    min-width: 20px !important;
    max-width: 20px !important;
    flex-shrink: 0 !important;
    flex-grow: 0 !important;
    cursor: pointer !important;
    border: 2px solid #ccc !important;
    border-radius: 3px !important;
    background-color: #fff !important;
    position: relative !important;
    display: block !important;
    float: none !important;
}

/* PRIVACY POLICY TEXT - FORCE SINGLE LINE ON DESKTOP */
html body .contact-form .form-check-label,
html body .contact-form-wrapper .form-check-label,
html body .contact-section .form-check-label,
html body .main-contact-section .form-check-label {
    color: #666666 !important;
    line-height: 1.4 !important;
    cursor: pointer !important;
    font-size: 15px !important;
    flex: 1 !important;
    word-wrap: normal !important;
    white-space: nowrap !important;
    max-width: calc(100% - 32px) !important;
    text-align: left !important;
    margin: 0 !important;
    padding: 0 !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    display: block !important;
    width: auto !important;
}

/* PRIVACY POLICY LINK STYLING */
html body .contact-form .privacy-link,
html body .contact-form-wrapper .privacy-link,
html body .contact-section .privacy-link,
html body .main-contact-section .privacy-link {
    color: #2d231b !important;
    text-decoration: none !important;
    font-weight: 500 !important;
    transition: all 0.3s ease !important;
    display: inline !important;
    white-space: nowrap !important;
}

html body .contact-form .privacy-link:hover,
html body .contact-form-wrapper .privacy-link:hover,
html body .contact-section .privacy-link:hover,
html body .main-contact-section .privacy-link:hover {
    color: #ffc107 !important;
    text-decoration: underline !important;
}

/* BUTTON STYLING - AGGRESSIVE */
html body .contact-form .btn-primary,
html body .contact-form-wrapper .btn-primary,
html body .contact-form .btn-block,
html body .contact-form-wrapper .btn-block,
html body .contact-section .btn-primary,
html body .main-contact-section .btn-primary {
    background: #ffc107 !important;
    border-color: #ffc107 !important;
    color: #2d231b !important;
    font-weight: 600 !important;
    padding: 15px 30px !important;
    border-radius: 8px !important;
    text-decoration: none !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 10px !important;
    transition: all 0.3s ease !important;
    cursor: pointer !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    font-size: 14px !important; /* Smaller font size for "Send Message" */
    line-height: 1.4 !important;
    border: 2px solid #ffc107 !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
    text-transform: none !important;
    letter-spacing: normal !important;
}

html body .contact-form .btn-primary:hover,
html body .contact-form-wrapper .btn-primary:hover,
html body .contact-form .btn-block:hover,
html body .contact-form-wrapper .btn-block:hover,
html body .contact-section .btn-primary:hover,
html body .main-contact-section .btn-primary:hover {
    background: #2d231b !important;
    border-color: #2d231b !important;
    color: #ffc107 !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 15px rgba(45, 35, 27, 0.3) !important;
}

/* Force form validation styles */
.contact-form .form-control.is-invalid,
.contact-form-wrapper .form-control.is-invalid {
    border-color: #dc3545 !important;
}

.contact-form .form-control.is-valid,
.contact-form-wrapper .form-control.is-valid {
    border-color: #28a745 !important;
}

/* Force form container styling */
.contact-form,
.contact-form-wrapper {
    background-color: #f8f9fa !important;
    padding: 40px !important;
    border-radius: 15px !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05) !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

/* Override WordPress core form styles */
.contact-form input[type="text"],
.contact-form input[type="email"], 
.contact-form input[type="tel"],
.contact-form textarea,
.contact-form select,
.contact-form-wrapper input[type="text"],
.contact-form-wrapper input[type="email"], 
.contact-form-wrapper input[type="tel"],
.contact-form-wrapper textarea,
.contact-form-wrapper select {
    width: 100% !important;
    padding: 15px 20px !important;
    border: 2px solid #e0e0e0 !important;
    border-radius: 8px !important;
    font-size: 16px !important;
    background-color: #ffffff !important;
    color: #333333 !important;
    box-sizing: border-box !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
}

/* MOBILE RESPONSIVE FIXES - ULTRA AGGRESSIVE */
@media (max-width: 768px) {
    /* HOMEPAGE FORM MOBILE LAYOUT */
    html body .contact-form .form-row {
        margin: 0 !important;
        width: 100% !important;
    }
    
    html body .contact-form .form-row .form-group {
        padding: 0 !important;
        margin-bottom: 20px !important;
    }
    
    html body .contact-form .form-row .col-md-6 {
        flex: 0 0 100% !important;
        max-width: 100% !important;
        width: 100% !important;
    }
    
    /* MOBILE FORM CONTROLS */
    html body .contact-form .form-control,
    html body .contact-form-wrapper .form-control {
        padding: 12px 15px !important;
        font-size: 16px !important; /* Prevent zoom on iOS */
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        border-radius: 8px !important;
    }
    
    html body .contact-form .form-control::placeholder,
    html body .contact-form-wrapper .form-control::placeholder {
        font-size: 14px !important;
        color: #999 !important;
    }
    
    /* MOBILE PRIVACY POLICY - ALLOW WRAPPING */
    html body .contact-form .form-check,
    html body .contact-form-wrapper .form-check {
        display: flex !important;
        align-items: flex-start !important;
        gap: 12px !important;
        margin-bottom: 20px !important;
        width: 100% !important;
        text-align: left !important;
    }
    
    html body .contact-form .form-check-input,
    html body .contact-form-wrapper .form-check-input {
        margin-top: 2px !important;
        width: 20px !important;
        height: 20px !important;
        min-width: 20px !important;
        flex-shrink: 0 !important;
    }
    
    html body .contact-form .form-check-label,
    html body .contact-form-wrapper .form-check-label {
        font-size: 14px !important;
        line-height: 1.4 !important;
        flex: 1 !important;
        word-wrap: break-word !important;
        white-space: normal !important; /* Allow wrapping on mobile */
        max-width: calc(100% - 32px) !important;
        text-align: left !important;
        overflow: visible !important;
        text-overflow: initial !important;
    }
    
    html body .contact-form,
    html body .contact-form-wrapper {
        padding: 25px 20px !important;
        margin: 20px 0 !important;
    }
    
    /* MOBILE BUTTON */
    html body .contact-form .btn-primary,
    html body .contact-form-wrapper .btn-primary {
        font-size: 14px !important;
        padding: 12px 20px !important;
    }
}

/* Very small mobile fixes */
@media (max-width: 480px) {
    .contact-form,
    .contact-form-wrapper {
        padding: 20px 15px !important;
        margin: 15px 0 !important;
        border-radius: 10px !important;
    }
    
    .contact-form .form-check,
    .contact-form-wrapper .form-check {
        gap: 10px !important;
    }
    
    .contact-form .form-check-input,
    .contact-form-wrapper .form-check-input {
        width: 18px !important;
        height: 18px !important;
    }
    
    .contact-form .form-check-label,
    .contact-form-wrapper .form-check-label {
        font-size: 13px !important;
        line-height: 1.3 !important;
    }
}

/* Override theme and plugin conflicts */
.contact-form *,
.contact-form-wrapper * {
    box-sizing: border-box !important;
}

/* Ensure consistent font rendering */
.contact-form .form-control,
.contact-form .form-check-label,
.contact-form-wrapper .form-control,
.contact-form-wrapper .form-check-label {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
    -webkit-font-smoothing: antialiased !important;
    -moz-osx-font-smoothing: grayscale !important;
}

/* Fix for Bootstrap conflicts */
.contact-form .row,
.contact-form-wrapper .row {
    --bs-gutter-x: 0px !important;
    --bs-gutter-y: 0px !important;
}

/* Additional specificity for server environments */
body .contact-form .form-control,
body .contact-form-wrapper .form-control {
    width: 100% !important;
    padding: 15px 20px !important;
    border: 2px solid #e0e0e0 !important;
    border-radius: 8px !important;
    font-size: 16px !important;
}

body .contact-form .form-check-label,
body .contact-form-wrapper .form-check-label {
    font-size: 15px !important;
    line-height: 1.5 !important;
    word-wrap: break-word !important;
    white-space: normal !important;
}

/* WordPress admin bar compatibility */
@media screen and (max-width: 782px) {
    .admin-bar .contact-form,
    .admin-bar .contact-form-wrapper {
        margin-top: 20px !important;
    }
}

/* Print media query to prevent form from breaking */
@media print {
    .contact-form,
    .contact-form-wrapper {
        display: none !important;
    }
}
