/**
 * Mobile Bottom Navigation - Premium App-Style
 * 
 * Barra de navegación inferior para dispositivos móviles.
 * Diseño glassmorphism moderno tipo aplicación nativa.
 * 
 * Solo para modo cliente (usuarios normales).
 */

/* ===== VARIABLES ===== */
:root {
    --mobile-nav-height: 70px;
    --mobile-nav-bg: rgba(255, 255, 255, 0.85);
    --mobile-nav-blur: 20px;
    --mobile-nav-shadow: 0 -8px 32px rgba(0, 0, 0, 0.08);
    --mobile-nav-border: rgba(255, 255, 255, 0.5);
    --mobile-nav-active: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --mobile-nav-text: #64748b;
    --mobile-nav-text-active: #667eea;
}

/* ===== HIDE DESKTOP NAVBAR ON MOBILE ===== */
@media (max-width: 991.98px) {
    /* Ocultar navbar desktop */
    nav.navbar.navbar-client,
    .navbar.modern-navbar.navbar-client {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
    }
    
    /* Ajustar padding del body para el header superior y bottom nav */
    body {
        padding-top: 70px !important;
        padding-bottom: calc(var(--mobile-nav-height) + 20px) !important;
    }
    
    /* Ajustar main-container */
    .main-container {
        padding-top: 1rem !important;
        margin-top: 0 !important;
    }
    
    /* Ocultar el toggler de Bootstrap */
    .navbar-toggler {
        display: none !important;
    }
}

/* ===== MOBILE TOP HEADER ===== */
.mobile-header {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1040;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 0.75rem 1rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
}

@media (max-width: 991.98px) {
    .mobile-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
    }
    
    body {
        padding-top: 65px !important;
    }
}

.mobile-header-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: #1e293b;
    font-weight: 700;
    font-size: 1.1rem;
}

.mobile-header-brand .brand-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1rem;
}

.mobile-header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.mobile-header-btn {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: #f8fafc;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    text-decoration: none;
}

.mobile-header-btn:hover,
.mobile-header-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.mobile-header-btn .badge-dot {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 8px;
    height: 8px;
    background: #ef4444;
    border-radius: 50%;
    border: 2px solid white;
}

.mobile-wallet-badge {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(16, 185, 129, 0.05));
    border: 1px solid rgba(16, 185, 129, 0.2);
    padding: 0.4rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
    color: #059669;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    text-decoration: none;
    transition: all 0.2s ease;
}

.mobile-wallet-badge:hover {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.15), rgba(16, 185, 129, 0.1));
    color: #047857;
}

.mobile-wallet-badge i {
    font-size: 0.75rem;
}

/* ===== MOBILE BOTTOM NAVIGATION ===== */
.mobile-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1050;
    background: var(--mobile-nav-bg);
    backdrop-filter: blur(var(--mobile-nav-blur));
    -webkit-backdrop-filter: blur(var(--mobile-nav-blur));
    box-shadow: var(--mobile-nav-shadow);
    border-top: 1px solid var(--mobile-nav-border);
    padding: 0.5rem 0.75rem;
    padding-bottom: max(0.5rem, env(safe-area-inset-bottom));
}

@media (max-width: 991.98px) {
    .mobile-bottom-nav {
        display: block;
    }
}

.mobile-nav-container {
    display: flex;
    justify-content: space-around;
    align-items: flex-end;
    max-width: 500px;
    margin: 0 auto;
}

/* ===== NAV ITEMS ===== */
.mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    padding: 0.4rem 0.75rem;
    border-radius: 16px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    min-width: 60px;
}

.mobile-nav-item .nav-icon {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    color: var(--mobile-nav-text);
    background: transparent;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.mobile-nav-item .nav-label {
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--mobile-nav-text);
    margin-top: 0.2rem;
    transition: all 0.3s ease;
    white-space: nowrap;
}

/* ===== ACTIVE STATE ===== */
.mobile-nav-item.active .nav-icon {
    background: var(--mobile-nav-active);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    transform: translateY(-2px);
}

.mobile-nav-item.active .nav-label {
    color: #667eea;
    font-weight: 700;
}

/* ===== HOVER STATE ===== */
.mobile-nav-item:not(.active):hover .nav-icon {
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
}

/* ===== CENTER ITEM (CART - MAIN ACTION) ===== */
.mobile-nav-item.nav-main {
    position: relative;
}

.mobile-nav-item.nav-main .nav-icon {
    width: 52px;
    height: 52px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 16px;
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
    transform: translateY(-8px);
}

.mobile-nav-item.nav-main .nav-icon::before {
    content: '';
    position: absolute;
    inset: -3px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 18px;
    z-index: -1;
    opacity: 0.3;
    animation: pulse-glow 2s ease-in-out infinite;
}

@keyframes pulse-glow {
    0%, 100% { transform: scale(1); opacity: 0.3; }
    50% { transform: scale(1.05); opacity: 0.5; }
}

.mobile-nav-item.nav-main:active .nav-icon {
    transform: translateY(-6px) scale(0.95);
}

