/**
 * Standardized modal behavior and visual style for the WHOLE system
 * (admin panel, dashboard, meeting room). Fixes the Bootstrap 4 default
 * behavior where a tall modal scrolls as a single block (header and
 * footer get pushed off-screen together with the body) by making only
 * `.modal-body` scroll, while header/footer stay fixed and the dialog
 * stays vertically centered with sensible margins on every screen size.
 *
 * Loaded globally from layouts/admin.blade.php and layouts/app.blade.php
 * so every modal in the system benefits automatically, with no per-modal
 * markup changes required. Deliberately avoids `!important` so that
 * page-specific overrides (e.g. public/css/meeting.css, which already
 * themes modal colors inside the meeting room) keep working unchanged.
 */

/* vertical centering: same proven technique Bootstrap 4 ships under the
   optional `.modal-dialog-centered` class, applied here unconditionally so
   every modal in the system is centered without needing a markup change */
.modal-dialog {
    display: flex;
    align-items: center;
    min-height: calc(100% - 1rem);
}

.modal-dialog::before {
    display: block;
    height: calc(100vh - 1rem);
    content: "";
}

@media (min-width: 576px) {
    .modal-dialog {
        min-height: calc(100% - 3.5rem);
    }

    .modal-dialog::before {
        height: calc(100vh - 3.5rem);
    }
}

.modal-content {
    width: 100%;
    max-height: calc(100vh - 3.5rem);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: none;
    border-radius: .85rem;
    box-shadow: 0 12px 40px rgba(0, 0, 0, .18);
}

.modal-header {
    flex-shrink: 0;
    align-items: center;
    gap: .75rem;
    padding: 1.1rem 1.5rem;
    background: linear-gradient(135deg, var(--primary-color, #536d79), #343a40);
    border-bottom: none;
    border-top-left-radius: .85rem;
    border-top-right-radius: .85rem;
}

.modal-header .modal-title {
    color: #fff;
    font-weight: 600;
    font-size: 1.05rem;
    display: flex;
    align-items: center;
    gap: .5rem;
}

.modal-header .close {
    color: #fff;
    text-shadow: none;
    opacity: .85;
    transition: opacity .15s ease-in-out;
}

.modal-header .close:hover {
    color: #fff;
    opacity: 1;
}

.modal-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 1.5rem;
}

.modal-footer {
    flex-shrink: 0;
    padding: 1rem 1.5rem;
    border-top: 1px solid #eef0f3;
    background: #fafbfc;
    border-bottom-left-radius: .85rem;
    border-bottom-right-radius: .85rem;
}

/* responsiveness: full-bleed on small screens, comfortable margins on larger ones */
@media (max-width: 575.98px) {
    .modal-dialog {
        min-height: calc(100% - 1rem);
        margin: .5rem;
    }

    .modal-content {
        max-height: calc(100vh - 1rem);
    }

    .modal-header, .modal-body, .modal-footer {
        padding: 1rem;
    }
}
