/* ====================================
   MEJORAS RESPONSIVAS PARA MÓVIL
   ==================================== */

/* ====================================
   1. FIXES PARA INDEX.PHP
   ==================================== */

/* Hero Section - Móvil */
@media (max-width: 768px) {
    /* IMPORTANTE: Espacio compacto - banner + header pegados */
    .hero {
        padding: 320px 0 60px !important; /* banner + header + oferta */
        margin-top: 0 !important; /* Sin margen adicional en móvil */
    }
    
    .hero-content {
        grid-template-columns: 1fr !important;
        gap: 30px !important;
        text-align: center !important;
    }
    
    .hero-text h1 {
        font-size: 2rem !important;
        margin-bottom: 15px !important;
    }
    
    .hero-text p {
        font-size: 1rem !important;
        margin-bottom: 20px !important;
    }
    
    .hero-buttons {
        justify-content: center !important;
        flex-wrap: wrap !important;
    }
    
    .hero-buttons .btn {
        width: 100% !important;
        max-width: 200px !important;
        margin: 5px !important;
    }
    
    .hero-image {
        order: -1 !important; /* Poner imagen arriba */
        margin-bottom: 20px !important;
    }
    
    .hero-image img {
        max-width: 200px !important;
        height: auto !important;
    }
}

/* Móviles muy pequeños */
@media (max-width: 375px) {
    .hero {
        padding: 320px 0 40px !important; /* banner + header + oferta */
    }
    
    .hero-text h1 {
        font-size: 1.5rem !important;
        line-height: 1.2 !important;
    }
    
    .hero-text p {
        font-size: 0.9rem !important;
    }
    
    .hero-image img {
        max-width: 150px !important;
    }
}

/* Ajustes del header para móvil */
@media (max-width: 768px) {
    /* El header pegado al banner */
    header {
        display: block !important;
        position: fixed !important;
        top: 36px !important; /* Debajo del mobile-status-banner compacto */
        box-shadow: none !important;
    }
    
    /* Ocultar el top-bar del header en móviles */
    .top-bar {
        display: none !important;
    }
    
    .top-bar-content {
        display: none !important;
    }
    
    .status-badge {
        display: none !important;
    }
    
    /* Ajustar nav-container para móviles */
    .nav-container {
        padding: 10px 15px !important;
    }
    
    .logo {
        font-size: 1.4rem !important;
    }
    
    /* Ocultar menú de navegación en móviles */
    nav ul {
        display: none !important;
    }
}

/* Secciones generales */
@media (max-width: 768px) {
    .features, .menu-preview, .offers, .cta {
        padding: 50px 0 !important;
    }
    
    .section-title h2 {
        font-size: 1.8rem !important;
    }
    
    .section-title p {
        font-size: 1rem !important;
    }
    
    .container {
        padding: 0 15px !important;
    }
}

/* ====================================
   2. FIXES PARA HACER-PEDIDO.PHP
   ==================================== */

/* Layout de productos en móvil vertical */
@media (max-width: 768px) {
    .product-card {
        display: flex !important;
        flex-direction: column !important;
        padding: 1.25rem !important;
        border-radius: 12px !important;
        background: white !important;
        border: 1px solid #e5e7eb !important;
        margin-bottom: 0.75rem !important;
    }
    
    .product-emoji {
        font-size: 3rem !important;
        text-align: center !important;
        margin-bottom: 0.75rem !important;
        width: 100% !important;
    }
    
    .product-info {
        width: 100% !important;
        margin-bottom: 1rem !important;
    }
    
    .product-name {
        font-size: 1.1rem !important;
        font-weight: 600 !important;
        margin-bottom: 0.5rem !important;
        color: #1a1a1a !important;
        white-space: normal !important;
        overflow: visible !important;
        text-overflow: clip !important;
    }
    
    .product-description {
        font-size: 0.9rem !important;
        color: #6b7280 !important;
        line-height: 1.4 !important;
        margin-bottom: 0.75rem !important;
        display: block !important;
        overflow: visible !important;
        text-overflow: clip !important;
        -webkit-line-clamp: unset !important;
        -webkit-box-orient: unset !important;
    }
    
    .product-price {
        font-size: 1.25rem !important;
        font-weight: 700 !important;
        color: #FF6B35 !important;
        margin-bottom: 1rem !important;
        display: block !important;
    }
    
    .product-actions {
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        width: 100% !important;
        gap: 1rem !important;
    }
    
    .quantity-control {
        display: flex !important;
        align-items: center !important;
        background: #f9fafb !important;
        border-radius: 8px !important;
        border: 1px solid #e5e7eb !important;
    }
    
    .quantity-btn {
        width: 40px !important;
        height: 40px !important;
        font-size: 1.25rem !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        cursor: pointer !important;
        background: transparent !important;
        border: none !important;
        color: #6b7280 !important;
    }
    
    .quantity-input {
        width: 45px !important;
        text-align: center !important;
        font-size: 1rem !important;
        font-weight: 600 !important;
        border: none !important;
        background: transparent !important;
    }
    
    .add-btn {
        padding: 0.75rem 2rem !important;
        font-size: 1rem !important;
        font-weight: 600 !important;
        background: #10b981 !important;
        color: white !important;
        border: none !important;
        border-radius: 8px !important;
        cursor: pointer !important;
        white-space: nowrap !important;
    }
    
    /* Lista de productos */
    .products-list {
        display: flex !important;
        flex-direction: column !important;
        gap: 1rem !important;
    }
}

