/* mobile-optimizations.css - Optimizaciones para dispositivos móviles */

/* Utility: control visibility between mobile and desktop */
.mobile-only { display: none; }
.desktop-only { display: inline-block; }

@media (max-width: 768px) {
    /* Navbar móvil */
    .navbar {
        padding: 0.75rem 0;
    }
    
    .brand {
        font-size: 1.25rem;
    }
    
    .brand-icon {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }

    /* Reduce header clutter on mobile */
    .nav-actions {
        display: flex;
        align-items: center;
        gap: 8px;
    }
    /* Hide cart and login from header on narrow/mobile tablets to reduce saturation */
    .nav-actions .cart-icon,
    .nav-actions .login-link {
        display: none !important;
    }
    .nav-menu .mobile-only { display: list-item; }
    .nav-menu .desktop-only { display: none; }
    
    /* Hero responsive - Index */
    .hero {
        height: 70vh;
        min-height: 500px;
    }
    
    .hero-content {
        width: 95%;
        padding: 0 1rem;
    }
    
    .hero-title {
        font-size: 2rem;
        line-height: 1.2;
        margin-bottom: 1rem;
    }
    
    .hero-subtitle {
        font-size: 1rem;
        line-height: 1.5;
        margin-bottom: 1.5rem;
    }
    
    /* Hero responsive - Products */
    .products-hero {
        padding: 2rem 0 1.5rem;
        margin-bottom: 2rem;
    }
    
    .products-hero-compact {
        padding: 2.5rem 0 2rem;
        margin-bottom: 1.5rem;
        min-height: 280px;
    }
    
    .products-hero-compact .hero-bg {
        background-position: center 40%;
        background-size: cover;
        background-attachment: scroll;
        transform: scale(1);
    }
    
    .products-hero-compact::before {
        background: linear-gradient(to bottom, rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0.4));
    }
    
    .page-title {
        font-size: 1.75rem;
        line-height: 1.2;
        margin-bottom: 0.75rem;
    }
    
    .page-subtitle {
        font-size: 0.9rem;
        line-height: 1.4;
        margin-bottom: 1.5rem;
    }
    
    /* Sección y títulos */
    .section {
        padding: 2.5rem 0;
    }
    
    .section-title {
        font-size: 1.5rem;
    }
    
    .section-description {
        font-size: 0.9rem;
        padding: 0 1rem;
    }
    
    /* Carrusel */
    .carousel {
        padding: 0 30px;
    }
    
    .arrow {
        width: 36px;
        height: 36px;
        font-size: 16px;
    }
    
    .arrow.left {
        left: 5px;
    }
    
    .arrow.right {
        right: 5px;
    }
    
    /* Categorías */
    .cat.card {
        flex: 0 0 280px;
        min-width: 280px;
        min-height: 260px;
        padding: 24px 18px;
    }
    
    .circle {
        width: 140px;
        height: 140px;
        margin-bottom: 14px;
    }
    
    .circle i {
        font-size: 3.5rem;
    }
    
    .cat-name {
        font-size: 1.125rem;
    }
    
    /* Products Grid - Tablet (2 columnas) */
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
    
    .product-card {
        width: 100%;
    }
    
    .product-image {
        height: 200px;
        background: white;
    }
    
    .product-image img {
        object-fit: contain;
        object-position: center;
    }
    
    .product-info {
        padding: 1rem;
    }
    
    .product-name {
        font-size: 0.92rem;
        line-height: 1.28;
        display: -webkit-box;
        -webkit-line-clamp: 3;
        -webkit-box-orient: vertical;
        overflow: hidden;
        min-height: 3.6em; /* Reservar espacio para hasta 3 líneas */
        margin-bottom: 0.25rem;
    }
    
    .product-category {
        font-size: 0.75rem;
    }
    
    .product-price {
        font-size: 1.4rem;
    }
    
    .product-actions {
        padding: 0 1rem 1rem;
    }
    
    .btn-add-cart {
        font-size: 0.9rem;
        padding: 0.75rem;
    }
        margin-bottom: 16px;
    }
    
    .circle i {
        font-size: 3.5rem;
    }
    
    .cat-name {
        font-size: 1.1rem;
    }
    
    /* Grid de about */
    .grid-2 {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    /* Filtros apilados en móvil */
    .filters-section {
        padding: 1.5rem;
    }
    
    .filters-container {
        gap: 1rem;
    }
    
    /* Grid responsive */
    #productsGrid {
        gap: 1rem;
    }
    
    /* Tarjetas más compactas en móvil */
    .product-image {
        height: 200px;
        background: white;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .product-image img {
        object-fit: contain !important;
        object-position: center !important;
        width: 100%;
        height: 100%;
    }
    
    .product-thumb {
        background: white !important;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .product-thumb img {
        object-fit: contain !important;
        object-position: center !important;
    }
    
    .product-info {
        padding: 1rem;
        gap: 0.5rem;
    }
    
    .product-name {
        font-size: 0.98rem;
        line-height: 1.28;
        display: -webkit-box;
        -webkit-line-clamp: 3;
        -webkit-box-orient: vertical;
        overflow: hidden;
        max-height: 3.84em;
    }
    
    .product-price {
        font-size: 1.5rem;
    }
    
    .product-actions {
        padding: 0 1rem 1rem;
    }
    
    /* Footer compacto */
    .footer {
        padding: 2rem 0 1rem;
        margin-top: 2rem;
    }
}

/* Pantallas pequeñas (móviles) */
@media (max-width: 480px) {
    /* On very small screens, hide header cart/login and expose mobile menu entries */
    .nav-actions .cart-icon,
    .nav-actions .login-link {
        display: none !important;
    }
    .nav-menu .mobile-only {
        display: list-item !important;
    }
    .nav-menu .desktop-only {
        display: none !important;
    }

    /* Slightly smaller brand on tiny screens */
    .brand { font-size: 1.1rem; }

    /* Hero más compacto - Index */
    .hero {
        height: 65vh;
        min-height: 450px;
    }
    
    .hero-title {
        font-size: 1.75rem;
        line-height: 1.15;
    }
    
    .hero-subtitle {
        font-size: 0.9rem;
        line-height: 1.4;
    }
    
    /* Hero más compacto - Products */
    .products-hero-compact {
        padding: 2rem 0 1.5rem;
        min-height: 240px;
    }
    
    .products-hero-compact .hero-bg {
        background-position: center 35%;
        background-size: cover;
    }
    
    .products-hero-compact::before {
        background: linear-gradient(to bottom, rgba(0, 0, 0, 0.65), rgba(0, 0, 0, 0.45));
    }
    
    .page-title {
        font-size: 1.5rem;
        line-height: 1.15;
        margin-bottom: 0.5rem;
    }
    
    .page-subtitle {
        font-size: 0.85rem;
        line-height: 1.35;
        margin-bottom: 1.25rem;
    }
    
    .hero-content {
        padding: 0 12px;
    }
    
    /* Container más estrecho en tablet */
    .container {
        padding: 0 1rem;
    }
    
    /* Secciones más compactas */
    .section {
        padding: 2.5rem 0;
    }
    
    .section-title {
        font-size: 1.3rem;
    }
    
    .section-description {
        font-size: 0.85rem;
    }
    
    /* Carrusel más estrecho */
    .carousel {
        padding: 0 25px;
    }
    
    .arrow {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }
    
    /* Categorías más pequeñas */
    .cat.card {
        flex: 0 0 240px;
        min-width: 240px;
        min-height: 230px;
        padding: 20px 16px;
    }
    
    .circle {
        width: 120px;
        height: 120px;
        margin-bottom: 12px;
    }
    
    .circle i {
        font-size: 3rem;
    }
    
    .cat-name {
        font-size: 1rem;
    }
    
    /* Container más estrecho */
    .container {
        padding: 0 0.25rem;
    }
    
    /* Grid sections sin padding extra */
    .products-grid-section .container,
    .products-grouped-section .container,
    .category-tabs-section .container {
        padding: 0 0.25rem;
    }
    
    /* Productos - Grid mejorado para móvil */
    .products-grid {
        display: grid;
        grid-template-columns: 1fr;
        gap: 0.75rem;
        padding: 0;
    }
    
    .product-card {
        width: 100%;
        max-width: 100%;
        min-width: auto;
        margin: 0 auto;
    }
    
    .product-image {
        height: 240px;
        background: white;
    }
    
    .product-image img {
        object-fit: contain;
        object-position: center;
    }
    
    .product-info {
        padding: 0.75rem;
    }

}

/* Ensure desktop (>=769px) header buttons are brand-colored — override any remaining defaults */
@media (min-width: 769px) {
    .nav-actions .cart-icon {
        background: var(--brand-primary) !important;
        color: #ffffff !important;
        border-color: transparent !important;
        box-shadow: 0 6px 18px rgba(255,107,53,0.12) !important;
    }

    .nav-actions .cart-icon i,
    .nav-actions .cart-icon span:not(.cart-count) {
        color: #ffffff !important;
    }

    .nav-actions .login-link {
        background: var(--brand-primary) !important;
        color: #ffffff !important;
        border-radius: 12px !important;
        padding: 0.5rem 0.85rem !important;
    }

    .nav-actions .cart-count {
        background: #ffffff !important;
        color: var(--brand-primary) !important;
    }
}
    
    .product-name {
        font-size: 0.98rem;
        line-height: 1.22;
        -webkit-line-clamp: 3;
        display: -webkit-box;
        -webkit-box-orient: vertical;
        overflow: hidden;
        max-height: 3.66em;
        margin-bottom: 0.35rem;
    }
    
    .product-price {
        font-size: 1.5rem;
        margin: 0.75rem 0;
    }
    
    .product-actions {
        padding: 0 0.75rem 0.75rem;
    }
    
    .btn-add-cart {
        width: 100%;
        padding: 0.75rem;
        font-size: 0.95rem;
    }
}

/* Optimizaciones táctiles */
@media (hover: none) and (pointer: coarse) {
    .btn,
    .nav-link,
    .filter-input,
    .filter-select {
        min-height: 44px;
        font-size: 16px; /* Previene zoom en iOS */
    }
    
    .product-card:hover {
        transform: none;
    }
    
    .product-card:active {
        transform: scale(0.98);
    }
}

/* Modo landscape en móvil */
@media (max-width: 768px) and (orientation: landscape) {
    .products-hero {
        padding: 1.5rem 0;
    }
    
    .products-hero h1 {
        font-size: 1.75rem;
    }
    
    .product-image {
        height: 180px;
    }
}
