/**
 * GreenPulse Modal Base Styles
 * Tailwind CSS + Custom Modal Utilities
 *
 * Colours are the canonical tokens of the dialog recipe (.gp-dialog in
 * frontend/src/styles/components.css): hairline dividers, ink title, secondary
 * body text, the icon button's grey and the focus outline's --gp-green-text (UX
 * plan step E7.C1, UX-62). No template or script renders .modal-header,
 * .modal-title, .modal-close, .modal-body or .modal-footer today, so the swap
 * from the old Tailwind greys changes no rendered page; new dialogs use the
 * {% gp_modal %} recipe instead of these classes.
 * © 2026 Greempact · Greempact.com.ar
 */

/* Modal backdrop overlay */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    transition: opacity 0.3s ease;
}

/* Modal container */
.modal-container {
    position: fixed;
    inset: 0;
    z-index: 1001;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    overflow-y: auto;
}

/* Modal dialog */
.modal-dialog {
    position: relative;
    width: 100%;
    max-width: 32rem; /* 512px */
    background-color: white;
    border-radius: 0.5rem;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    transform: scale(1);
    transition: transform 0.3s ease, opacity 0.3s ease;
}

/* Modal sizes */
.modal-sm .modal-dialog {
    max-width: 24rem; /* 384px */
}

.modal-lg .modal-dialog {
    max-width: 48rem; /* 768px */
}

.modal-xl .modal-dialog {
    max-width: 64rem; /* 1024px */
}

.modal-full .modal-dialog {
    max-width: 90vw;
    max-height: 90vh;
}

/* Modal header */
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem;
    border-bottom: 1px solid var(--gp-hairline);
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--gp-ink-text);
    margin: 0;
}

.modal-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 0.375rem;
    border: none;
    background-color: transparent;
    color: var(--gp-grey);
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
}

.modal-close:hover {
    background-color: var(--gp-ink-08);
    color: var(--gp-ink-text);
}

.modal-close:focus {
    outline: 2px solid var(--gp-green-text);
    outline-offset: 2px;
}

/* Modal body */
.modal-body {
    padding: 1.5rem;
    color: var(--gp-text-secondary);
}

/* Modal footer */
.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1.5rem;
    border-top: 1px solid var(--gp-hairline);
}

/* Animation classes */
.modal-fade-enter {
    opacity: 0;
    transform: scale(0.95);
}

.modal-fade-enter-active {
    opacity: 1;
    transform: scale(1);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.modal-fade-exit {
    opacity: 1;
    transform: scale(1);
}

.modal-fade-exit-active {
    opacity: 0;
    transform: scale(0.95);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

/* Hidden state */
.modal-container.hidden {
    display: none;
}

/* Scrollable modal body */
.modal-body-scrollable {
    max-height: 60vh;
    overflow-y: auto;
}


/* Accessibility. Scoped to dialogs that carry no component recipe class: this
   file loads after the bundle, and the rule would otherwise remove the keyboard
   focus outline from the dialog recipe of frontend/src/styles/components.css,
   whose panel takes focus when it opens. :where() adds no specificity. */
[role="dialog"]:where(:not([class*="gp-"])) {
    outline: none;
}

/* Prevent scroll on body when modal is open */
body.modal-open {
    overflow: hidden;
}
