/* ========================================
   BOTTOM NAVIGATION PUBLICO - MOBILE ONLY
   ======================================== */

/* ==========================================
   BASE STYLES - Hidden on desktop
   ========================================== */

.bottom-nav-publico,
.bottom-nav-publico-overlay,
.bottom-nav-publico-menu {
    display: none;
}

/* ==========================================
   MOBILE STYLES (< 768px)
   ========================================== */

@media (max-width: 767px) {
    /* Show bottom nav on mobile */
    .bottom-nav-publico {
        display: block;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 50;
        background: #65aec9; /* MuniValpo blue */
        border-top: 2px solid #5a9db8;
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
        padding-bottom: env(safe-area-inset-bottom);
    }

    .bottom-nav-publico-container {
        display: flex;
        justify-content: center;
        align-items: center;
        height: 4rem; /* 64px */
        max-width: 100%;
        padding: 0 0.5rem;
    }

    .bottom-nav-publico-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        flex: 1;
        max-width: 5rem;
        padding: 0.5rem;
        color: rgba(255, 255, 255, 0.8);
        text-decoration: none;
        transition: all 0.2s ease;
        position: relative;
        background: transparent;
        border: none;
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
    }

    /* Botón único centrado y más grande */
    .bottom-nav-publico-item-single {
        max-width: 8rem;
        padding: 0.75rem 2rem;
    }

    .bottom-nav-publico-item-single .bottom-nav-publico-icon {
        width: 2rem;
        height: 2rem;
        font-size: 1.5rem;
    }

    .bottom-nav-publico-item-single .bottom-nav-publico-label {
        font-size: 0.875rem;
        margin-top: 0.25rem;
    }

    .bottom-nav-publico-item:active {
        transform: scale(0.95);
    }

    .bottom-nav-publico-icon {
        width: 1.5rem;
        height: 1.5rem;
        margin-bottom: 0.25rem;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1.25rem;
    }

    .bottom-nav-publico-icon i {
        transition: all 0.2s ease;
    }

    .bottom-nav-publico-label {
        font-size: 0.625rem; /* 10px */
        font-weight: 500;
        line-height: 1;
        text-align: center;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 100%;
    }

    /* Active state */
    .bottom-nav-publico-item.active {
        color: #f5b800; /* MuniValpo yellow */
    }

    .bottom-nav-publico-item.active .bottom-nav-publico-icon i {
        transform: scale(1.1);
    }

    /* Active indicator - small dot above icon */
    .bottom-nav-publico-indicator {
        position: absolute;
        top: 0.25rem;
        width: 0.25rem;
        height: 0.25rem;
        background: #f5b800; /* MuniValpo yellow */
        border-radius: 50%;
    }

    /* ==========================================
       BOTTOM NAV OVERLAY
       ========================================== */

    .bottom-nav-publico-overlay {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 45;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease, visibility 0.3s ease;
        backdrop-filter: blur(2px);
    }

    .bottom-nav-publico-overlay.visible {
        opacity: 1;
        visibility: visible;
    }

    /* ==========================================
       BOTTOM NAV MENU (Full screen slide up)
       ========================================== */

    .bottom-nav-publico-menu {
        display: block;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 46;
        background: white;
        border-top-left-radius: 1rem;
        border-top-right-radius: 1rem;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
        max-height: 85vh;
        transform: translateY(100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        overflow: hidden;
        display: flex;
        flex-direction: column;
    }

    .bottom-nav-publico-menu.open {
        transform: translateY(0);
    }

    /* Menu header */
    .bottom-nav-publico-menu-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 1.5rem 1rem 1rem;
        border-bottom: 1px solid #e5e7eb;
        background: #f9fafb;
    }

    .bottom-nav-publico-menu-user {
        display: flex;
        align-items: center;
        gap: 0.75rem;
    }

    .bottom-nav-publico-menu-user-avatar {
        width: 3rem;
        height: 3rem;
        border-radius: 50%;
        background: white;
        display: flex;
        align-items: center;
        justify-content: center;
        color: #65aec9;
        border: 2px solid #65aec9;
    }

    .bottom-nav-publico-menu-user-info {
        display: flex;
        flex-direction: column;
    }

    .bottom-nav-publico-menu-user-name {
        font-size: 1rem;
        font-weight: 600;
        color: #111827;
    }

    .bottom-nav-publico-menu-user-role {
        font-size: 0.875rem;
        color: #6b7280;
    }

    .bottom-nav-publico-menu-close {
        width: 2.5rem;
        height: 2.5rem;
        border-radius: 50%;
        background: transparent;
        border: none;
        color: #6b7280;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        transition: all 0.2s ease;
    }

    .bottom-nav-publico-menu-close:active {
        background: #f3f4f6;
        transform: scale(0.95);
    }

    /* Menu content */
    .bottom-nav-publico-menu-content {
        overflow-y: auto;
        flex: 1;
        padding: 0.5rem 0 6rem; /* Extra padding para que no quede tapado por el bottom nav */
        -webkit-overflow-scrolling: touch;
    }

    .bottom-nav-publico-menu-section {
        padding: 0.5rem 0;
    }

    .bottom-nav-publico-menu-section-title {
        font-size: 0.75rem;
        font-weight: 600;
        color: #6b7280;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        padding: 0.5rem 1rem;
        margin: 0;
    }

    .bottom-nav-publico-menu-link {
        display: flex;
        align-items: center;
        gap: 0.75rem;
        padding: 0.75rem 1rem;
        color: #374151;
        text-decoration: none;
        font-size: 0.9375rem;
        transition: background 0.2s ease;
        background: transparent;
        border: none;
        width: 100%;
        text-align: left;
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
    }

    .bottom-nav-publico-menu-link:active {
        background: #f3f4f6;
    }

    .bottom-nav-publico-menu-link.active {
        background: #eff6ff;
        color: #2563eb;
    }

    .bottom-nav-publico-menu-link.logout {
        color: #dc2626;
    }

    /* Form dentro del menú para logout */
    .bottom-nav-publico-menu-section form {
        width: 100%;
    }

    .bottom-nav-publico-menu-icon {
        width: 1.5rem;
        height: 1.5rem;
        display: flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
    }

    .bottom-nav-publico-menu-icon i {
        font-size: 1.25rem;
    }

    /* ==========================================
       CONTENT ADJUSTMENTS FOR BOTTOM NAV
       ========================================== */

    /* Add padding to main content to avoid overlap with bottom nav */
    main {
        padding-bottom: 5rem !important; /* 4rem nav + 1rem extra */
    }

    /* ==========================================
       ACCESSIBILITY
       ========================================== */

    /* Focus states */
    .bottom-nav-publico-item:focus-visible,
    .bottom-nav-publico-menu-link:focus-visible,
    .bottom-nav-publico-menu-close:focus-visible {
        outline: 2px solid #f5b800;
        outline-offset: 2px;
    }

    /* Reduced motion */
    @media (prefers-reduced-motion: reduce) {
        .bottom-nav-publico-item,
        .bottom-nav-publico-overlay,
        .bottom-nav-publico-menu,
        .bottom-nav-publico-menu-link {
            transition: none !important;
        }
    }
}
