/* Modal Overlay (Backdrop) */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.3s, visibility 0.3s;
}

.modal-overlay.is-open {
    visibility: visible;
    opacity: 1;
}

/* Modal Container (The actual dialog box) */
.modal-container {
    background-color: #fff;
    border-radius: 0.75rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    width: 90%;
    max-width: 500px;
    transform: scale(0.95);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.modal-overlay.is-open .modal-container {
    transform: scale(1);
}

/* Modal Header */
.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.close-button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    margin: -0.5rem; /* To increase clickable area without changing header size */
    color: #000000;
    transition: all 0.3s ease-out;
}

.close-button svg {
    width: 3rem;
    height: 3rem;
    display: block;
}

.close-button:hover {
    opacity: .6;
}

/* Modal Body */
.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
}

.modal-body p {
    margin-top: 0;
    line-height: 1.6;
}

/* Modal Actions (Footer) */
.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1.5rem;
    border-top: 1px solid #e5e7eb;
}

/* WCAG Focus Styles */
.trigger-button:focus,
.close-button:focus,
.action-button:focus {
    outline: 2px solid #023E7C;
    outline-offset: 2px;
}

/* Responsive adjustments */
@media (max-width: 600px) {
    .modal-container {
        width: 100%;
        margin: 1rem;
    }
    .modal-actions {
        flex-direction: column-reverse;
    }
    .action-button {
        width: 100%;
    }
}