/* ========== RESPONSIVE DESIGN ========== */

/* Desktop Grande (1600px+) */
@media (min-width: 1600px) {
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    }
}

/* Desktop Estándar (1199px - 1599px) */
@media (max-width: 1199px) {
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    }
    
    .product-image-container {
        height: 200px;
    }
}

/* Tablets Grandes (992px - 1199px) */
@media (max-width: 992px) {
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
        gap: 1.25rem;
    }
    
    .product-info {
        padding: 1rem;
    }
    
    .product-info h3 {
        font-size: 0.95rem;
    }
    
    .current-price {
        font-size: 1.15rem;
    }
}

/* Tablets (769px - 991px) */
@media (min-width: 769px) {
    .header {
        display: block;
    }
    
    .header-top {
        display: flex;
        justify-content: flex-start;
        align-items: center;
        padding: 1rem 2rem;
        position: relative;
        gap: 0;
    }
    
    .menu-toggle {
        display: none;
    }
    
    .logo {
        margin-right: 1.5rem;
        text-align: left;
        flex-grow: 0;
    }
    
    .search-container {
        flex: 1;
        margin: 0 1rem;
        padding: 0;
        background: transparent;
        order: 0;
        max-width: 500px;
    }

    /* Panel de ubicación en desktop */
    .location-panel {
        display: flex;
        align-items: center;
        justify-content: flex-end;
        gap: 0.5rem;
        padding: 0.3rem 1rem 0.3rem 1.2rem;
        border: none;
        border-left: 2px solid var(--color-principal-pastel);
        width: auto;
        order: 0;
        margin-left: auto;
    }

    .location-label {
        font-size: 0.6rem;
    }

    .location-city {
        font-size: 0.85rem;
    }

    .location-icon {
        font-size: 1rem;
    }
    
    .cart-btn {
        margin-left: 1rem;
        flex-shrink: 0;
    }
    
    .categories-nav {
        display: block;
    }
    
    .categories-list {
        justify-content: center;
        padding: 5px 0;
    }
}

/* Tablets Medianas (768px) */
@media (max-width: 768px) {
    .header {
        display: flex;
        flex-direction: column;
    }
    
    .header-top {
        order: 1;
        padding: 1rem;
        position: static;
        flex-wrap: wrap;
    }

    .location-panel {
        margin-top: 0.5rem;
        margin-bottom: -10px;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0.5rem;
        padding: 0.6rem 1rem;
        border: none;
        border-top: 1px solid var(--gris-claro);
        border-bottom: 2px solid var(--color-principal-pastel);
        width: 100%;
        height: 40px;
        margin-left: 0;
        order: 5;
    }

    .location-label {
        font-size: 0.7rem;
    }

    .location-city {
        font-size: 0.95rem;
    }

    .location-icon {
        font-size: 1.2rem;
    }
    
    .menu-toggle {
        display: flex;
        order: 1;
    }
    
    .logo {
        order: 2;
        margin-bottom: 10px;
        font-size: 1.6rem;
    }

    .product-card {
        --card-padding: 0.6rem;
        --image-height: 140px;
        --badge-size: 0.6rem;
        --title-font: 0.85rem;
        --price-font: 1rem;
        --btn-font: 0.8rem;
    }
    
    .cart-btn {
        order: 3;
    }
    
    .search-container {
        order: 4;
        padding: 0 1rem;
    }
    
    .categories-nav {
        display: none;
    }
    
    .sidebar {
        width: 300px;
        left: -300px;
    }
    
    .sidebar.active {
        transform: translateX(300px);
    }
    
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 1rem;
    }

    .product-badges {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 0.3rem;
    }

    .badge {
        padding: 0.2rem 0.4rem;
    }
    
    .product-image-container {
        height: 140px;
    }
    
    .product-info {
        padding: 0.5rem;
    }
    
    .product-info h3 {
        font-size: 0.85rem;
    }
    
    .current-price {
        font-size: 1rem;
    }
    
    .quantity-btn {
        width: 26px;
        height: 26px;
    }

    .add-to-cart {
        padding: 0.6rem;
    }

    .product-detail {
        padding: 1.2rem;
    }
    
    .detail-info h2 {
        font-size: 1.8rem;
    }
    
    .form-row {
        flex-direction: column;
        gap: 0;
    }
    
    .payment-container {
        width: 95%;
    }

    .security-notice {
        flex-direction: column;
        gap: 0.75rem;
    }

    .security-notice-icon {
        min-width: auto;
        font-size: 1.75rem;
        padding-top: 0;
    }

    .security-notice-text {
        text-align: left;
        font-size: 0.9rem;
    }

    .security-features {
        flex-direction: column;
        gap: 0.75rem;
    }

    .security-feature {
        width: 100%;
        justify-content: flex-start;
    }
    
    .cart-sidebar {
        max-width: 90%;
    }

    .detail-container {
        grid-template-areas: 
            "gallery"
            "info"
            "back-btn"
            "suggested";
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .back-btn-container {
        justify-content: center;
    }

    .main-image-container {
        height: 300px;
        padding: 1rem;
    }
    
    .detail-title {
        font-size: 1.5rem;
    }
    
    .price-current {
        font-size: 1.5rem;
    }
    
    .add-to-cart-btn {
        max-width: 100%;
    }

    .section-title::before,
    .section-title::after {
        width: 30px;
    }
    
    .section-title::before {
        left: -40px;
    }
    
    .section-title::after {
        right: -40px;
    }
    
    .suggested-item {
        flex: 0 0 calc(50% - 10px);
        min-width: 180px;
    }

    .carousel-nav {
        width: 35px;
        height: 35px;
    }
    
    .suggested-image {
        height: 150px;
    }

    .no-results-container {
        padding: 2rem 1rem;
    }
    
    .no-results-content {
        padding: 2rem 1.5rem;
    }
    
    .no-results-icon {
        font-size: 2.5rem;
    }
    
    .no-results-title {
        font-size: 1.5rem;
    }

    .whatsapp-float {
        width: 50px;
        height: 50px;
        bottom: 20px;
        right: 20px;
    }
    
    .whatsapp-icon {
        width: 30px;
        height: 30px;
    }
    
    .whatsapp-tooltip {
        display: none;
    }
}