/* ===== BADGE (Cart Count, Notifications) ===== */
.mobile-nav-badge {
    position: absolute;
    top: 0;
    right: calc(50% - 24px);
    min-width: 18px;
    height: 18px;
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    font-size: 0.6rem;
    font-weight: 700;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    border: 2px solid white;
    box-shadow: 0 2px 6px rgba(239, 68, 68, 0.4);
    animation: badge-pop 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.mobile-nav-item.nav-main .mobile-nav-badge {
    top: -8px;
    right: calc(50% - 28px);
}

@keyframes badge-pop {
    0% { transform: scale(0); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

/* ===== RIPPLE EFFECT ===== */
.mobile-nav-item::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 16px;
    background: radial-gradient(circle, rgba(102, 126, 234, 0.3) 0%, transparent 70%);
    opacity: 0;
    transform: scale(0);
    transition: all 0.5s ease;
}

.mobile-nav-item:active::after {
    opacity: 1;
    transform: scale(2);
    transition: 0s;
}

/* ===== MOBILE SLIDE-UP MENU ===== */
.mobile-menu-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1055;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.mobile-menu-overlay.active {
    opacity: 1;
}

@media (max-width: 991.98px) {
    .mobile-menu-overlay {
        display: block;
        pointer-events: none;
    }
    
    .mobile-menu-overlay.active {
        pointer-events: auto;
    }
}

.mobile-menu-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-radius: 24px 24px 0 0;
    padding: 1.5rem;
    padding-bottom: max(1.5rem, calc(env(safe-area-inset-bottom) + 1rem));
    z-index: 1056;
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    max-height: 80vh;
    overflow-y: auto;
}

.mobile-menu-overlay.active .mobile-menu-panel {
    transform: translateY(0);
}

.mobile-menu-handle {
    width: 40px;
    height: 4px;
    background: #e2e8f0;
    border-radius: 2px;
    margin: 0 auto 1.25rem;
}

.mobile-menu-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #f1f5f9;
    margin-bottom: 1rem;
}

.mobile-menu-avatar {
    width: 50px;
    height: 50px;
    border-radius: 14px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.25rem;
}

.mobile-menu-user h4 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: #1e293b;
}

.mobile-menu-user span {
    font-size: 0.8rem;
    color: #64748b;
}

.mobile-menu-section {
    margin-bottom: 1rem;
}

.mobile-menu-section-title {
    font-size: 0.7rem;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
    padding-left: 0.5rem;
}

.mobile-menu-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 0.75rem;
    border-radius: 12px;
    text-decoration: none;
    color: #334155;
    font-weight: 500;
    font-size: 0.95rem;
    transition: all 0.2s ease;
}

.mobile-menu-item:hover,
.mobile-menu-item.active {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.08), rgba(118, 75, 162, 0.05));
    color: #667eea;
}

.mobile-menu-item i {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: #f8fafc;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    color: #64748b;
    transition: all 0.2s ease;
}

.mobile-menu-item:hover i,
.mobile-menu-item.active i {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.mobile-menu-item.danger {
    color: #ef4444;
}

.mobile-menu-item.danger i {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.mobile-menu-item.danger:hover i {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
}

/* ===== QUICK ACTIONS IN MENU ===== */
.mobile-quick-actions {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.mobile-quick-action {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 0.5rem;
    background: #f8fafc;
    border-radius: 14px;
    text-decoration: none;
    color: #334155;
    transition: all 0.2s ease;
}

.mobile-quick-action:hover {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(118, 75, 162, 0.08));
    transform: translateY(-2px);
}

.mobile-quick-action i {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    color: #667eea;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.mobile-quick-action span {
    font-size: 0.72rem;
    font-weight: 600;
    color: #475569;
}

/* ===== DARK MODE SUPPORT ===== */
@media (prefers-color-scheme: dark) {
    :root {
        --mobile-nav-bg: rgba(30, 41, 59, 0.9);
        --mobile-nav-border: rgba(255, 255, 255, 0.1);
        --mobile-nav-text: #94a3b8;
    }
    
    .mobile-header {
        background: rgba(30, 41, 59, 0.95);
        border-color: rgba(255, 255, 255, 0.1);
    }
    
    .mobile-header-brand {
        color: white;
    }
    
    .mobile-menu-panel {
        background: #1e293b;
    }
    
    .mobile-menu-user h4 {
        color: white;
    }
    
    .mobile-menu-item {
        color: #e2e8f0;
    }
    
    .mobile-menu-item i {
        background: rgba(255, 255, 255, 0.1);
        color: #94a3b8;
    }
    
    .mobile-quick-action {
        background: rgba(255, 255, 255, 0.05);
        color: #e2e8f0;
    }
    
    .mobile-quick-action i {
        background: rgba(255, 255, 255, 0.1);
    }
}

/* ===== LANDSCAPE ADJUSTMENTS ===== */
@media (max-width: 991.98px) and (orientation: landscape) {
    .mobile-bottom-nav {
        padding: 0.35rem 1rem;
    }
    
    .mobile-nav-item .nav-icon {
        width: 38px;
        height: 38px;
        font-size: 1rem;
    }
    
    .mobile-nav-item.nav-main .nav-icon {
        width: 44px;
        height: 44px;
        transform: translateY(-4px);
    }
    
    .mobile-nav-item .nav-label {
        display: none;
    }
}

/* ===== SMALL SCREENS ===== */
@media (max-width: 374px) {
    .mobile-nav-item {
        min-width: 50px;
        padding: 0.3rem 0.5rem;
    }
    
    .mobile-nav-item .nav-icon {
        width: 38px;
        height: 38px;
        font-size: 1rem;
    }
    
    .mobile-nav-item .nav-label {
        font-size: 0.6rem;
    }
}

/* ===== TABLET SPECIFIC ===== */
@media (min-width: 768px) and (max-width: 991.98px) {
    .mobile-nav-container {
        max-width: 600px;
    }
    
    .mobile-nav-item {
        min-width: 80px;
    }
    
    .mobile-nav-item .nav-icon {
        width: 48px;
        height: 48px;
    }
    
    .mobile-nav-item .nav-label {
        font-size: 0.7rem;
    }
}

/* ===== DESACTIVAR HOVER ANIMATIONS EN DISPOSITIVOS TÁCTILES ===== */
@media (hover: none) {
    .mobile-quick-action:hover {
        transform: none !important;
    }
}
