/* CONTACT FORM MODAL - COMPLETE CORRECT CSS WITH SCROLL FIX */

/* Modal Overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 999999;
    backdrop-filter: blur(5px);
    padding: 20px;
    box-sizing: border-box;
    /* Prevent any scrolling within the modal overlay */
    overflow: hidden;
}

.modal-overlay.active {
    display: flex;
}

/* Modal Container */
.contact-modal {
    background: white;
    border-radius: 15px;
    max-width: 500px;
    width: 100%;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    position: relative;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3);
    transform: scale(0.9);
    transition: transform 0.3s ease;
    margin: 0 auto;
    /* Ensure the modal content doesn't cause page scrolling */
    scrollbar-width: thin;
}

/* Webkit scrollbar styling for modal */
.contact-modal::-webkit-scrollbar {
    width: 6px;
}

.contact-modal::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.contact-modal::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.contact-modal::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

.modal-overlay.active .contact-modal {
    transform: scale(1);
}

/* Modal Header */
.modal-header {
    background: linear-gradient(135deg, #0b131f 0%, #1a2332 100%);
    color: white;
    padding: 25px 30px;
    border-radius: 15px 15px 0 0;
    position: relative;
    /* Prevent any content from causing scrolling */
    flex-shrink: 0;
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 25px;
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
    z-index: 1;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: rotate(90deg);
}

.modal-title {
    font-size: 1.8rem;
    font-weight: 600;
    margin: 0 0 8px 0;
    color: white;
    /* Prevent text selection from causing scroll issues */
    user-select: none;
}

.modal-subtitle {
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.8);
    margin: 0;
    line-height: 1.4;
    /* Prevent text selection from causing scroll issues */
    user-select: none;
}

/* Modal Body */
.modal-body {
    padding: 30px;
    background: white;
    /* Allow this to scroll if needed but within the modal */
    overflow-y: auto;
    flex: 1;
}

/* Consultation Type Badge */
.consultation-type-badge {
    display: inline-block;
    background: linear-gradient(135deg, #00d4aa, #00b894);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 20px;
    /* Prevent text selection */
    user-select: none;
}

/* Form Styles */
#contactForm {
    width: 100%;
}

.form-group {
    margin-bottom: 20px;
    width: 100%;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    width: 100%;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #2c3e50;
    font-size: 0.9rem;
    /* Prevent text selection from causing issues */
    user-select: none;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
    box-sizing: border-box;
    font-family: inherit;
    background: white;
    /* Prevent focus from causing scroll issues */
    scroll-margin: 0;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: #00d4aa;
    box-shadow: 0 0 0 3px rgba(0, 212, 170, 0.1);
    /* Prevent scroll on focus */
    scroll-behavior: auto;
}

.form-textarea {
    resize: vertical;
    min-height: 100px;
    font-family: inherit;
    /* Limit the resize to prevent modal overflow */
    max-height: 200px;
}

.form-select {
    cursor: pointer;
    appearance: none;
    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='%23666' d='M2 0L0 2h4zm0 5L0 3h4z'/></svg>");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 12px;
    padding-right: 40px;
}

