/*
  ============================================
  Estilos Generales y Mobile First (para todos los dispositivos)
  ============================================
  Autor: Gemini
  Descripción: Hoja de estilos unificada con enfoque mobile-first para Import MDZ.
*/

/* --- Reseteos y Estilos Base --- */
body {
    background-color: #f8f9fa;
    color: #212529;
    font-family: 'Inter', sans-serif;
}

main > .container {
    padding: 20px 15px;
}

.section-title {
    font-size: 2rem;
    margin-bottom: 1.5rem;
    font-weight: 700;
    text-align: center;
}

/* --- Header --- */
.navbar-brand strong {
    font-size: 1.25rem;
}

/* --- Footer --- */
.footer {
    font-size: 0.9rem;
}
.footer .list-unstyled a {
    text-decoration: none;
    transition: color 0.2s;
}
.footer .list-unstyled a:hover {
    color: #fff !important;
}

/* --- Componentes Reutilizables --- */

/* Tarjeta de Producto */
.product-card {
    border: 1px solid #e9ecef;
    border-radius: 0.75rem;
    transition: transform 0.2s, box-shadow 0.2s;
    overflow: hidden;
    background-color: #fff;
    display: flex;
    flex-direction: column;
    height: 100%;
}
.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.1);
}
.product-card .card-img-top {
    aspect-ratio: 1 / 1;
    object-fit: cover;
}
.product-card .card-body {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    padding: 1rem;
}
.product-card .card-title {
    font-size: 1rem;
    font-weight: 600;
    flex-grow: 1; 
}
.product-card .card-title a {
    text-decoration: none;
    color: #212529;
}
.product-card .card-title a:hover {
    color: #0d6efd;
}
.product-card .card-text {
    font-size: 1.1rem;
}
.product-card .btn {
    width: 100%;
}

/* Etiquetas de descuento y novedades */
.discount-badge, .last-units-badge {
    position: absolute;
    padding: 0.3em 0.6em;
    font-size: 0.8em;
    border-radius: 0.25rem;
    font-weight: bold;
    z-index: 2;
}
.discount-badge {
    top: 10px;
    right: 10px;
    background-color: #ffc107;
    color: #000;
}
.last-units-badge {
    top: 10px;
    left: 10px;
    background-color: #dc3545; /* Rojo para urgencia */
    color: #fff;
    animation: pulse 2s infinite;
}

/* Animación para la etiqueta */
@keyframes pulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.7);
    }
    70% {
        transform: scale(1.05);
        box-shadow: 0 0 0 10px rgba(220, 53, 69, 0);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(220, 53, 69, 0);
    }
}


/*
  ============================================
  Página de Inicio (inicio.php)
  ============================================
*/
.main-carousel .carousel-item {
    height: 60vh;
    min-height: 350px;
    background-size: cover;
    background-position: center;
}
/* INICIO: CAMBIO EN TEXTO DEL CARRUSEL */
.main-carousel .carousel-caption {
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0.1) 80%, rgba(0, 0, 0, 0) 100%);
    bottom: 0;
    top: auto;
    left: 0;
    right: 0;
    padding-bottom: 2rem;
    text-align: center;
}
/* FIN: CAMBIO EN TEXTO DEL CARRUSEL */
.main-carousel .carousel-caption h1 {
    font-size: 2rem;
    font-weight: 700;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.5);
}
.main-carousel .carousel-caption .lead {
    font-size: 1rem;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}
.value-props .prop-item i {
    font-size: 2rem;
    color: #0d6efd;
}
.countdown-timer {
    font-size: 1rem;
}
.countdown-timer .timer-box span {
    font-size: 1.5rem;
}
.whatsapp-float {
    position: fixed;
    width: 50px;
    height: 50px;
    bottom: 20px;
    right: 20px;
    font-size: 24px;
    background-color: #25d366;
    color: #FFF;
    border-radius: 50px;
    text-align: center;
    box-shadow: 2px 2px 3px #999;
    z-index: 100;
    transition: transform 0.2s;
}
.whatsapp-float:hover {
    transform: scale(1.1);
}

