/* ========================================
   BUS PILOT - PROFESSIONAL COMPONENTS
   Bottom Navigation, FAB, Dashboard, MapLibre
   Sviluppato da VERGEN ICT TECHNOLOGY
   ======================================== */

/* ========================================
   BOTTOM NAVIGATION BAR
   ======================================== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--glass-border);
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 0.5rem 1rem;
    padding-bottom: calc(0.5rem + env(safe-area-inset-bottom, 0));
    z-index: 1000;
    box-shadow: 0 -4px 30px rgba(0, 0, 0, 0.3);
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding: 0.5rem 1rem;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--text-muted);
    background: transparent;
    border: none;
    font-family: inherit;
    min-width: 60px;
}

.nav-item:hover {
    color: var(--text-secondary);
}

.nav-item.active {
    color: var(--accent-green);
    background: rgba(0, 200, 83, 0.15);
}

.nav-item .nav-icon {
    font-size: 1.5rem;
    transition: transform 0.3s ease;
}

.nav-item.active .nav-icon {
    transform: scale(1.1);
}

.nav-item .nav-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

/* ========================================
   FLOATING ACTION BUTTON (FAB)
   ======================================== */
.fab-container {
    position: fixed;
    bottom: calc(80px + env(safe-area-inset-bottom, 0));
    right: 1rem;
    z-index: 999;
}

.fab {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    box-shadow: 0 6px 30px rgba(255, 23, 68, 0.5);
    background: var(--gradient-red);
    color: white;
}

.fab:hover {
    transform: scale(1.1);
    box-shadow: 0 8px 40px rgba(255, 23, 68, 0.6);
}

.fab:active {
    transform: scale(0.95);
}

.fab.tracking {
    background: var(--gradient-green);
    box-shadow: 0 6px 30px rgba(0, 200, 83, 0.5);
    animation: pulse-fab 2s infinite;
}

@keyframes pulse-fab {

    0%,
    100% {
        box-shadow: 0 6px 30px rgba(0, 200, 83, 0.5);
        transform: scale(1);
    }

    50% {
        box-shadow: 0 8px 50px rgba(0, 200, 83, 0.8);
        transform: scale(1.05);
    }
}

.fab-icon {
    transition: transform 0.3s ease;
}

.fab.tracking .fab-icon {
    animation: spin-icon 2s linear infinite;
}

@keyframes spin-icon {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* ========================================
   RECORDING INDICATOR
   ======================================== */
.recording-indicator {
    position: fixed;
    top: 70px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--gradient-red);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    display: none;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    font-weight: 600;
    z-index: 1001;
    animation: recording-pulse 1.5s infinite;
    box-shadow: 0 4px 20px rgba(255, 23, 68, 0.4);
}

.recording-indicator.active {
    display: flex;
}

.rec-dot {
    width: 10px;
    height: 10px;
    background: white;
    border-radius: 50%;
    animation: blink 1s infinite;
}

@keyframes blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.3;
    }
}

@keyframes recording-pulse {

    0%,
    100% {
        transform: translateX(-50%) scale(1);
    }

    50% {
        transform: translateX(-50%) scale(1.02);
    }
}

/* ========================================
   STATISTICS DASHBOARD
   ======================================== */
.stats-dashboard {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-primary);
    z-index: 9998;
    overflow-y: auto;
    animation: slideInRight 0.3s ease;
}

.stats-dashboard.hidden {
    display: none;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100%);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.stats-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--glass-border);
    position: sticky;
    top: 0;
    z-index: 10;
}

.stats-header h2 {
    flex: 1;
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0;
}

.stats-content {
    padding: 1rem;
    padding-bottom: 100px;
}

.stats-section {
    margin-bottom: 1.5rem;
}

.stats-section h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
}

.stat-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: all 0.3s ease;
}

.stat-card:hover {
    background: var(--bg-tertiary);
    transform: translateY(-2px);
}

.stat-icon {
    font-size: 2rem;
}

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text-primary);
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

/* Sessions List */
.sessions-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.session-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 1rem;
    transition: all 0.3s ease;
}

.session-card:hover {
    background: var(--bg-tertiary);
}

