/* =========================================
   CSS/responsive.css - Optimizaciones Globales
   ========================================= */

/* --- 1. REGLAS GLOBALES ANTI-DESBORDE --- */
html, body {
    max-width: 100vw;
    overflow-x: hidden !important;
    width: 100%;
}

* {
    box-sizing: border-box !important;
}

/* --- 2. TABLETS Y PANTALLAS MEDIANAS (max-width: 950px) --- */
@media (max-width: 950px) {
    /* Checkout - Apilar Columnas */
    .checkout-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    .checkout-form-container {
        padding: 1.5rem;
    }

    /* Producto Detalle - Apilar Carrusel e Info */
    .product-split, .product-split-container {
        flex-direction: column;
        gap: 2rem;
    }
    
    .product-info-side, .product-carousel-side {
        width: 100%;
    }

    .prod-carousel {
        min-height: 450px; 
        height: 100%;
        width: 100%;
    }

    .product-gallery-full, .product-info-box {
        padding: 2rem 1rem;
        width: 100%;
    }
    
    /* Hero y Home */
    .hero-container {
        flex-direction: column;
        text-align: center;
        margin-top: 2rem;
    }
    
    .hero-image {
        margin-top: 2rem;
        display: flex;
        justify-content: center;
    }
    
    /* Panel lateral del Carrito */
    .cart-panel {
        max-width: 100%;
        right: -100%; 
    }
    
    /* Dashboard Admin */
    .metrics-grid {
        grid-template-columns: 1fr;
    }
}

/* --- 3. TELÉFONOS MÓVILES (max-width: 768px) --- */
@media (max-width: 768px) {
    
    /* Ocultar el navbar original dejando solo el logo centrado */
    #navbar nav {
        display: none !important; 
    }
    
    #navbar {
        justify-content: center;
        padding: 1rem 5%;
    }

    /* --- TIPOGRAFÍA FLUIDA (Anti-Desborde) --- */
    /* Usamos clamp() para que los textos gigantes se encojan automáticamente */
    .hero-large-logo .logo-giant {
        font-size: clamp(2rem, 10vw, 3rem) !important;
        word-wrap: break-word !important;
        text-align: center;
        padding: 0 10px;
        width: 100%;
    }

    h1 { 
        font-size: clamp(1.8rem, 8vw, 2.5rem) !important; 
        line-height: 1.2 !important; 
    }
    
    h2 { 
        font-size: clamp(1.5rem, 7vw, 2rem) !important; 
        line-height: 1.3 !important; 
        word-wrap: break-word !important; 
        overflow-wrap: break-word !important;
        hyphens: auto; /* Permite dividir palabras largas */
    }
    
    h3 { font-size: 1.3rem !important; }
    
    p { 
        word-wrap: break-word !important; 
        font-size: 0.95rem !important;
    }

    /* --- ESPACIADOS Y MÁRGENES SEGUROS --- */
    section { 
        padding: 3rem 5% !important; 
        width: 100%;
    }

    .pricing-card { 
        padding: 1.5rem !important; 
    }
    
    .price-amount { 
        font-size: clamp(2rem, 8vw, 2.5rem) !important; 
    }

    /* --- BOTONES Y SECCIÓN DE COMPRAS --- */
    .purchase-actions {
        flex-direction: column !important; /* Apila 'Cantidad' y el botón */
        align-items: stretch !important;
        gap: 15px !important;
        width: 100% !important;
    }
    
    .quantity-wrapper {
        width: 100% !important;
        justify-content: space-between !important;
    }

    .cta-button {
        width: 100% !important;
        font-size: 1.1rem !important;
        padding: 15px !important;
        margin: 0 !important;
        text-align: center;
        box-sizing: border-box;
    }

    /* --- TABLA DE ESPECIFICACIONES (Transformada a Bloques) --- */
    .specs-table {
        display: block !important;
        width: 100% !important;
        border: none !important;
    }
    .specs-table tbody, .specs-table tr {
        display: block !important;
        width: 100% !important;
    }
    .specs-table tr {
        margin-bottom: 15px !important;
        background: rgba(255,255,255,0.03) !important;
        border: 1px solid rgba(255,255,255,0.1) !important;
        border-radius: 8px !important;
        padding: 12px !important;
    }
    .specs-table td {
        display: block !important;
        width: 100% !important;
        padding: 5px 0 !important;
        text-align: center !important;
        border: none !important;
    }
    .specs-table td strong {
        display: block !important;
        color: #01fe86 !important;
        margin-bottom: 5px !important;
        font-size: 1.1rem !important;
    }

    /* --- MENÚ INFERIOR MÓVIL (APP NATIVA) --- */
    .mobile-bottom-nav {
        display: flex !important;
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        height: 70px;
        background-color: #050a0d;
        border-top: 1px solid #27272a;
        z-index: 99999;
        justify-content: space-around;
        align-items: center;
        /* env() Evita que el menú se monte sobre la barra de inicio del iPhone */
        padding-bottom: env(safe-area-inset-bottom); 
        box-shadow: 0 -5px 20px rgba(0,0,0,0.5);
    }

    .mobile-bottom-nav .nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        color: #a1a1aa;
        text-decoration: none;
        font-size: 0.75rem;
        gap: 5px;
        flex: 1;
        height: 100%;
        transition: color 0.3s;
    }

    .mobile-bottom-nav .nav-item i {
        font-size: 1.3rem;
    }

    .mobile-bottom-nav .nav-item.active,
    .mobile-bottom-nav .nav-item:hover {
        color: #01fe86;
    }

    .cart-icon-wrapper {
        position: relative;
        display: inline-block;
    }

    .cart-badge-mobile {
        position: absolute;
        top: -5px;
        right: -10px;
        background: #ff4444;
        color: white;
        font-size: 0.65rem;
        font-weight: bold;
        padding: 2px 5px;
        border-radius: 10px;
        min-width: 18px;
        text-align: center;
    }

    /* Empuja el contenido de la web hacia arriba para que el menú no lo tape */
    body {
        padding-bottom: 85px !important;
    }

    /* Ajustar el botón flotante de WhatsApp */
    .whatsapp-btn {
        bottom: 90px !important;
        right: 20px !important;
        transform: scale(0.9);
    }
}

/* --- 4. OCULTAR MENÚ MÓVIL EN ESCRITORIO --- */
@media (min-width: 769px) {
    .mobile-bottom-nav {
        display: none !important;
    }
}