/* Ofertas en móvil */
@media (max-width: 768px) {
    .offers-scroll {
        display: flex !important;
        overflow-x: auto !important;
        gap: 1rem !important;
        padding: 0 0 1rem 0 !important;
        -webkit-overflow-scrolling: touch !important;
    }
    
    .offer-card {
        min-width: 280px !important;
        flex-shrink: 0 !important;
        padding: 1.25rem !important;
    }
    
    .offer-title {
        font-size: 1rem !important;
    }
    
    .offer-description {
        font-size: 0.85rem !important;
    }
}

/* Categorías en móvil */
@media (max-width: 768px) {
    .category-tabs {
        display: flex !important;
        overflow-x: auto !important;
        gap: 0.5rem !important;
        padding: 0.5rem 0 !important;
        -webkit-overflow-scrolling: touch !important;
    }
    
    .category-tab {
        flex-shrink: 0 !important;
        padding: 0.6rem 1rem !important;
        font-size: 0.9rem !important;
        white-space: nowrap !important;
    }
}

/* Carrito móvil */
@media (max-width: 768px) {
    .mobile-cart {
        max-height: 70vh !important;
        overflow-y: auto !important;
    }
    
    .mobile-cart-items {
        max-height: 30vh !important;
        overflow-y: auto !important;
    }
}

/* Ajustes para iPad/Tablets */
@media (min-width: 768px) and (max-width: 1024px) {
    .product-card {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        gap: 1rem !important;
    }
    
    .product-emoji {
        font-size: 2.5rem !important;
        width: 60px !important;
        margin-bottom: 0 !important;
    }
    
    .product-info {
        flex: 1 !important;
        margin-bottom: 0 !important;
    }
    
    .product-actions {
        flex-direction: column !important;
        width: auto !important;
    }
    
    .add-btn {
        width: 120px !important;
    }
}

/* Fix para prevenir zoom en inputs iOS */
@media (max-width: 768px) {
    input[type="text"],
    input[type="number"],
    input[type="tel"],
    input[type="email"],
    select,
    textarea {
        font-size: 16px !important;
    }
}

/* Optimizaciones de rendimiento */
@media (max-width: 768px) {
    * {
        -webkit-transform: translateZ(0);
        -webkit-backface-visibility: hidden;
    }
    
    .product-card,
    .offer-card,
    .category-tab {
        will-change: transform;
    }
}

/* Mejoras de accesibilidad táctil */
@media (max-width: 768px) {
    button,
    .btn,
    .category-tab,
    .add-btn,
    .quantity-btn {
        min-height: 44px !important; /* Tamaño mínimo recomendado por Apple */
        min-width: 44px !important;
    }
    
    a {
        padding: 8px !important;
        margin: -8px !important; /* Compensar el padding */
    }
}

/* Footer en móvil */
@media (max-width: 768px) {
    .footer-content {
        grid-template-columns: 1fr !important;
        text-align: center !important;
        gap: 30px !important;
    }
    
    .social-links {
        justify-content: center !important;
    }
}

/* Scroll suave */
@media (max-width: 768px) {
    html {
        scroll-behavior: smooth !important;
    }
}

/* Eliminar hover en dispositivos táctiles */
@media (hover: none) and (pointer: coarse) {
    .product-card:hover,
    .offer-card:hover,
    .category-tab:hover {
        transform: none !important;
        box-shadow: none !important;
    }
}