.session-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.session-route {
    font-weight: 700;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.session-date {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.session-stats {
    display: flex;
    gap: 1rem;
    margin-bottom: 0.75rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.session-actions {
    display: flex;
    gap: 0.5rem;
}

.btn-export,
.btn-delete {
    padding: 0.5rem 1rem;
    border-radius: 8px;
    border: none;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-export {
    background: rgba(0, 200, 83, 0.2);
    color: var(--status-success);
}

.btn-export:hover {
    background: rgba(0, 200, 83, 0.3);
}

.btn-delete {
    background: rgba(255, 82, 82, 0.2);
    color: var(--status-error);
}

.btn-delete:hover {
    background: rgba(255, 82, 82, 0.3);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}

.empty-icon {
    font-size: 4rem;
    display: block;
    margin-bottom: 1rem;
}

.empty-state p {
    margin-bottom: 0.5rem;
}

.empty-hint {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* ========================================
   MAPLIBRE 3D STYLES
   ======================================== */
.maplibre-user-marker {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--accent-blue);
    border: 4px solid white;
    box-shadow: 0 0 20px rgba(41, 121, 255, 0.6);
    cursor: pointer;
}

.maplibre-user-marker.on-track {
    background: var(--status-success);
    box-shadow: 0 0 30px rgba(0, 200, 83, 0.8);
    animation: marker-pulse-green 2s infinite;
}

.maplibre-user-marker.off-track {
    background: var(--status-error);
    box-shadow: 0 0 30px rgba(255, 23, 68, 0.8);
    animation: marker-pulse-red 1s infinite;
}

@keyframes marker-pulse-green {

    0%,
    100% {
        transform: scale(1);
        box-shadow: 0 0 20px rgba(0, 200, 83, 0.6);
    }

    50% {
        transform: scale(1.2);
        box-shadow: 0 0 40px rgba(0, 200, 83, 0.9);
    }
}

@keyframes marker-pulse-red {

    0%,
    100% {
        transform: scale(1);
        box-shadow: 0 0 20px rgba(255, 23, 68, 0.6);
    }

    50% {
        transform: scale(1.3);
        box-shadow: 0 0 50px rgba(255, 23, 68, 1);
    }
}

/* MapLibre Controls Override */
.maplibregl-ctrl-group {
    background: var(--glass-bg) !important;
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border) !important;
    border-radius: 12px !important;
    overflow: hidden;
}

.maplibregl-ctrl-group button {
    background: transparent !important;
    border-bottom: 1px solid var(--glass-border) !important;
}

.maplibregl-ctrl-group button:last-child {
    border-bottom: none !important;
}

.maplibregl-ctrl-group button:hover {
    background: var(--bg-tertiary) !important;
}

.maplibregl-ctrl-group button span {
    filter: invert(1);
}

.maplibregl-ctrl-scale {
    background: var(--glass-bg) !important;
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border) !important;
    color: var(--text-primary) !important;
    border-radius: 8px !important;
    padding: 0 8px !important;
}

/* ========================================
   3D MAP CONTROLS
   ======================================== */
.map-3d-controls {
    position: absolute;
    bottom: 100px;
    left: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    z-index: 100;
}

.map-3d-btn {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    color: var(--text-primary);
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.map-3d-btn:hover {
    background: var(--bg-tertiary);
}

.map-3d-btn:active {
    transform: scale(0.95);
}

.map-3d-btn.active {
    background: var(--gradient-green);
    border-color: transparent;
}

/* ========================================
   PAGES CONTAINER (for routing simulation)
   ======================================== */
.page {
    display: none;
}

.page.active {
    display: block;
}

/* ========================================
   RESPONSIVE ADJUSTMENTS
   ======================================== */
@media (max-width: 380px) {
    .nav-item {
        padding: 0.5rem 0.5rem;
        min-width: 50px;
    }

    .nav-item .nav-label {
        font-size: 0.6rem;
    }

    .fab {
        width: 56px;
        height: 56px;
        font-size: 1.5rem;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }
}

/* Add padding to main content for bottom nav */
.container {
    padding-bottom: calc(80px + env(safe-area-inset-bottom, 0));
}