/* Mobile fullscreen + neon + animações — Compras-app (Intelfoz)
   Alterações de layout: apenas abaixo de lg (992px). Desktop congelado. */

:root {
    --neon-primary: 217 91% 53%;
    --neon-accent: 160 84% 39%;
    --neon-secondary: 199 89% 48%;
    --neon-primary-h: 217;
    --neon-primary-s: 91%;
    --neon-primary-l: 53%;
    --neon-accent-h: 160;
    --neon-accent-s: 84%;
    --neon-accent-l: 39%;
    --neon-secondary-h: 199;
    --neon-secondary-s: 89%;
    --neon-secondary-l: 48%;
    --neon-glow-sm: 0 0 12px hsl(var(--neon-primary) / 0.35);
    --neon-glow-md: 0 0 24px hsl(var(--neon-primary) / 0.45), 0 0 48px hsl(var(--neon-primary) / 0.15);
    --neon-glow-lg: 0 0 32px hsl(var(--neon-primary) / 0.55), 0 0 64px hsl(var(--neon-primary) / 0.2);
    --neon-border: 1px solid hsl(var(--neon-primary) / 0.4);
    --mobile-bottom-nav-h: 4rem;
}

@keyframes neon-pulse {
    0%, 100% { box-shadow: var(--neon-glow-sm); }
    50% { box-shadow: var(--neon-glow-md); }
}

@keyframes neon-border-flow {
    0%, 100% { border-color: hsl(var(--neon-primary) / 0.3); }
    50% { border-color: hsl(var(--neon-primary) / 0.7); }
}

