
@media (max-width: 767px) {

    .container {
        padding: 0 12px;
    }
    
    body {
        font-size: 14px;
        line-height: 1.5;
    }
    
    /* Header */
    .header {
        padding: 0.5rem 0;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        background: linear-gradient(135deg, #801C39 0%, #801C39 100%);
        box-shadow: 0 2px 15px rgba(0, 0, 0, 0.2);
        z-index: 1000;
    }

    .main { 
        padding-top: 70px !important; 
    }

    .header-content {
        flex-wrap: nowrap;
        gap: 0.75rem;
    }
    
    .logo {
        flex-shrink: 0;
    }
    
    .logo-img {
        width: 32px;
        height: 32px;
    }
    
    .logo-text {
        font-size: 0.9rem;
        display: none;
    }
    
    /* Boton volver */
    .back-to-catalog {
        display: none; 
    }
    
    /* Barra busqueda */
    .search-bar {
        flex: 1;
        max-width: none;
    }
    
    .search-input {
        padding: 0.6rem 1rem;
        font-size: 16px;
        border-radius: 20px;
    }
    
    .search-btn {
        width: 32px;
        height: 32px;
        right: 3px;
    }
    
    .search-icon {
        width: 14px;
        height: 14px;
    }
    
    /* Botoncito del menu*/
    .mobile-menu-btn {
        display: flex;
        flex-direction: column;
        gap: 3px;
        background: none;
        border: none;
        padding: 0.5rem;
        cursor: pointer;
        flex-shrink: 0;
    }
    
    .mobile-menu-btn span {
        width: 20px;
        height: 2px;
        background: white;
        transition: all 0.3s ease;
    }
    
    .mobile-menu-btn.active span:nth-child(1) {
        transform: rotate(45deg) translate(6px, 6px);
    }
    
    .mobile-menu-btn.active span:nth-child(2) {
        opacity: 0;
    }
    
    .mobile-menu-btn.active span:nth-child(3) {
        transform: rotate(-45deg) translate(6px, -6px);
    }
    
    /* Menu */
    .mobile-menu {
        position: fixed;
        top: 0;
        left: -100%;
        width: 85%;
        height: 100vh;
        background: white;
        z-index: 2000;
        transition: left 0.3s ease;
        box-shadow: 2px 0 15px rgba(0, 0, 0, 0.2);
    }
    
    .mobile-menu.active {
        left: 0;
    }
    
    .mobile-menu-content {
        padding: 4rem 1.5rem 2rem;
        height: 100%;
        position: relative;
    }
    
    .close-mobile-menu {
        position: absolute;
        top: 1rem;
        right: 1rem;
        font-size: 1.5rem;
        background: none;
        border: none;
        cursor: pointer;
        color: #2C5530;
        width: 40px;
        height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .mobile-nav {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .mobile-nav-link {
        padding: 1rem;
        background: #f8f9fa;
        border-radius: 8px;
        text-decoration: none;
        color: #801C39;
        font-weight: 500;
        transition: all 0.3s ease;
        text-align: center;
    }
    
    .mobile-nav-link:hover {
        background: #801C39;
        color: white;
    }
    
    /* Overlay Menu */
    .mobile-menu-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1999;
        display: none;
    }
    
    .mobile-menu-overlay.active {
        display: block;
    }
    
    /* Categorias */
    .categories-nav {
        position: fixed;
        top: 56px;
        left: 0;
        right: 0;
        background: white;
        z-index: 999;
        padding: 0.5rem 0;
        border-bottom: 1px solid #e9ecef;
    }
    
    .categories-list {
        gap: 0.5rem;
        padding: 0 12px;
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    
    .categories-list::-webkit-scrollbar {
        display: none;
    }
    
    .category-btn {
        padding: 0.6rem 1rem;
        font-size: 0.85rem;
        white-space: nowrap;
        flex-shrink: 0;
        min-height: 44px;
    }
    
    /* Contenido principal */
    .main {
        min-height: calc(100vh - 120px);
        padding: 6rem 0 2rem;
    }
    
    /* Productos */
    .products-section {
        width: 100%;
    }
    
    .products-header {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
        margin-bottom: 1.5rem;
    }
    
    .section-title {
        font-size: 1.5rem;
        text-align: center;
    }
    
    .products-info {
        justify-content: space-between;
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .products-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .product-card {
        border-radius: 8px;
        margin: 0;
    }
    
    .product-image {
        height: 200px;
        padding: 0.75rem;
    }
    
    .product-info {
        padding: 1rem;
    }
    
    .product-name {
        font-size: 1.1rem;
    }
    
    /* Paginacion */
    .pagination {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .page-numbers {
        order: 3;
        flex: 1 1 100%;
        justify-content: center;
        margin-top: 0.5rem;
    }
    
    .pagination-btn {
        padding: 0.75rem 1rem;
        min-height: 44px;
    }
    
    .page-number {
        padding: 0.75rem;
        min-width: 44px;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    /* ficha tecnica */
    .product-detail {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        margin: 1rem 0;
    }
    
    .product-main-img {
        height: 250px;
    }
    
    .thumbnail {
        width: 60px;
        height: 60px;
    }
    
    .product-info {
        padding: 1rem;
    }
    
    .product-title {
        font-size: 1.5rem;
    }
    
    .product-actions {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .specs-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .related-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .related-product-card {
        padding: 1rem;
    }
    
    .related-product-img {
        width: 100px;
        height: 100px;
    }
    
    /* BREADCRUMB */
    .breadcrumb {
        padding: 0.75rem 0;
        margin-top: 56px;
    }
    
    .breadcrumb-list {
        font-size: 0.8rem;
        flex-wrap: wrap;
        gap: 0.25rem;
    }
    
    /* Footer */
    .footer {
        padding: 1.5rem 0 1rem;
        margin-top: 2rem;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        text-align: center;
    }
    
    .footer-section h4 {
        font-size: 1rem;
    }
}

/* movil (320px - 480px) */
@media (max-width: 480px) {
    .container {
        padding: 0 10px;
    }
    
    .logo-text {
        display: none;
    }
    
    .search-input {
        font-size: 14px;
        padding: 0.5rem 0.75rem;
    }
    
    .categories-list {
        gap: 0.25rem;
    }
    
    .category-btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.8rem;
    }
    
    .product-image {
        height: 180px;
    }
    
    .section-title {
        font-size: 1.3rem;
    }
    
    .mobile-menu {
        width: 90%;
    }
    
    /* ficha tecnica 2 */
    .product-info {
        padding: 0.75rem;
    }
    
    .product-title {
        font-size: 1.3rem;
    }
    
    .product-main-img {
        height: 220px;
    }
    
    .thumbnail {
        width: 50px;
        height: 50px;
    }
    
    .technical-specs {
        padding: 1rem;
        margin: 1.5rem 0;
    }
    
    .spec-detail-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
        padding: 0.5rem 0;
    }
    
    .spec-detail-value {
        text-align: left;
    }
    
    .related-product-img {
        width: 80px;
        height: 80px;
    }
}

/* Orientazion H */
@media (max-width: 767px) and (orientation: landscape) {
    .header {
        position: relative;
    }
    
    .categories-nav {
        position: relative;
        top: 0;
    }
    
    .main {
        padding: 1rem 0;
        min-height: auto;
    }
    
    .mobile-menu {
        height: 100vh;
        overflow-y: auto;
    }
    
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* F.T LANDSCAPE */
    .product-detail {
        grid-template-columns: 1fr 1fr;
        gap: 1rem;
    }
    
    .product-main-img {
        height: 200px;
    }
    
    .product-info {
        padding: 1rem;
    }
}

/* Alto contraste y accesibilidad */
@media (max-width: 767px) {
    @media (prefers-contrast: high) {
        .header {
            background: #000;
        }
        
        .product-card {
            border: 2px solid #000;
        }
        
        .btn-primary {
            background: #000;
            border: 2px solid #000;
        }
        
        .category-btn.active {
            background: #000;
            border-color: #000;
        }
    }
    
    @media (prefers-reduced-motion: reduce) {
        * {
            animation-duration: 0.01ms !important;
            animation-iteration-count: 1 !important;
            transition-duration: 0.01ms !important;
        }
        
        .mobile-menu {
            transition: none;
        }
        
        .product-card:hover,
        .related-product-card:hover {
            transform: none;
        }
    }
}

/* Soporte notch y safari iOS */
@supports (padding: max(0px)) {
    @media (max-width: 767px) {
        .header {
            padding-top: max(0.5rem, env(safe-area-inset-top));
            padding-left: max(12px, env(safe-area-inset-left));
            padding-right: max(12px, env(safe-area-inset-right));
        }
        
        .main {
            padding-left: env(safe-area-inset-left);
            padding-right: env(safe-area-inset-right);
            padding-bottom: env(safe-area-inset-bottom);
        }
        
        .mobile-menu {
            padding-top: env(safe-area-inset-top);
            padding-left: env(safe-area-inset-left);
            padding-right: env(safe-area-inset-right);
            padding-bottom: env(safe-area-inset-bottom);
        }
    }
}

/* mejoras perfomance */
@media (max-width: 767px) {
    .product-card:hover,
    .related-product-card:hover {
        transform: none;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    }
    
    .search-suggestions {
        max-height: 200px;
    }
    
    /* Optimizar para conexiones lentas */
    .product-image,
    .product-main-img,
    .related-product-img {
        loading: lazy;
    }
    
    /* Reducir efectos visuales pesados */
    .spec-item:hover,
    .thumbnail:hover {
        transform: none;
    }
}

/* botoncito de volver */
@media (max-width: 767px) {
    .mobile-back-button {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        padding: 0.5rem 1rem;
        background: #801C39;
        color: white;
        text-decoration: none;
        border-radius: 8px;
        font-weight: 500;
        margin: 1rem auto;
        max-width: 200px;
        justify-content: center;
    }
    
    /* Mostrar botón volver en celular cuando se oculta el del header */
    .back-to-catalog.mobile-only {
        display: flex !important;
    }
}

/* 🔹 Mejoras de tipografia */
@media (max-width: 767px) {
    .product-specs small {
        font-size: 0.8rem;
    }
    
    .spec-label,
    .spec-detail-label {
        font-size: 0.85rem;
    }
    
    .spec-value,
    .spec-detail-value {
        font-size: 0.85rem;
    }
}

@media (max-width: 767px) {
    .search-input:focus {
        font-size: 16px; /* Previene zoom en iOS */
    }
    
    .category-btn:active,
    .pagination-btn:active,
    .view-btn:active {
        transform: scale(0.98);
    }
}

/* Oculto por defecto (PC) */
#mobileMenu,
#mobileNav,
.mobile-menu,
.mobile-nav {
  display: none !important;
}

/* Solo en móvil se permite mostrarlo */
@media (max-width: 768px) {
  #mobileMenu,
  #mobileNav,
  .mobile-menu,
  .mobile-nav {
    display: block !important;
  }
}
