/* Shared modal frame (site polish, 2026-11).
 *
 * Add these classes to an existing modal; its own open/close JS stays as is,
 * because this file never sets `display` on the overlay:
 *   overlay   .nl-modal         blurred backdrop; bottom sheet on phones
 *   panel     .nl-modal-panel   surface, border, radius, shadow, entrance
 *   header    .nl-modal-head    padding + divider
 *   title     .nl-modal-title   heading face
 *   close     .nl-modal-close   34px target with a focus ring
 *   footer    .nl-modal-foot    optional action row
 *   buttons   .nl-btn / .nl-btn-primary / .nl-btn-danger
 *
 * Selectors are doubled (.x.x) so they outrank a page's single-class rules
 * without !important. The look matches components/add_to_deck_modal.html.
 */

.nl-modal.nl-modal {
    background: rgba(5, 5, 10, 0.72);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
}

.nl-modal-panel.nl-modal-panel {
    position: relative;
    background: #12121a;
    border: 1px solid #2a2a40;
    border-radius: 16px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.55);
    color: #f4f4f5;
    font-family: 'Outfit', system-ui, sans-serif;
    /* Animations restart whenever the element goes from display:none to shown,
       so this runs on every open however the page toggles the overlay. */
    animation: nl-modal-rise 0.2s cubic-bezier(.2, .8, .2, 1);
}
.nl-modal-panel.nl-modal-accent::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    border-radius: 16px 16px 0 0;
    background: linear-gradient(90deg, #7c3aed, #f59e0b, #7c3aed);
    pointer-events: none;
}
@keyframes nl-modal-rise {
    from { opacity: 0; transform: translateY(10px) scale(.985); }
    to   { opacity: 1; transform: none; }
}

.nl-modal-head.nl-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.9rem 0.9rem 0.9rem 1.4rem;
    border-bottom: 1px solid #2a2a40;
}

.nl-modal-title.nl-modal-title {
    font-family: 'Cinzel', serif;
    font-weight: 700;
    font-size: 1.15rem;
    letter-spacing: 0.01em;
    line-height: 1.25;
    color: #f4f4f5;
}
/* In a header row the title carries no margin; a header-less panel keeps the
   page's own spacing under its title. */
.nl-modal-head .nl-modal-title.nl-modal-title { margin: 0; }

.nl-modal-close.nl-modal-close {
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: none;
    color: #71717a;
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}
.nl-modal-close.nl-modal-close:hover { background: #1c1c2a; color: #f4f4f5; }
.nl-modal-close.nl-modal-close svg { width: 18px; height: 18px; }

.nl-modal-foot.nl-modal-foot {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 0.6rem;
    padding: 0.9rem 1.4rem;
    border-top: 1px solid #2a2a40;
}

.nl-btn.nl-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 38px;
    padding: 0 16px;
    border-radius: 10px;
    border: 1px solid #34344f;
    background: #1c1c2a;
    color: #f4f4f5;
    font: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.nl-btn.nl-btn:hover { background: #26263a; border-color: #44445e; }
.nl-btn.nl-btn-primary { background: #8b3ff0; border-color: #8b3ff0; color: #fff; }
.nl-btn.nl-btn-primary:hover { background: #9b55f5; border-color: #9b55f5; box-shadow: 0 6px 20px rgba(139, 63, 240, .3); }
.nl-btn.nl-btn-danger { background: #b91c3c; border-color: #b91c3c; color: #fff; }
.nl-btn.nl-btn-danger:hover { background: #d0244a; border-color: #d0244a; }
.nl-btn.nl-btn:disabled { background: #1c1c2a; border-color: #2a2a40; color: #71717a; box-shadow: none; cursor: not-allowed; }

.nl-modal button:focus-visible,
.nl-modal a:focus-visible,
.nl-modal input:focus-visible,
.nl-modal select:focus-visible,
.nl-modal textarea:focus-visible {
    outline: 2px solid #c4b5fd;
    outline-offset: 2px;
}

/* Phones: a bottom sheet. Overlays that lay out with flex get pinned to the
   bottom; the panel spans the width with only its top corners rounded. */
@media (max-width: 640px) {
    .nl-modal.nl-modal { padding: 0; align-items: flex-end; }
    .nl-modal-panel.nl-modal-panel {
        width: 100%;
        max-width: 100%;
        max-height: 92vh;
        max-height: 92dvh;
        margin: 0;
        border-radius: 16px 16px 0 0;
        border-bottom: 0;
        animation-name: nl-modal-sheet;
    }
    .nl-modal-panel.nl-modal-accent::before { border-radius: 16px 16px 0 0; }
    .nl-modal-head.nl-modal-head { padding: 0.75rem 0.6rem 0.75rem 1.1rem; }
    .nl-modal-foot.nl-modal-foot { padding: 0.8rem 1.1rem calc(0.8rem + env(safe-area-inset-bottom)); }
}
@keyframes nl-modal-sheet {
    from { opacity: .6; transform: translateY(24px); }
    to   { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
    .nl-modal-panel.nl-modal-panel { animation: none; }
}
