/**
 * Estilos Responsivos para Móvil - Moranda Systems
 * Optimizado para dispositivos móviles y tablets
 */

/* ============================================
   OVERLAY PARA FILTROS MÓVIL
   ============================================ */

.filters-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.filters-overlay.active {
    display: block;
    opacity: 1;
}

/* ============================================
   MEDIA QUERIES - TABLET Y MÓVIL
   ============================================ */

/* Tablet - 768px a 1024px */
@media (max-width: 1024px) {
    .container {
        padding: 0 20px;
    }
    
    .product-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 15px;
    }
}

/* Móvil Grande - 481px a 767px */
@media (max-width: 767px) {
    /* Header */
    header {
        padding: 10px 15px !important;
    }
    
    .logo img {
        max-height: 35px !important;
    }
    
    .nav-links {
        display: none !important;
    }
    
    .mobile-menu-btn {
        display: block !important;
        font-size: 24px;
        background: none;
        border: none;
        cursor: pointer;
        color: var(--text-dark);
    }
    
    /* Mobile Menu */
    .mobile-menu {
        display: none;
        position: fixed;
        top: 60px;
        left: 0;
        right: 0;
        background: white;
        box-shadow: 0 4px 6px rgba(0,0,0,0.1);
        z-index: 1000;
        max-height: calc(100vh - 60px);
        overflow-y: auto;
    }
    
    .mobile-menu.active {
        display: block;
    }
    
    .mobile-menu a {
        display: block;
        padding: 15px 20px;
        border-bottom: 1px solid #eee;
        color: var(--text-dark);
        text-decoration: none;
    }
    
    /* Product Grid */
    .product-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px !important;
    }
    
    .product-card {
        padding: 10px !important;
    }
    
    .product-card img {
        height: 150px !important;
    }
    
    .product-card h3 {
        font-size: 13px !important;
        line-height: 1.3 !important;
        height: 35px !important;
    }
    
    .product-card .price {
        font-size: 16px !important;
    }
    
    /* Filtros */
    .filters-section {
        position: fixed;
        top: 0;
        left: -100%;
        width: 280px;
        height: 100vh;
        background: white;
        z-index: 2000;
        transition: left 0.3s;
        overflow-y: auto;
        box-shadow: 2px 0 10px rgba(0,0,0,0.1);
    }
    
    .filters-section.active {
        left: 0;
    }
    
    .mobile-filter-btn {
        display: block !important;
        width: 100%;
        padding: 12px;
        background: var(--primary-blue);
        color: white;
        border: none;
        border-radius: 5px;
        font-size: 16px;
        margin-bottom: 15px;
        cursor: pointer;
    }
    
    .filter-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0,0,0,0.5);
        z-index: 1999;
    }
    
    .filter-overlay.active {
        display: block;
    }
    
    /* Carrito */
    .cart-page {
        padding: 15px !important;
    }
    
    .cart-items {
        overflow-x: auto;
    }
    
    .cart-item {
        flex-direction: column !important;
        align-items: flex-start !important;
        padding: 15px !important;
    }
    
    .cart-item img {
        width: 100% !important;
        max-width: 150px;
        margin-bottom: 10px;
    }
    
    .cart-item-details {
        width: 100% !important;
        margin-bottom: 10px;
    }
    
    .quantity-controls {
        width: 100% !important;
        justify-content: center;
        margin: 10px 0;
    }
    
    /* Checkout */
    .checkout-container {
        flex-direction: column !important;
    }
    
    .checkout-form,
    .order-summary {
        width: 100% !important;
        margin: 0 0 20px 0 !important;
    }
    
    .form-row {
        flex-direction: column !important;
    }
    
    .form-group {
        width: 100% !important;
    }
    
    /* Producto Detalle */
    .product-detail-container {
        flex-direction: column !important;
    }
    
    .product-images,
    .product-info {
        width: 100% !important;
    }
    
    .product-images img {
        max-height: 300px !important;
    }
    
    /* Modal Carrito */
    #cartModal .modal-content {
        width: 95% !important;
        max-width: 95% !important;
        margin: 5% auto !important;
        max-height: 90vh !important;
    }
    
    .cart-modal-item {
        flex-direction: column !important;
        align-items: flex-start !important;
    }
    
    .cart-modal-item img {
        width: 100% !important;
        max-width: 120px;
    }
    
    /* Tablas */
    table {
        font-size: 12px !important;
    }
    
    table th,
    table td {
        padding: 8px 5px !important;
    }
    
    /* Botones */
    .btn {
        padding: 10px 15px !important;
        font-size: 14px !important;
    }
    
    /* Footer */
    .footer-content {
        flex-direction: column !important;
        text-align: center !important;
    }
    
    .footer-section {
        margin-bottom: 30px;
        width: 100% !important;
    }
}

/* Móvil Pequeño - hasta 480px */
@media (max-width: 480px) {
    .product-grid {
        grid-template-columns: 1fr !important;
        gap: 15px !important;
    }
    
    .product-card {
        max-width: 100% !important;
    }
    
    .product-card img {
        height: 200px !important;
    }
    
    h1 {
        font-size: 24px !important;
    }
    
    h2 {
        font-size: 20px !important;
    }
    
    h3 {
        font-size: 16px !important;
    }
    
    .container {
        padding: 0 10px;
    }
    
    /* Espaciado general */
    section {
        padding: 30px 15px !important;
    }
}

/* ============================================
   UTILIDADES MÓVIL
   ============================================ */

.hide-mobile {
    display: block;
}

.show-mobile {
    display: none;
}

@media (max-width: 767px) {
    .hide-mobile {
        display: none !important;
    }
    
    .show-mobile {
        display: block !important;
    }
    
    .show-mobile-flex {
        display: flex !important;
    }
    
    .show-mobile-inline {
        display: inline !important;
    }
}

/* ============================================
   MEJORAS TÁCTILES
   ============================================ */

@media (max-width: 767px) {
    /* Áreas táctiles más grandes */
    button,
    a,
    input[type="button"],
    input[type="submit"] {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* Inputs más grandes */
    input[type="text"],
    input[type="email"],
    input[type="tel"],
    input[type="number"],
    select,
    textarea {
        font-size: 16px !important; /* Evita zoom en iOS */
        padding: 12px !important;
    }
    
    /* Scroll suave */
    html {
        scroll-behavior: smooth;
    }
    
    /* Evitar zoom en inputs */
    input,
    select,
    textarea {
        font-size: 16px;
    }
}

/* ============================================
   ORIENTACIÓN LANDSCAPE EN MÓVIL
   ============================================ */

@media (max-width: 767px) and (orientation: landscape) {
    .product-grid {
        grid-template-columns: repeat(3, 1fr) !important;
    }
    
    .product-card img {
        height: 120px !important;
    }
}
