/* modal.css - Contact Modal and Success Notification Styles */

/* Contact Modal Styles */
.contact-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    z-index: 100000;
    display: none; /* Changed from flex to none initially */
    align-items: center;
    justify-content: center;
    opacity: 0;
    padding: 20px;
    overflow: hidden; /* Changed from auto to hidden */
}

/* Show modal with animation */
.contact-modal[style*="display: flex"] {
    animation: fadeIn 0.3s ease forwards;
}

.contact-modal.closing {
    animation: fadeOut 0.3s ease forwards;
}

.modal-content {
    background: linear-gradient(135deg, #FFFFFF 0%, #FAF8F3 100%);
    border-radius: 30px;
    padding: 50px;
    max-width: 600px;
    width: 100%;
    max-height: 90vh; /* Increased from 85vh */
    overflow: hidden; /* Hide overflow on the modal itself */
    position: relative;
    animation: slideUp 0.5s ease;
    box-shadow: 0 30px 80px rgba(124, 132, 113, 0.3);
    margin: auto;
    display: flex;
    flex-direction: column;
}

.contact-modal.closing .modal-content {
    animation: slideDown 0.5s ease;
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #E8EDE5, #A8B79E);
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    transition: all 0.3s ease;
    color: #5A6051;
    font-weight: 300;
    line-height: 1;
}

.modal-close:hover {
    background: linear-gradient(135deg, #A8B79E, #7C8471);
    color: white;
    transform: rotate(90deg);
}

.modal-content h3 {
    color: #5A6051;
    font-size: 2rem;
    margin-bottom: 10px;
    text-align: center;
    font-weight: 300;
    letter-spacing: -0.5px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.modal-content > p {
    color: #6B7A6D;
    text-align: center;
    margin-bottom: 30px;
    font-size: 1.1rem;
    line-height: 1.6;
}

/* Form Styles */
#contactForm {
    display: flex;
    flex-direction: column;
    gap: 20px;
    flex: 1; /* Allow form to grow */
    overflow-y: auto; /* Only scroll the form if needed */
    overflow-x: hidden;
    padding-right: 10px; /* Space for scrollbar */
    margin-right: -10px; /* Compensate for padding */
    max-height: calc(90vh - 200px); /* Account for header and padding */
}

/* Custom scrollbar for form */
#contactForm::-webkit-scrollbar {
    width: 6px;
}

#contactForm::-webkit-scrollbar-track {
    background: transparent;
}

#contactForm::-webkit-scrollbar-thumb {
    background: rgba(168, 183, 158, 0.3);
    border-radius: 10px;
}

#contactForm::-webkit-scrollbar-thumb:hover {
    background: rgba(124, 132, 113, 0.5);
}

/* Firefox scrollbar */
#contactForm {
    scrollbar-width: thin;
    scrollbar-color: rgba(168, 183, 158, 0.3) transparent;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: relative;
}

.form-group label {
    color: #5A6051;
    font-weight: 600;
    font-size: 0.95rem;
    letter-spacing: 0.3px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.form-group input,
.form-group textarea,
.form-group select {
    padding: 14px 20px;
    border: 2px solid #E8EDE5;
    border-radius: 15px;
    font-size: 1rem;
    transition: all 0.3s ease;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: white;
}

.form-group select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%237C8471' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 20px center;
    padding-right: 45px;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: #A8B79E;
    background: #FAF8F3;
    box-shadow: 0 0 0 3px rgba(168, 183, 158, 0.1);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: #B5C1B7;
}

.form-group textarea {
    min-height: 120px;
    resize: vertical;
    line-height: 1.6;
}

