/**
 * TurniX PWA - Bottom Navigation Styles
 * Visibile solo su mobile < 768px per utenti Operator
 */

/* Bottom Navigation Bar */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: #ffffff;
    border-top: 1px solid #dee2e6;
    display: none;
    z-index: 1030;
    padding-bottom: env(safe-area-inset-bottom, 0);
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.08);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Mostra solo su mobile */
@media (max-width: 767.98px) {
    .bottom-nav {
        display: flex;
        align-items: stretch;
    }

    /* Aggiungi padding al body per evitare sovrapposizione contenuto */
    body.has-bottom-nav {
        padding-bottom: calc(56px + env(safe-area-inset-bottom, 0));
    }

    /* Nascondi footer su mobile quando c'è bottom nav */
    body.has-bottom-nav .footer {
        display: none;
    }
}

/* Container items */
.bottom-nav-items {
    display: flex;
    flex: 1;
    justify-content: space-around;
    align-items: stretch;
    margin: 0;
    padding: 0;
    list-style: none;
}

/* Single nav item */
.bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* Nav link */
.bottom-nav-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    padding: 6px 8px;
    color: #6c757d;
    text-decoration: none;
    font-size: 11px;
    font-weight: 500;
    transition: all 0.2s ease;
    position: relative;
    -webkit-tap-highlight-color: transparent;
}

.bottom-nav-link:hover,
.bottom-nav-link:focus {
    color: #BA1817;
    text-decoration: none;
}

.bottom-nav-link:active {
    background-color: rgba(186, 24, 23, 0.05);
}

/* Active state */
.bottom-nav-link.active {
    color: #BA1817;
}

.bottom-nav-link.active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 32px;
    height: 3px;
    background: #BA1817;
    border-radius: 0 0 3px 3px;
}

/* Icon */
.bottom-nav-icon {
    font-size: 22px;
    line-height: 1;
    margin-bottom: 2px;
    transition: transform 0.2s ease;
}

.bottom-nav-link:active .bottom-nav-icon {
    transform: scale(0.9);
}

.bottom-nav-link.active .bottom-nav-icon {
    font-weight: bold;
}

/* Label */
.bottom-nav-label {
    font-size: 10px;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 60px;
}

/* Badge per notifiche */
.bottom-nav-badge {
    position: absolute;
    top: 4px;
    right: 50%;
    transform: translateX(16px);
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    font-size: 10px;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
    color: #fff;
    background: #dc3545;
    border-radius: 9px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.bottom-nav-badge:empty {
    display: none;
}

/* Central action button (FAB style) */
.bottom-nav-fab {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.bottom-nav-fab .bottom-nav-link {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: linear-gradient(135deg, #BA1817 0%, #9a1314 100%);
    color: #fff;
    margin-top: -16px;
    box-shadow: 0 4px 12px rgba(186, 24, 23, 0.3);
    padding: 0;
    transition: all 0.2s ease;
}

.bottom-nav-fab .bottom-nav-link:hover,
.bottom-nav-fab .bottom-nav-link:focus {
    color: #fff;
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(186, 24, 23, 0.4);
}

.bottom-nav-fab .bottom-nav-link:active {
    transform: scale(0.95);
    background: #9a1314;
}

.bottom-nav-fab .bottom-nav-icon {
    font-size: 24px;
    margin-bottom: 0;
}

.bottom-nav-fab .bottom-nav-label {
    display: none;
}

.bottom-nav-fab .bottom-nav-link.active::before {
    display: none;
}

/* Touch target minimo 44x44 per accessibilità */
.bottom-nav-link {
    min-width: 44px;
    min-height: 44px;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .bottom-nav {
        background: #1a1a1a;
        border-top-color: #333;
    }

    .bottom-nav-link {
        color: #adb5bd;
    }

    .bottom-nav-link:hover,
    .bottom-nav-link:focus,
    .bottom-nav-link.active {
        color: #f8f9fa;
    }

    .bottom-nav-link:active {
        background-color: rgba(255, 255, 255, 0.05);
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .bottom-nav-link,
    .bottom-nav-icon,
    .bottom-nav-fab .bottom-nav-link {
        transition: none;
    }
}

/* Landscape mode adjustments */
@media (max-height: 500px) and (orientation: landscape) {
    .bottom-nav {
        height: 48px;
    }

    .bottom-nav-icon {
        font-size: 20px;
    }

    .bottom-nav-label {
        font-size: 9px;
    }

    .bottom-nav-fab .bottom-nav-link {
        width: 44px;
        height: 44px;
        margin-top: -10px;
    }

    body.has-bottom-nav {
        padding-bottom: calc(48px + env(safe-area-inset-bottom, 0));
    }
}

/* Animazione ingresso */
@keyframes bottom-nav-slide-up {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

.bottom-nav {
    animation: bottom-nav-slide-up 0.3s ease-out;
}

/* Focus visible per accessibilità tastiera */
.bottom-nav-link:focus-visible {
    outline: 2px solid #BA1817;
    outline-offset: 2px;
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .bottom-nav {
        border-top-width: 2px;
    }

    .bottom-nav-link.active::before {
        height: 4px;
    }

    .bottom-nav-badge {
        border: 2px solid #fff;
    }
}