@keyframes page-enter {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes stagger-fade-up {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Neon cards — preset Intelfoz */
html[data-theme-preset="intelfoz"] .neon-card {
    position: relative;
    border-radius: var(--border-radius, 12px);
    border: var(--neon-border);
    background: color-mix(in srgb, var(--card-bg) 80%, transparent);
    backdrop-filter: blur(6px);
    box-shadow: var(--neon-glow-sm);
    transition: transform 0.3s ease-out, box-shadow 0.3s ease, border-color 0.3s ease;
    cursor: pointer;
    overflow: hidden;
    animation: neon-border-flow 3s ease-in-out infinite;
}

html[data-theme-preset="intelfoz"] .neon-card:hover,
html[data-theme-preset="intelfoz"] .neon-card:focus-visible {
    animation: none;
    box-shadow: var(--neon-glow-md);
    transform: scale(1.02);
    outline: none;
}

html[data-theme-preset="intelfoz"] .neon-card:active {
    transform: scale(0.98);
}

html[data-theme-preset="intelfoz"] .neon-card:focus-visible {
    box-shadow: var(--neon-glow-md), 0 0 0 2px var(--primary-color);
}

html[data-theme-preset="intelfoz"] .neon-card--solicitacoes,
html[data-theme-preset="intelfoz"] .neon-card--cartoes,
html[data-theme-preset="intelfoz"] .neon-card--dashboard {
    --neon-primary: 217 91% 53%;
}

html[data-theme-preset="intelfoz"] .neon-card--compras,
html[data-theme-preset="intelfoz"] .neon-card--pdv {
    --neon-primary: var(--neon-accent);
}

html[data-theme-preset="intelfoz"] .neon-card--financeiro,
html[data-theme-preset="intelfoz"] .neon-card--planos {
    --neon-primary: var(--neon-secondary);
}

html[data-theme-preset="intelfoz"] .neon-card__icon {
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.75rem;
    background: hsl(var(--neon-primary) / 0.12);
    color: hsl(var(--neon-primary));
}

html[data-theme-preset="intelfoz"] .neon-card__title {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

html[data-theme-preset="intelfoz"] .neon-card__desc,
html[data-theme-preset="intelfoz"] .neon-card__stat-label {
    color: #6b7280;
    font-size: 0.875rem;
    margin-bottom: 0;
}

html[data-theme-preset="intelfoz"] .neon-card__stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

html[data-theme-preset="intelfoz"] .neon-card-stagger {
    opacity: 0;
    animation: stagger-fade-up 0.35s ease-out forwards;
}

/* Transição de views */
.app-view-enter {
    animation: page-enter 0.25s ease-out forwards;
}

/* Mobile only — layout fullscreen */
@media (max-width: 991.98px) {
    body.app-dashboard {
        min-height: 100dvh;
        overflow-x: hidden;
        padding-bottom: env(safe-area-inset-bottom);
    }

    .app-shell {
        display: flex;
        flex-direction: column;
        min-height: 100dvh;
        width: 100%;
        overflow-x: hidden;
    }

    .app-shell > .navbar {
        position: sticky;
        top: 0;
        z-index: 1030;
        min-height: 3.5rem;
        padding-top: max(0.5rem, env(safe-area-inset-top));
        padding-bottom: 0.5rem;
        backdrop-filter: blur(12px);
    }

    .app-shell > .navbar .container-fluid {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }

    .app-main {
        flex: 1;
        min-height: 0;
        display: flex;
        flex-direction: column;
    }

    .app-main > .row {
        flex: 1;
        min-height: 0;
    }

    .app-viewport {
        min-height: calc(100dvh - 3.5rem - var(--mobile-bottom-nav-h) - env(safe-area-inset-bottom));
        overflow-x: hidden;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: calc(var(--mobile-bottom-nav-h) + 0.5rem);
    }

    .app-viewport > [id$="-content"] {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }

    .app-viewport > [id$="-content"] h2 {
        font-size: 1.25rem;
        margin-bottom: 1rem !important;
    }

    /* Touch targets */
    .app-shell .btn,
    .app-shell .nav-link,
    .app-shell .form-control,
    .app-shell .form-select {
        min-height: 3rem;
    }

    .mobile-bottom-nav {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 1040;
        display: flex;
        align-items: stretch;
        justify-content: space-around;
        height: calc(var(--mobile-bottom-nav-h) + env(safe-area-inset-bottom));
        padding-bottom: env(safe-area-inset-bottom);
        background: color-mix(in srgb, var(--card-bg) 92%, transparent);
        backdrop-filter: blur(16px);
        border-top: 1px solid color-mix(in srgb, var(--primary-color) 15%, transparent);
        box-shadow: 0 -4px 24px rgba(15, 23, 42, 0.08);
    }

    .mobile-bottom-nav__item {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 0.125rem;
        min-height: 3rem;
        min-width: 3rem;
        padding: 0.375rem 0.25rem;
        border: none;
        background: transparent;
        color: #64748b;
        font-size: 0.65rem;
        font-weight: 600;
        text-decoration: none;
        transition: color 0.2s ease, transform 0.15s ease;
    }

    .mobile-bottom-nav__item i {
        font-size: 1.25rem;
    }

    .mobile-bottom-nav__item.active,
    .mobile-bottom-nav__item:hover {
        color: var(--primary-color);
    }

    .mobile-bottom-nav__item:active {
        transform: scale(0.95);
    }

    html[data-theme-preset="intelfoz"] .neon-card {
        animation: neon-pulse 3s ease-in-out infinite, neon-border-flow 3s ease-in-out infinite;
    }

    html[data-theme-preset="intelfoz"] .neon-card:hover,
    html[data-theme-preset="intelfoz"] .neon-card:focus-visible {
        animation: none;
    }

    #dashboard-cards.row {
        --bs-gutter-x: 1rem;
        --bs-gutter-y: 1rem;
    }

    #dashboard-cards .col-6,
    #dashboard-cards .col-md-3,
    #dashboard-cards .col-md-4,
    #dashboard-cards .col-lg-3 {
        flex: 0 0 100%;
        max-width: 100%;
    }
}

/* Dark + Intelfoz neon */
html[data-theme="dark"][data-theme-preset="intelfoz"] .neon-card,
html[data-theme-preset="intelfoz"] body[data-theme="dark"] .neon-card {
    background: color-mix(in srgb, var(--card-bg) 90%, transparent);
}

html[data-theme="dark"][data-theme-preset="intelfoz"] .neon-card__desc,
html[data-theme-preset="intelfoz"] body[data-theme="dark"] .neon-card__desc,
html[data-theme="dark"][data-theme-preset="intelfoz"] .neon-card__stat-label,
html[data-theme-preset="intelfoz"] body[data-theme="dark"] .neon-card__stat-label {
    color: #94a3b8;
}

html[data-theme="dark"] .mobile-bottom-nav {
    background: color-mix(in srgb, #1e293b 95%, transparent);
    border-top-color: #334155;
}

/* Acessibilidade: reduzir movimento */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    html[data-theme-preset="intelfoz"] .neon-card {
        animation: none !important;
    }

    .app-view-enter,
    .neon-card-stagger {
        animation: none !important;
        opacity: 1 !important;
        transform: none !important;
    }
}