/*
  ============================================
  Página de Catálogo (index.php)
  ============================================
*/
.filters-container .card {
    background-color: transparent;
    border: none;
    box-shadow: none !important;
    padding: 0 !important;
}
.sort-bar {
    display: flex;
    flex-direction: column;
    align-items: flex-start !important;
    gap: 0.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #dee2e6;
    margin-bottom: 1rem !important;
}
.sort-bar .form-label {
    margin: 0 !important;
}
.sort-bar form {
    width: 100%;
}
.sort-bar select {
    width: 100%;
}
.category-list .nav-link {
    color: #333;
    font-weight: 500;
    padding: 0.5rem 0;
}
.category-list .nav-link.active {
    color: #0d6efd;
    font-weight: bold;
}
.category-list .nav-link:hover {
    color: #0d6efd;
}
.category-list .nav-link .bi-chevron-down {
    transition: transform 0.2s;
}
.category-list .nav-link[aria-expanded="true"] .bi-chevron-down {
    transform: rotate(180deg);
}
.subcategory-list {
    padding-left: 1.5rem;
}
.subcategory-list .nav-link {
    font-size: 0.9em;
    font-weight: normal;
}
.category-list-container {
    max-height: 300px;
    overflow-y: auto;
}

/*
  ============================================
  Página de Detalles (details.php)
  ============================================
*/
.main-image {
    width: 100%;
    height: auto;
    max-height: 400px;
    object-fit: contain;
    border-radius: .5rem;
    border: 1px solid #dee2e6;
}
.thumbnail-gallery {
    display: flex;
    gap: 10px;
    margin-top: 10px;
    overflow-x: auto;
    padding-bottom: 10px;
}
.thumbnail-gallery img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    cursor: pointer;
    border-radius: .25rem;
    border: 2px solid transparent;
    transition: border-color 0.2s;
    flex-shrink: 0;
}
.thumbnail-gallery img:hover, .thumbnail-gallery img.active {
    border-color: #0d6efd;
}
.price-section .original-price {
    font-size: 1.1rem;
    color: #6c757d;
    text-decoration: line-through;
}
.price-section .final-price {
    font-size: 2rem;
    font-weight: bold;
    color: #198754;
}
.price-section .discount-tag {
    font-size: 0.9rem;
    font-weight: bold;
    color: #dc3545;
}

/*
  ============================================
  Página de Carrito (checkout.php)
  ============================================
*/
.cart-item .d-flex {
    flex-direction: column;
    align-items: flex-start !important;
    gap: 10px;
}
.cart-item .product-image {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: .5rem;
    align-self: center;
}
.cart-item .item-details {
    width: 100%;
}
.cart-item .item-actions {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-left: 0 !important;
}
.cart-item .quantity-controls {
    display: flex;
    align-items: center;
}
.cart-item .item-subtotal {
    text-align: right;
    font-weight: bold;
    font-size: 1.1rem;
}
.quantity-input {
    width: 45px;
    text-align: center;
    border: 1px solid #ced4da;
    border-radius: .25rem;
    -moz-appearance: textfield;
}
.quantity-input::-webkit-outer-spin-button,
.quantity-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.summary-card {
    position: static !important;
    margin-top: 2rem;
}

/*
  ============================================
  Media Queries para Tablets y Escritorios
  ============================================
*/

/* Tablets (>= 768px) */
@media (min-width: 768px) {
    main > .container {
        padding: 30px 0;
    }
    .section-title {
        font-size: 2.5rem;
    }
    .main-carousel .carousel-item {
        height: 70vh;
    }
    .main-carousel .carousel-caption h1 {
        font-size: 3.5rem;
    }
    .main-carousel .carousel-caption .lead {
        font-size: 1.25rem;
    }
    .sort-bar {
        flex-direction: row;
        align-items: center !important;
        border-bottom: none;
        margin-bottom: 1.5rem !important;
    }
    .sort-bar form {
        width: auto;
    }
    .sort-bar select {
        width: auto;
    }
    .main-image {
        height: 500px;
        object-fit: cover;
    }
    .thumbnail-gallery img {
        width: 80px;
        height: 80px;
    }
    .price-section .final-price {
        font-size: 2.5rem;
    }
    .cart-item .d-flex {
        flex-direction: row;
        align-items: center !important;
    }
    .cart-item .product-image {
        width: 100px;
        height: 100px;
    }
    .cart-item .item-details {
        flex-grow: 1;
    }
    .cart-item .item-actions {
        width: auto;
        flex-direction: column;
        align-items: flex-end;
        gap: 5px;
        margin-left: 1rem !important;
    }
    .cart-item .item-subtotal {
        min-width: 100px;
    }
}

/* Escritorios (>= 992px) */
@media (min-width: 992px) {
    #filtersCollapse {
        display: block;
    }
    .filters-container .card {
        border: 1px solid rgba(0,0,0,.125);
        box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075) !important;
        background-color: #fff;
        padding: 1.5rem !important;
    }
    .filters-container {
        position: sticky;
        top: 20px;
    }
    .summary-card {
        position: sticky !important;
        top: 20px;
    }
}
