.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 20px;
    overflow-y: auto; /* Enable overlay-level scrolling */
}

.popup {
    background-color: #f5e6d3;
    padding: 3rem;
    border-radius: 20px;
    width: 95%;
    max-width: 750px;
    position: relative;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(196, 156, 92, 0.4);
    margin: auto; /* Center when scrollable */
    max-height: calc(100vh - 40px);
    overflow-y: auto; /* Scrollable content inside the popup */
}

/* Custom scrollbar for the popup */
.popup::-webkit-scrollbar {
    width: 6px;
}

.popup::-webkit-scrollbar-track {
    background: transparent;
}

.popup::-webkit-scrollbar-thumb {
    background: #c49c5c;
    border-radius: 10px;
}

.closeButton {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: #fff;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #441109;
    transition: transform 0.3s ease;
    z-index: 10;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.closeButton:hover {
    transform: rotate(90deg) scale(1.1);
}

.title {
    font-family: var(--font-playfair);
    font-size: 2.2rem;
    color: #441109;
    margin-bottom: 0.5rem;
    text-align: center;
}

.subtitle {
    font-size: 0.95rem;
    color: #5d4037;
    margin-bottom: 2.5rem;
    text-align: center;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.formGrid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.2rem;
}

.inputGroup {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.fullWidth {
    grid-column: span 2;
}

.label {
    font-size: 0.8rem;
    font-weight: 700;
    color: #441109;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.input, .textarea {
    padding: 0.8rem 1rem;
    border-radius: 10px;
    border: 1px solid #d3cab3;
    background-color: #fff;
    color: #441109;
    font-family: inherit;
    font-size: 0.95rem;
    outline: none;
    transition: all 0.3s ease;
}

.input:focus, .textarea:focus {
    border-color: #c49c5c;
    box-shadow: 0 0 0 4px rgba(196, 156, 92, 0.15);
}

.textarea {
    resize: none;
    height: 100px;
    grid-column: span 2;
}

.submitButton {
    background-color: #441109;
    color: #f5e6d3;
    padding: 1.1rem;
    border-radius: 10px;
    border: 1px solid #441109;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2.5px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 0.5rem;
    font-size: 0.95rem;
    grid-column: span 2;
}

.submitButton:hover {
    background-color: #c49c5c;
    border-color: #c49c5c;
    color: #fff;
}

.submitButton:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.successMessage {
    background-color: rgba(76, 175, 80, 0.1);
    color: #2e7d32;
    padding: 1rem;
    border-radius: 8px;
    text-align: center;
    font-size: 0.9rem;
    font-weight: 600;
}

@media (max-width: 768px) {
    .formGrid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .textarea, .submitButton, .fullWidth {
        grid-column: span 1;
    }

    .popup {
        padding: 2.5rem 1.5rem 2rem;
        max-height: calc(100vh - 40px);
    }

    .title {
        font-size: 1.8rem;
    }

    .subtitle {
        margin-bottom: 1.5rem;
        font-size: 0.9rem;
    }

    .input, .textarea {
        padding: 0.7rem 0.9rem;
    }
}

@media (max-width: 480px) {
    .popup {
        padding: 2.5rem 1.2rem 1.5rem;
        width: 100%;
        border-radius: 15px;
    }

    .title {
        font-size: 1.5rem;
    }

    .subtitle {
        font-size: 0.85rem;
    }

    .form {
        gap: 0.8rem;
    }

    .inputGroup {
        gap: 0.3rem;
    }

    .label {
        font-size: 0.75rem;
    }

    .submitButton {
        padding: 0.9rem;
        font-size: 0.9rem;
        margin-top: 0.2rem;
    }
}
