/* PWA — standalone display, safe areas, bottom navigation */

html {
    -webkit-tap-highlight-color: transparent;
}

body.pwa-standalone {
    overscroll-behavior-x: none;
}

body.pwa-has-bottom-nav {
    padding-bottom: calc(4.25rem + env(safe-area-inset-bottom, 0px));
}

@media (max-width: 991.98px) {
    body.pwa-has-bottom-nav #sidebarToggle {
        display: none;
    }

    body.pwa-has-bottom-nav .content-area {
        padding-bottom: 0.5rem;
    }

    body.pwa-has-bottom-nav .app-footer {
        margin-bottom: calc(3.5rem + env(safe-area-inset-bottom, 0px));
    }
}

/* Standalone / installed — hide redundant mobile menu toggle area spacing */
@media (display-mode: standalone) {
    .top-navbar {
        padding-top: env(safe-area-inset-top, 0px);
    }
}

/* Bottom navigation */
.pwa-bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1040;
    display: flex;
    align-items: stretch;
    justify-content: space-around;
    gap: 0;
    min-height: calc(3.75rem + env(safe-area-inset-bottom, 0px));
    padding: 0.35rem 0.25rem env(safe-area-inset-bottom, 0px);
    background: var(--surface, #fff);
    border-top: 1px solid var(--border, #e2e8f0);
    box-shadow: 0 -4px 24px rgba(15, 23, 42, 0.08);
}

.pwa-bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.15rem;
    min-height: 44px;
    padding: 0.25rem 0.15rem;
    border: none;
    background: transparent;
    color: var(--text-muted, #64748b);
    text-decoration: none;
    font-size: 0.65rem;
    font-weight: 600;
    line-height: 1.1;
    border-radius: 0.5rem;
    transition: color 0.15s, background 0.15s;
}

.pwa-bottom-nav-item i {
    font-size: 1.25rem;
}

.pwa-bottom-nav-menu .sidebar-menu-icon {
    flex-shrink: 0;
}

.pwa-bottom-nav-item.active {
    color: var(--primary, #4f46e5);
    background: rgba(79, 70, 229, 0.08);
}

.pwa-bottom-nav-item:active {
    transform: scale(0.96);
}

.pwa-bottom-nav-icon-wrap {
    position: relative;
    display: inline-flex;
}

.pwa-bottom-nav-badge {
    position: absolute;
    top: -4px;
    right: -10px;
    min-width: 1rem;
    height: 1rem;
    padding: 0 0.25rem;
    font-size: 0.6rem;
    font-weight: 700;
    line-height: 1rem;
    text-align: center;
    color: #fff;
    background: #ef4444;
    border-radius: 999px;
}

/* Install prompt banner */
.pwa-install-icon {
    object-fit: contain;
    background: #fff;
    flex-shrink: 0;
}

.pwa-install-banner {
    position: fixed;
    left: 0.75rem;
    right: 0.75rem;
    bottom: calc(4.5rem + env(safe-area-inset-bottom, 0px));
    z-index: 1050;
    animation: pwaSlideUp 0.35s ease;
}

@media (min-width: 992px) {
    .pwa-install-banner {
        left: auto;
        right: 1rem;
        bottom: 1rem;
        max-width: 380px;
    }
}

.pwa-install-banner-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.85rem 1rem;
    background: var(--surface, #fff);
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 12px;
    box-shadow: 0 12px 40px rgba(15, 23, 42, 0.15);
}

@keyframes pwaSlideUp {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

[data-bs-theme="dark"] .pwa-bottom-nav {
    background: var(--surface, #1e293b);
    border-top-color: var(--border, #334155);
}

[data-bs-theme="dark"] .pwa-install-banner-inner {
    background: var(--surface, #1e293b);
    border-color: var(--border, #334155);
}
