/* ============================================
   TALEY DESIGN SYSTEM - MODAL
   Contact Form Modal & Overlay
============================================ */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    padding: 20px;
}

.modal-overlay.visible {
    opacity: 1;
    visibility: visible;
}

.modal-container {
    background: white;
    width: 100%;
    max-width: 550px;
    border-radius: 24px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
    position: relative;
    transform: translateY(30px) scale(0.95);
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    max-height: 90vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.modal-container::-webkit-scrollbar {
    width: 6px;
}

.modal-container::-webkit-scrollbar-thumb {
    background-color: var(--gray-300);
    border-radius: 10px;
}

.modal-overlay.visible .modal-container {
    transform: translateY(0) scale(1);
}

.modal-header {
    padding: 32px 32px 10px;
    text-align: center;
}

.modal-header h2 {
    font-size: 28px;
    color: var(--green-dark);
    margin-bottom: 8px;
    font-weight: 700;
}

.modal-header p {
    color: var(--gray-600);
    font-size: 16px;
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--gray-100);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: var(--gray-600);
    transition: all 0.2s ease;
    z-index: 10;
}

.modal-close:hover {
    background: var(--gray-200);
    color: var(--danger);
    transform: rotate(90deg);
}

.modal-body {
    padding: 20px 32px 32px;
}

.contact-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    text-align: left;
}

.form-group label {
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-800);
    margin-left: 4px;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 14px 18px;
    font-size: 16px;
    font-family: var(--font-sans);
    border: 2px solid var(--gray-200);
    border-radius: 16px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    background: #FAFAFA;
}

.form-group textarea {
    min-height: 120px;
    resize: vertical;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--green-primary);
    box-shadow: 0 0 0 4px rgba(76, 175, 80, 0.1);
    background: white;
}

.form-submit-btn {
    margin-top: 10px;
    width: 100%;
    padding: 18px;
    background: var(--green-primary);
    color: white;
    border: none;
    border-radius: 16px;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.form-submit-btn:hover {
    background: var(--green-dark);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(76, 175, 80, 0.4);
}

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

/* Mobile Responsiveness */
@media (max-width: 600px) {
    .modal-container {
        border-radius: 20px 20px 0 0;
        max-height: 90vh;
        /* Allow some space at top */
        position: absolute;
        bottom: 0;
        transform: translateY(100%);
        max-width: 100%;
        /* iOS safe area padding for home indicator */
        padding-bottom: env(safe-area-inset-bottom, 20px);
    }

    .modal-overlay.visible .modal-container {
        transform: translateY(0);
    }

    .modal-header {
        padding: 24px 20px 10px;
    }

    .modal-body {
        padding: 16px 20px 32px;
    }

    /* Make close button more prominent on mobile */
    .modal-close {
        position: sticky;
        top: 0;
        right: 0;
        margin-left: auto;
        margin-right: 16px;
        margin-top: 16px;
        margin-bottom: -40px;
        width: 44px;
        height: 44px;
        z-index: 20;
    }
}