/* Tablets Pequeñas (577px - 767px) */
@media (max-width: 767px) {
    /* Carrusel responsive */
    .carousel-container {
        height: 320px;
        margin-bottom: 1.5rem;
    }

    .carousel-title {
        font-size: 1.6rem;
    }

    .carousel-subtitle {
        font-size: 1.3rem;
    }

    .carousel-text-overlay {
        padding: 2rem;
    }

    .carousel-btn {
        width: 40px;
        height: 40px;
        font-size: 0.9rem;
    }

    .carousel-btn-prev {
        left: 10px;
    }

    .carousel-btn-next {
        right: 10px;
    }

    .carousel-indicators {
        bottom: 40%;
        gap: 6px;
    }

    .carousel-indicator {
        width: 8px;
        height: 8px;
    }

    .carousel-indicator.active {
        width: 24px;
    }
}

/* Smartphones (481px - 576px) */
@media (max-width: 576px) {
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 0.75rem;
    }
    
    .product-image-container {
        height: 150px;
    }
    
    .product-info {
        padding: 0.75rem;
    }
    
    .product-info h3 {
        font-size: 0.85rem;
    }
    
    .current-price {
        font-size: 1rem;
    }
    
    .add-to-cart {
        padding: 0.5rem;
        font-size: 0.8rem;
    }
    
    .badge {
        padding: 0.25rem 0.5rem;
        font-size: 0.65rem;
    }
    
    .payment-actions {
        flex-direction: column;
    }
    
    .submit-btn, .cancel-btn {
        width: 100%;
    }
    
    .order-summary th, 
    .order-summary td {
        padding: 0.5rem;
        font-size: 0.85rem;
    }
    
    .order-summary th i {
        display: none;
    }
    
    .cart-item {
        padding: 0.75rem 0;
    }
    
    .cart-item img {
        width: 90px;
        height: 90px;
    }
    
    .cart-item-info {
        font-size: 0.85rem;
    }
    
    .sidebar {
        width: 85%;
        left: -85%;
    }
    
    .sidebar.active {
        transform: translateX(95%);
    }

    .no-results-content {
        padding: 1.75rem 1.25rem;
    }
    
    .no-results-icon {
        font-size: 2.2rem;
    }
    
    .no-results-title {
        font-size: 1.3rem;
    }
    
    .clear-search-btn {
        width: 100%;
        justify-content: center;
    }
}

/* Smartphones Pequeños (400px - 480px) */
@media (max-width: 480px) {
    .products-grid {
        grid-template-columns: 1fr 1fr;
    }
    
    .product-image-container {
        height: 140px;
    }
    
    .product-info h3 {
        font-size: 0.8rem;
    }
    
    .cart-sidebar {
        max-width: 100%;
    }

    /* Carrusel responsive mobile */
    .carousel-container {
        height: 235px;
        margin-bottom: 1rem;
    }

    .carousel-title {
        font-size: 1.8rem;
        text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    }

    .carousel-subtitle {
        font-size: 1rem;
        text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.5);
    }

    .carousel-text-overlay {
        padding: 2rem;
    }

    .carousel-btn {
        width: 35px;
        height: 35px;
        font-size: 0.8rem;
    }

    .carousel-btn-prev {
        left: 8px;
    }

    .carousel-btn-next {
        right: 8px;
    }

    .carousel-indicators {
        bottom: 40%;
        gap: 4px;
    }

    .carousel-indicator {
        width: 6px;
        height: 6px;
    }

    .carousel-indicator.active {
        width: 20px;
    }
}

/* Ultra pequeños (menos de 400px) */
@media (max-width: 400px) {
    .products-grid {
        grid-template-columns: 1fr 1fr;
    }
    
    .product-image-container {
        height: 140px;
    }
    
    .product-info h3 {
        font-size: 0.8rem;
    }
    
    .cart-sidebar {
        max-width: 100%;
    }

    /* Responsive para formulario de pago */
    .payment-container {
        width: 95%;
        max-width: 100%;
        max-height: 95vh;
        padding: 0 1rem;
    }

    .form-row {
        flex-direction: column;
        gap: 0;
    }

    .form-group {
        width: 100%;
        margin-bottom: 1rem;
    }

    .payment-header {
        padding: 1rem;
    }

    .payment-header h2 {
        font-size: 1.1rem;
    }

    #payment-form {
        padding: 1rem;
    }

    .security-notice {
        flex-direction: column;
    }

    .security-notice-icon {
        min-width: auto;
        margin-bottom: 0.5rem;
    }

    .delivery-message {
        padding: 1rem;
        margin: 1.5rem 0;
    }

    .delivery-info-item {
        gap: 0.75rem;
    }

    .delivery-info-item i {
        font-size: 1.1rem;
    }
}