/*
 * Navigation-app chooser styles for /map-livewire (see public/js/map-directions.js).
 * Ported from the original map's inline styles. Dark-mode selectors are written as
 * descendant matches so they work whether `dark`/`dark-theme` sits on <html> or <body>.
 */

.nav-chooser-overlay {
    position: fixed;
    inset: 0;
    z-index: 10001;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 1rem;
}

.nav-chooser {
    background: #fff;
    border-radius: 1rem;
    width: 100%;
    max-width: 420px;
    max-height: 85vh;
    overflow-y: auto;
    padding: 1rem 1rem calc(1rem + env(safe-area-inset-bottom));
    animation: navChooserIn 0.2s ease-out;
}

@keyframes navChooserIn {
    from { transform: translateY(1.5rem); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* Bottom sheet on phones, centred dialog on wider screens. */
@media (min-width: 768px) {
    .nav-chooser-overlay { align-items: center; }
    .nav-chooser {
        max-width: 360px;
        padding: 1.25rem;
        box-shadow: 0 20px 45px rgba(0, 0, 0, 0.25);
        animation-name: navChooserZoomIn;
    }

    /* Floating popover next to the clicked link — position set inline by showNavAppChooser(). */
    .nav-chooser-overlay.is-anchored {
        display: block;
        background: transparent;
        padding: 0;
    }
    .nav-chooser-overlay.is-anchored .nav-chooser {
        position: fixed;
        width: 17.5rem;
        max-width: none;
        padding: 0.75rem;
        border: 1px solid rgba(0, 0, 0, 0.08);
        box-shadow: 0 12px 32px rgba(0, 0, 0, 0.22);
        transform-origin: top left;
        animation-name: navChooserPopIn;
    }
    .nav-chooser-overlay.is-anchored .nav-chooser-title { text-align: left; }
    .dark .nav-chooser-overlay.is-anchored .nav-chooser,
    .dark-theme .nav-chooser-overlay.is-anchored .nav-chooser {
        border-color: rgba(255, 255, 255, 0.12);
    }
}

@keyframes navChooserZoomIn {
    from { transform: scale(0.96); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}
@keyframes navChooserPopIn {
    from { transform: translateX(-0.4rem) scale(0.98); opacity: 0; }
    to { transform: translateX(0) scale(1); opacity: 1; }
}

.nav-chooser-title {
    font-weight: 700;
    font-size: 1rem;
    text-align: center;
    margin-bottom: 0.75rem;
    color: #111827;
}
.nav-chooser-apps { display: flex; flex-direction: column; gap: 0.25rem; }
.nav-chooser-app {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.7rem 0.75rem;
    border-radius: 0.6rem;
    color: #1f2937;
    text-decoration: none;
    font-size: 0.95rem;
}
.nav-chooser-app:hover, .nav-chooser-app:active { background: #f3f4f6; }
.nav-chooser-app.is-preferred { background: #eff6ff; font-weight: 600; }
.nav-chooser-app-icon { font-size: 1.35rem; line-height: 1; }
.nav-chooser-remember {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0.75rem 0 0.5rem;
    padding: 0 0.75rem;
    font-size: 0.85rem;
    color: #6b7280;
    cursor: pointer;
}
.nav-chooser-cancel {
    width: 100%;
    padding: 0.65rem;
    border: none;
    border-radius: 0.6rem;
    background: #f3f4f6;
    color: #374151;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
}
.nav-chooser-cancel:hover { background: #e5e7eb; }

.dark .nav-chooser, .dark-theme .nav-chooser { background: #1f2937; }
.dark .nav-chooser-title, .dark-theme .nav-chooser-title { color: #f3f4f6; }
.dark .nav-chooser-app, .dark-theme .nav-chooser-app { color: #e5e7eb; }
.dark .nav-chooser-app:hover, .dark .nav-chooser-app:active,
.dark-theme .nav-chooser-app:hover, .dark-theme .nav-chooser-app:active { background: #374151; }
.dark .nav-chooser-app.is-preferred, .dark-theme .nav-chooser-app.is-preferred { background: #1e3a5f; }
.dark .nav-chooser-remember, .dark-theme .nav-chooser-remember { color: #9aa0a6; }
.dark .nav-chooser-cancel, .dark-theme .nav-chooser-cancel { background: #374151; color: #e5e7eb; }
.dark .nav-chooser-cancel:hover, .dark-theme .nav-chooser-cancel:hover { background: #4b5563; }
