/**
 * Modals and list groups
 *
 * The create-event and add-participant dialogs, and the plain bordered lists
 * the organiser screens use for pairings and templates. Both were redefined in
 * four different page stylesheets before.
 */

/* ============================================
   MODAL
   ============================================ */

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: var(--z-modal-backdrop);
    background: rgba(7, 35, 35, 0.72);
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--duration-base) var(--easing),
                visibility var(--duration-base) var(--easing);
}

.modal-backdrop.is-open,
.modal-backdrop.show {
    opacity: 1;
    visibility: visible;
}

.create-event-modal,
.app-modal {
    position: fixed;
    inset: 0;
    z-index: var(--z-modal);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-4);
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--duration-base) var(--easing),
                visibility var(--duration-base) var(--easing);
}

.create-event-modal.is-open,
.app-modal.is-open,
.create-event-modal.show,
.app-modal.show {
    opacity: 1;
    visibility: visible;
}

.modal-card,
.modal-content {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 560px;
    max-height: calc(100dvh - var(--space-8));
    border: none;
    border-radius: var(--radius-xl);
    background: var(--card-face);
    box-shadow: var(--shadow-modal);
    color: var(--text-on-light);
    overflow: hidden;
}

.modal-dialog {
    width: 100%;
    max-width: 560px;
    margin: 0 auto;
}

.modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-4);
    padding: var(--space-6) var(--space-6) var(--space-4);
    border-bottom: 1px solid var(--border-on-light-hairline);
    background: transparent;
    color: inherit;
}

.modal-title {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin: 0;
    font-family: var(--font-display);
    font-size: var(--display-sm);
    font-weight: var(--font-weight-normal);
    letter-spacing: var(--tracking-display);
}

.modal-body {
    flex: 1 1 auto;
    min-height: 0;
    padding: var(--space-6);
    overflow-y: auto;
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-6);
    border-top: 1px solid var(--border-on-light-hairline);
}

.modal-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: var(--radius-full);
    background: rgba(26, 77, 77, 0.08);
    color: var(--text-on-light);
    font-size: 1.25rem;
    line-height: 1;
}

.modal-close:hover {
    background: rgba(26, 77, 77, 0.16);
}

@media (max-width: 640px) {
    .modal-card,
    .modal-content {
        max-height: calc(100dvh - var(--space-4));
    }

    .modal-header,
    .modal-body {
        padding-left: var(--space-4);
        padding-right: var(--space-4);
    }
}

/* ============================================
   LIST GROUP
   ============================================ */

.list-group {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-on-light-hairline);
    border-radius: var(--radius-md);
    background: transparent;
    overflow: hidden;
}

.list-group-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    border: none;
    border-bottom: 1px solid var(--border-on-light-hairline);
    background: transparent;
    color: inherit;
    font-size: var(--font-size-base);
}

.list-group-item:last-child {
    border-bottom: none;
}

/* The pairing list is hidden until the organiser asks to see it. Blur is not
   secrecy — the names are in the markup — so the control says so plainly. */
.blurred {
    filter: blur(10px);
    user-select: none;
    transition: filter var(--duration-slow) var(--easing);
}

.pairing-item {
    gap: var(--space-3);
}

.pairing-text {
    flex: 1 1 auto;
    min-width: 0;
    overflow-wrap: anywhere;
}

/* The page behind an open modal must not scroll: two scrollbars, and a wheel
   over the backdrop moving the page rather than the dialog. Set as a class
   rather than as body.style.overflow from script, so the rule is in the
   stylesheet with every other rule. */
body.has-modal-open {
    overflow: hidden;
}