/* Modal Submit Button - Unique Class to Prevent Conflicts */
.modal-submit-button {
    width: 100% !important;
    background: linear-gradient(135deg, #00d4aa, #00b894) !important;
    color: white !important;
    border: none !important;
    padding: 15px 30px !important;
    border-radius: 8px !important;
    font-size: 1rem !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    position: relative !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
    margin-top: 10px !important;
    text-align: center !important;
    display: block !important;
    min-height: 50px !important;
    line-height: normal !important;
    font-family: inherit !important;
    /* Prevent button from causing scroll */
    flex-shrink: 0 !important;
}

.modal-submit-button:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 10px 25px rgba(0, 212, 170, 0.3) !important;
    background: linear-gradient(135deg, #00b894, #00d4aa) !important;
}

.modal-submit-button:active {
    transform: translateY(0) !important;
}

.modal-submit-button.loading {
    opacity: 0.8 !important;
    cursor: not-allowed !important;
    pointer-events: none !important;
}

.modal-submit-button.loading::after {
    content: '' !important;
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    width: 20px !important;
    height: 20px !important;
    border: 2px solid transparent !important;
    border-top: 2px solid white !important;
    border-radius: 50% !important;
    animation: spin 1s linear infinite !important;
    transform: translate(-50%, -50%) !important;
}

.modal-submit-button .btn-text {
    display: block !important;
    width: 100% !important;
    color: white !important;
    font-weight: 600 !important;
}

/* Loading Animation */
@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Body Classes for Modal State Management */
body.modal-open {
    overflow: hidden !important;
    position: fixed !important;
    width: 100% !important;
    height: 100% !important;
}

/* Prevent any focus-related scrolling */
.modal-overlay input:focus,
.modal-overlay select:focus,
.modal-overlay textarea:focus,
.modal-overlay button:focus {
    scroll-behavior: auto !important;
}

/* Responsive Design */
@media (max-width: 768px) {
    .modal-overlay {
        padding: 15px;
        /* Ensure mobile doesn't have scroll issues */
        -webkit-overflow-scrolling: auto;
    }
    
    .contact-modal {
        width: 100%;
        max-width: none;
        max-height: calc(100vh - 30px);
        /* Improve mobile scrolling */
        -webkit-overflow-scrolling: touch;
    }

    .modal-header {
        padding: 20px 25px;
    }

    .modal-title {
        font-size: 1.5rem;
        margin-right: 40px;
    }

    .modal-subtitle {
        font-size: 0.9rem;
    }

    .modal-body {
        padding: 25px 20px;
    }

    .form-row {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .form-input,
    .form-select,
    .form-textarea {
        padding: 12px 15px;
        font-size: 16px; /* Prevents zoom on iOS */
    }

    .modal-submit-button {
        padding: 14px 25px !important;
        font-size: 1rem !important;
        min-height: 48px !important;
    }
}

@media (max-width: 480px) {
    .modal-overlay {
        padding: 10px;
    }
    
    .contact-modal {
        max-height: calc(100vh - 20px);
        border-radius: 10px;
    }

    .modal-header {
        padding: 18px 20px;
        border-radius: 10px 10px 0 0;
    }

    .modal-title {
        font-size: 1.3rem;
    }

    .modal-close {
        top: 15px;
        right: 20px;
        font-size: 22px;
    }

    .modal-body {
        padding: 20px 15px;
    }

    .consultation-type-badge {
        padding: 6px 12px;
        font-size: 0.8rem;
    }

    .form-group {
        margin-bottom: 18px;
    }

    .form-input,
    .form-select,
    .form-textarea {
        padding: 11px 12px;
    }

    .modal-submit-button {
        padding: 13px 20px !important;
        font-size: 0.95rem !important;
        min-height: 46px !important;
    }
}

/* Additional fixes for better compatibility */
* {
    box-sizing: border-box;
}

.modal-overlay input,
.modal-overlay select,
.modal-overlay textarea,
.modal-overlay button {
    box-sizing: border-box;
}

/* Prevent any unwanted scrolling behaviors */
html.modal-open {
    overflow: hidden !important;
    height: 100% !important;
}

/* Animation classes */
.fadeIn {
    animation: fadeIn 0.3s ease;
}

.slideUp {
    animation: slideUp 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Additional safeguards for scroll prevention */
.modal-overlay * {
    scroll-behavior: auto !important;
}

/* Ensure the modal content area handles its own scrolling */
.contact-modal {
    display: flex;
    flex-direction: column;
}

/* Notification styles (in case they're missing) */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    z-index: 1000000;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s ease;
    max-width: 400px;
    min-width: 300px;
}

.notification.show {
    opacity: 1;
    transform: translateX(0);
}

.notification.success {
    border-left: 4px solid #00d4aa;
}

.notification.error {
    border-left: 4px solid #e74c3c;
}

.notification-content {
    padding: 15px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.notification-message {
    flex: 1;
    margin-right: 10px;
    font-size: 0.9rem;
    line-height: 1.4;
}

.notification-close {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: #999;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.notification-close:hover {
    color: #666;
}