/**
 * Contact Modal Styles
 * 
 * Clean, organized styles for the contact modal matching the site's design system
 */

/* ========================================
   MODAL OVERLAY & CONTAINER
======================================== */

.contact-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 999999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.contact-modal-overlay.show {
    display: flex;
    opacity: 1;
}

#contactModal.contact-modal {
    background: #fff;
    border-radius: 8px;
    max-width: 1100px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
}

/* ========================================
   MODAL HEADER
======================================== */

#contactModal .contact-modal-header {
    padding: 20px 30px 15px;
    border-bottom: 1px solid #e5e5e5;
    position: relative;
}

#contactModal .contact-modal-header h2 {
    color: #004C7F;
    font-size: 28px;
    font-weight: 700;
    margin: 0 0 10px 0;
    line-height: 1.2;
}

#contactModal .contact-modal-header p {
    color: #666;
    font-size: 16px;
    margin: 0;
    line-height: 1.5;
}

.contact-modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: none;
    border: none;
    font-size: 24px;
    color: #999;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.contact-modal-close:hover {
    background: #f5f5f5;
    color: #333;
}

/* ========================================
   MODAL BODY LAYOUT
======================================== */

#contactModal .contact-modal-body {
    display: flex;
    flex: 1;
    min-height: 0;
}

#contactModal .contact-form {
    flex: 1;
    padding: 20px 30px 30px 30px;
    width: calc(100% - 280px);
}

#contactModal .contact-sidebar {
    width: 280px;
    min-width: 280px;
    background: #f8f9fa;
    padding: 22px;
    border-left: 1px solid #e5e5e5;
    flex-shrink: 0;
}

/* ========================================
   FORM SECTIONS & LAYOUT
======================================== */

#contactModal .form-section {
    margin-bottom: 25px;
}

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

.form-section h3 {
    color: #004C7F;
    font-size: 20px;
    font-weight: 600;
    margin: 0 0 20px 0;
}

#contactModal .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 25px;
    margin-bottom: 0;
}

#contactModal .form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

/* ========================================
   FORM INPUTS & CONTROLS
======================================== */

#contactModal .form-group input,
#contactModal .form-group select,
#contactModal .form-group textarea {
    width: 100%;
    padding: 10px 15px;
    border: 2px solid #e5e5e5;
    border-radius: 6px;
    font-size: 15px;
    transition: border-color 0.3s ease;
    box-sizing: border-box;
}

/* Fix dual dropdown issue with nice-select plugin */
#contactModal #contact_team_member {
    display: none !important; /* Hide original select when nice-select is active */
}

#contactModal .nice-select {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: relative !important;
    z-index: 10 !important;
    width: 100% !important;
    height: auto !important;
    border: 2px solid #e5e5e5 !important;
    border-radius: 6px !important;
    font-size: 15px !important;
    padding: 10px 15px !important;
    box-sizing: border-box !important;
    transition: all 0.3s ease !important;
}

/* Focus state for nice-select dropdowns - matching FAQ accordion style */
#contactModal .nice-select:focus,
#contactModal .nice-select.open {
    border-color: #186396 !important;
    background: #e9ecef !important;
    color: #186396 !important;
    box-shadow: 0 0 0 3px rgba(24, 99, 150, 0.1) !important;
    font-weight: 600 !important;
}

#contactModal .nice-select:focus .current,
#contactModal .nice-select.open .current {
    color: #186396 !important;
}

#contactModal .nice-select .current {
    color: #333 !important;
    line-height: normal !important;
}

#contactModal .nice-select .list {
    width: 100% !important;
    border: 2px solid #004C7F !important;
    border-radius: 6px !important;
    max-height: 200px !important;
    overflow-y: auto !important;
}

#contactModal .form-group input:focus,
#contactModal .form-group select:focus,
#contactModal .form-group textarea:focus {
    outline: none;
    border-color: #186396;
    background: #e9ecef;
    color: #186396;
    box-shadow: 0 0 0 3px rgba(24, 99, 150, 0.1);
}

#contactModal .form-group textarea {
    resize: vertical;
    min-height: 60px;
    max-height: 120px;
}

/* Required fields styling */
#contactModal .form-group.required input,
#contactModal .form-group.required select,
#contactModal .form-group.required textarea {
    background-color: #f8f9fa;
    border-color: #dee2e6;
}

#contactModal .form-group.required input:focus,
#contactModal .form-group.required select:focus,
#contactModal .form-group.required textarea:focus {
    background-color: #e9ecef;
    border-color: #186396;
    color: #186396;
}

