/* ============================================================
   AURA — Microsoft Edge / Chromium compatibility layer
   Target: Edge 148.x · ~6 meses atrás (≈ Chromium 130+) · actual
   Non-invasive: layout/nav modules unchanged; only safety nets.
   ============================================================ */

/* ── Browser flags (set by aura-edge-compat.js) ── */
html.aura-edge,
html.aura-chromium {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

/* ── Viewport height: dvh with vh fallback ── */
@supports not (height: 100dvh) {
    .min-h-screen,
    .h-screen,
    .ps-page,
    .m-app,
    body.min-h-screen {
        min-height: 100vh !important;
    }
}

.min-h-\[100dvh\],
.h-\[100dvh\] {
    min-height: 100vh;
    min-height: 100dvh;
}

/* ── Flex/grid overflow (classic Chromium/Edge clip bug) ──
   Solo en regiones de contenido, NO en nav/sidebar (evita romper menús). */
main .flex-1,
main .min-w-0,
.flex-1.min-w-0,
.overflow-hidden > .flex-1,
.overflow-auto > .flex-1,
.overflow-y-auto > .flex-1,
[class*="overflow-"] .flex-1 {
    min-width: 0;
}

#sidebar-container {
    flex-shrink: 0;
}

/* ── Prevent accidental page-level horizontal scroll (not canvas apps) ── */
body.bg-background,
body.ps-page,
.m-app {
    max-width: 100%;
}

/* ── Focus visible (Edge keyboard / a11y) ── */
:focus:not(:focus-visible) {
    outline: none;
}
:focus-visible {
    outline: 2px solid var(--primary, #FF7A20);
    outline-offset: 2px;
}
button:focus-visible,
a:focus-visible,
[role="button"]:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
    outline: 2px solid var(--primary, #FF7A20);
    outline-offset: 2px;
}

/* ── Material Symbols: tipografía local (aura-fonts.css) ── */
.material-symbols-outlined,
.ms {
    font-family: 'Material Symbols Outlined', sans-serif;
    font-weight: normal;
    font-style: normal;
    font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
    -webkit-font-feature-settings: 'liga';
    font-feature-settings: 'liga';
    letter-spacing: normal;
    text-transform: none;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    display: inline-block;
    line-height: 1;
    vertical-align: middle;
}

/* ── Backdrop filter prefix safety ── */
.backdrop-blur,
.backdrop-blur-sm,
.backdrop-blur-md,
.backdrop-blur-lg,
.backdrop-blur-xl,
.glass,
.aura-modal-overlay {
    -webkit-backdrop-filter: blur(8px);
}

/* ── color-mix fallbacks for design tokens (when unsupported) ── */
@supports not (color: color-mix(in srgb, red 50%, blue)) {
    :root {
        --primary-light: #FFF5EB;
        --primary-container: #FFE8D6;
    }
    .dark {
        --primary-light: rgba(249, 115, 22, 0.12);
        --primary-container: rgba(249, 115, 22, 0.15);
    }
}

/* ── Scrollbars (Edge uses both standards + webkit) ── */
.custom-scrollbar,
.launcher-scrollbar,
.case-scrollbar {
    scrollbar-width: thin;
    scrollbar-color: var(--outline, #CBD5E1) transparent;
}
.custom-scrollbar::-webkit-scrollbar,
.launcher-scrollbar::-webkit-scrollbar,
.case-scrollbar::-webkit-scrollbar {
    width: 7px;
    height: 7px;
}
.custom-scrollbar::-webkit-scrollbar-thumb,
.launcher-scrollbar::-webkit-scrollbar-thumb,
.case-scrollbar::-webkit-scrollbar-thumb {
    background: var(--outline, #CBD5E1);
    border-radius: 999px;
}

/* ── Form controls: Edge date/select consistency ── */
input[type="date"],
input[type="datetime-local"],
input[type="time"],
input[type="month"],
input[type="week"],
select {
    -webkit-appearance: none;
    appearance: none;
}

/* ── Dialog / modal stacking in Edge ── */
dialog {
    max-width: min(96vw, 100%);
    max-height: min(92vh, 100%);
}
dialog::backdrop {
    background: rgba(0, 0, 0, 0.45);
}

/* ── Reduced motion (UX a11y) ── */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ── Soft banner if browser is below supported Chromium floor ── */
#aura-edge-unsupported {
    position: sticky;
    top: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.65rem 1rem;
    background: #fff7ed;
    color: #9a3412;
    border-bottom: 1px solid #fed7aa;
    font: 600 0.8125rem/1.4 Manrope, system-ui, sans-serif;
}
#aura-edge-unsupported button {
    border: 0;
    background: transparent;
    color: inherit;
    cursor: pointer;
    font: inherit;
    text-decoration: underline;
}
.dark #aura-edge-unsupported {
    background: rgba(249, 115, 22, 0.15);
    color: #fdba74;
    border-bottom-color: rgba(249, 115, 22, 0.35);
}