.form-submit {
    background: linear-gradient(135deg, #7C8471, #5A6051);
    color: white;
    border: none;
    padding: 16px 40px;
    border-radius: 50px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 10px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    font-size: 0.95rem;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.form-submit:hover:not(:disabled) {
    background: linear-gradient(135deg, #5A6051, #4A5041);
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(124, 132, 113, 0.3);
}

.form-submit:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.form-error {
    color: #ef4444;
    font-size: 0.85rem;
    margin-top: 5px;
    display: none;
    font-weight: 500;
    position: absolute;
    bottom: -20px;
    left: 0;
}

.form-error.show {
    display: block;
    animation: shake 0.3s ease;
}

/* Success Notification */
.success-notification {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: linear-gradient(135deg, white, #FAF8F3);
    padding: 20px 30px;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(124, 132, 113, 0.3);
    display: flex;
    align-items: center;
    gap: 15px;
    z-index: 100001;
    opacity: 0;
    transition: all 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    border: 2px solid #A8B79E;
    pointer-events: none;
}

.success-notification.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
    pointer-events: auto;
}

.success-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #A8B79E, #7C8471);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
    font-weight: 700;
    animation: successPulse 0.5s ease;
}

@keyframes successPulse {
    0% { transform: scale(0); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.success-text h4 {
    color: #5A6051;
    margin-bottom: 3px;
    font-size: 1.1rem;
    font-weight: 600;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.success-text p {
    color: #6B7A6D;
    font-size: 0.9rem;
    margin: 0;
}

/* Loading State */
.loading-state {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    flex-direction: column;
    gap: 20px;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid #E8EDE5;
    border-top-color: #7C8471;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loading-text {
    color: #6B7A6D;
    font-size: 1rem;
    font-weight: 500;
}

/* Exit Popup Styles */
.exit-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    z-index: 100000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.exit-popup.active {
    display: flex;
    animation: fadeIn 0.3s ease;
}

.exit-popup-content {
    background: white;
    border-radius: 30px;
    padding: 50px;
    max-width: 500px;
    text-align: center;
    position: relative;
    animation: slideUp 0.5s ease;
}

.exit-popup-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 30px;
    height: 30px;
    background: #E8EDE5;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    font-size: 18px;
    color: #5A6051;
}

.exit-popup-close:hover {
    background: #A8B79E;
    transform: rotate(90deg);
    color: white;
}

.exit-popup h3 {
    color: #5A6051;
    font-size: 1.8rem;
    margin-bottom: 15px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.exit-popup p {
    color: #6B7A6D;
    margin-bottom: 25px;
    line-height: 1.6;
}

.exit-popup-form {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.exit-popup-input {
    flex: 1;
    padding: 12px 20px;
    border: 2px solid #E8EDE5;
    border-radius: 25px;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.exit-popup-input:focus {
    outline: none;
    border-color: #A8B79E;
}

.exit-popup-btn {
    padding: 12px 30px;
    background: #7C8471;
    color: white;
    border: none;
    border-radius: 25px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.exit-popup-btn:hover {
    background: #5A6051;
    transform: translateY(-2px);
}

#exitEmailError {
    color: #ef4444;
    font-size: 0.85rem;
    margin-top: 10px;
    display: none;
    text-align: center;
    font-weight: 500;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(100px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideDown {
    from {
        transform: translateY(0);
        opacity: 1;
    }
    to {
        transform: translateY(100px);
        opacity: 0;
    }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .modal-content {
        padding: 40px 30px;
        max-height: 95vh; /* More height on mobile */
    }

    .modal-content h3 {
        font-size: 1.6rem;
    }

    .form-row {
        grid-template-columns: 1fr;
    }
    
    .form-error {
        position: static;
        margin-top: 5px;
    }
    
    #contactForm {
        max-height: calc(95vh - 180px); /* Adjust for mobile */
    }
}

@media (max-width: 480px) {
    .modal-content {
        padding: 35px 25px;
        border-radius: 20px;
    }

    .modal-close {
        width: 35px;
        height: 35px;
        font-size: 20px;
    }

    .modal-content h3 {
        font-size: 1.4rem;
    }

    .modal-content > p {
        font-size: 1rem;
    }

    .form-group input,
    .form-group textarea,
    .form-group select {
        padding: 12px 16px;
        font-size: 0.95rem;
    }

    .form-submit {
        padding: 14px 30px;
        font-size: 0.9rem;
    }

    .success-notification {
        width: calc(100% - 40px);
        padding: 15px 20px;
    }

    .success-icon {
        width: 35px;
        height: 35px;
        font-size: 18px;
    }

    .success-text h4 {
        font-size: 1rem;
    }

    .success-text p {
        font-size: 0.85rem;
    }

    .exit-popup-content {
        padding: 40px 30px;
    }

    .exit-popup h3 {
        font-size: 1.5rem;
    }

    .exit-popup-form {
        flex-direction: column;
    }

    .exit-popup-input,
    .exit-popup-btn {
        width: 100%;
    }
}