/* Error states */
.form-group input.error,
.form-group select.error,
.form-group textarea.error {
    border-color: #dc3545;
}

/* ========================================
   SUBMIT BUTTON
======================================== */

.form-actions {
    margin-top: 25px;
}

#contactModal .form-actions .theme-btn {
    margin-bottom: 0;
    margin-bottom: 40px;
}

/* ========================================
   SIDEBAR CONTENT
======================================== */

.team-member-info {
    margin-bottom: 25px;
    text-align: center;
}

.team-member-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    overflow: hidden;
    margin: 0 auto 15px;
    border: 3px solid #004C7F;
}

.team-member-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.team-member-info h4 {
    color: #333;
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 10px 0;
}

.team-member-info p {
    color: #666;
    font-size: 14px;
    line-height: 1.4;
    margin: 0;
}

.direct-contact h4 {
    color: #004C7F;
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 20px 0;
}

.contact-item {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 15px;
    padding: 12px;
    background: white;
    border-radius: 6px;
    border: 1px solid #e5e5e5;
}

.contact-item i {
    color: #004C7F;
    font-size: 18px;
    width: 20px;
    text-align: center;
}

.contact-item span {
    color: #333;
    font-size: 14px;
    font-weight: 500;
}

.direct-contact a {
    font-weight: 500 !important;
}

/* ========================================
   FORM MESSAGES & FEEDBACK
======================================== */

.form-error {
    color: #dc3545;
    font-size: 14px;
    margin-top: 5px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.form-error::before {
    content: "⚠";
    font-size: 16px;
}

.form-error-global {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
    padding: 12px 15px;
    border-radius: 6px;
    margin-bottom: 20px;
}

.form-success {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
    padding: 12px 15px;
    border-radius: 6px;
    margin-bottom: 20px;
    text-align: center;
    font-weight: 500;
}

/* ========================================
   UTILITIES & GLOBAL STATES
======================================== */

body.modal-open {
    overflow: hidden;
}

.contact-modal-trigger.elementor-button,
.contact-modal-trigger[class*="theme-btn"],
.contact-modal-trigger[class*="btn"] {
    text-decoration: none !important;
    cursor: pointer !important;
}

/* Ensure converted contact modal triggers are accessible */
.contact-modal-trigger-converted {
    cursor: pointer !important;
    outline: none !important;
}

.contact-modal-trigger-converted:focus {
    box-shadow: 0 0 0 2px #186396, 0 0 10px rgba(24, 99, 150, 0.3) !important;
}

.contact-modal-trigger-converted:focus-visible {
    box-shadow: 0 0 0 2px #186396, 0 0 10px rgba(24, 99, 150, 0.3) !important;
}

/* ========================================
   ANIMATIONS
======================================== */

.contact-modal-overlay {
    animation: fadeIn 0.3s ease;
}

.contact-modal {
    animation: slideIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ========================================
   RESPONSIVE DESIGN
======================================== */

@media (max-width: 768px) {
    #contactModal.contact-modal {
        max-width: 100%;
        margin: 10px;
        max-height: 95vh;
    }
    
    #contactModal .contact-modal-body {
        flex-direction: column;
    }
    
    #contactModal .contact-form {
        width: 100%;
        padding: 20px 20px 40px 20px;
    }
    
    #contactModal .contact-sidebar {
        width: 100%;
        min-width: auto;
        border-left: none;
        border-top: 1px solid #e5e5e5;
        padding: 20px;
    }
    
    #contactModal .form-row {
        grid-template-columns: 1fr;
        gap: 0;
    }
    
    #contactModal .contact-modal-header {
        padding: 20px;
    }
    
    #contactModal .contact-modal-header h2 {
        font-size: 24px;
    }
    
    #contactModal .form-group, #contactModal .form-group:last-child {
        margin-bottom: 18px;
    }
}

@media (max-width: 480px) {
    .contact-modal-overlay {
        padding: 10px;
    }
    
    #contactModal.contact-modal {
        margin: 5px;
    }
    
    #contactModal .contact-modal-header,
    #contactModal .contact-sidebar {
        padding: 15px;
    }
    
    #contactModal .contact-form {
        padding: 15px 15px 35px 15px;
    }
    
    #contactModal .contact-modal-header h2 {
        font-size: 20px;
    }
    
    .form-section h3 {
        font-size: 18px;
    }
}