/* ========================================================== */
/* == 🎨 ESTILOS EXCLUSIVOS PARA LA TARJETA DE PRODUCTO 🎨 == */
/* ========================================================== */

/* --- VARIABLES DE COLORES (Necesarias para la tarjeta) --- */
:root {
  /* TEMA CLARO (POR DEFECTO) */
  --color-texto: #212529;
  --color-texto-secundario: #6c757d;
  --color-tarjeta-fondo: #FFFFFF;
  --color-borde: #dee2e6;
  --color-borde-claro: #eee;
  --color-sutil: rgba(0, 0, 0, 0.04);
  --color-sombra: rgba(0,0,0,0.1);
}

[data-theme="dark"] {
  /* TEMA OSCURO */
  --color-texto: #E0E0E0;
  --color-texto-secundario: #adb5bd;
  --color-tarjeta-fondo: #1E1E1E;
  --color-borde: #444444;
  --color-sutil: rgba(255, 255, 255, 0.05);
}

/* --- TARJETAS DE PRODUCTO (DESKTOP) --- */
.producto-card { 
    background-color: var(--color-tarjeta-fondo);
    border: 1px solid var(--color-borde-claro); 
    transition: all 0.3s ease-in-out; 
    border-radius: 8px; 
    overflow: hidden; 
    cursor: pointer; 
    min-height: 370px; 
    display: flex; 
    flex-direction: column;
}
.producto-card:hover { 
    border-color: var(--color-borde); 
    box-shadow: 0 4px 12px var(--color-sombra); 
}
.producto-card .button-wrapper { cursor: default; }
.producto-card .image-container {
    height: 200px; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    position: relative; 
    background-color: var(--color-sutil); 
}
.producto-card .image-container img { 
    max-height: 100%; 
    max-width: 100%; 
    object-fit: contain; 
    padding: 10px; 
}
.producto-card .btn-add-to-cart { 
    border: 1px solid #E69A0E; 
    color: #ba8a54; 
    background-color: transparent; 
    border-radius: 30px; 
    font-size: 0.9rem; 
    font-weight: 500; 
    padding: 6px 15px; 
    transition: all 0.2s ease-in-out; 
}
.producto-card .btn-add-to-cart:hover {
    background-color: #fff1e6;
}
.producto-card .button-wrapper { 
    min-height: 50px; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
}
.producto-card .quantity-controls-wrapper { 
    display: flex; 
    flex-direction: column; 
    align-items: flex-start; 
    width: 100%; 
}
.producto-card .in-cart-text { 
    font-size: 0.75rem; 
    color: var(--color-texto-secundario); 
    margin-bottom: 2px; 
}
.producto-card .controls-row { 
    display: flex; 
    align-items: center; 
    justify-content: space-between; 
    width: 100%; 
}
.producto-card .button-group { 
    display: flex; 
    align-items: center; 
    gap: 8px; 
}
.producto-card .btn-quantity { 
    background-color: #F7C044; 
    color: #725007; 
    border-radius: 50%; 
    width: 32px; 
    height: 32px; 
    border: none; 
    font-size: 1.2rem; 
    font-weight: bold; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
}
.producto-card .btn-quantity:disabled { 
    background-color: #E0E0E0; 
    color: #9E9E9E; 
    cursor: not-allowed; 
}
.producto-card .quantity-display { 
    font-weight: bold; 
    font-size: 1.25rem; 
    color: #B37B18; 
}

/* --- ICONO DE FAVORITO --- */
.favorite-icon {
    font-size: 1.5rem;
    color: #ff4d6d;
    cursor: pointer;
    transition: transform 0.2s ease;
}
.favorite-icon:hover {
    transform: scale(1.2);
}

/* ========================================================== */
/* ✅ AJUSTES RESPONSIVE PARA LA TARJETA EN MÓVILES ✅ */
/* ========================================================== */

/* Tablet (768px o menos) */
@media (max-width: 768px) {
    .producto-card {
        min-height: 300px;
    }
    .producto-card .image-container {
        height: 140px;
    }
}

/* Móviles (575px o menos) - 2 TARJETAS POR FILA */
@media (max-width: 575.98px) {
    /* CRÍTICO: Limitar ancho máximo para que quepan 2 por fila */
    .row-cols-2 > * {
        width: 48% !important;
        flex: 0 0 48% !important;
        max-width: 48% !important;
    }
    
    .producto-card {
        min-height: 260px;
        width: 100%;
    }
    
    .producto-card .image-container {
        height: 110px;
    }
    
    .producto-card .image-container img {
        padding: 5px;
    }
    
    .producto-card .card-body {
        padding: 0.4rem 0.35rem;
    }
    
    /* Título con máximo 2 líneas - SIN WEBKIT */
    .producto-card .card-title {
        font-size: 0.72rem;
        margin-bottom: 0.15rem !important;
        line-height: 1.2;
        max-height: 2.88em;
        overflow: hidden;
        word-wrap: break-word;
    }
    
    .producto-card .card-text {
        font-size: 0.65rem;
        margin-bottom: 0.15rem !important;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    
    .producto-card .price-container {
        margin-bottom: 0.4rem !important;
    }
    
    .producto-card .current-price {
        font-size: 0.9rem;
        font-weight: 600;
    }
    
    .producto-card .original-price {
        font-size: 0.68rem;
    }
    
    .producto-card .btn-add-to-cart {
        font-size: 0.68rem;
        padding: 4px 10px;
        width: 100%;
    }
    
    .producto-card .button-wrapper {
        min-height: 36px;
    }
    
    .producto-card .btn-quantity {
        width: 26px;
        height: 26px;
        font-size: 0.9rem;
    }
    
    .producto-card .quantity-display {
        font-size: 0.9rem;
    }
    
    .producto-card .in-cart-text {
        font-size: 0.62rem;
    }
    
    .producto-card .product-meta {
        font-size: 0.58rem !important;
        margin-top: 0.3rem !important;
    }
    
    .producto-card .location-tag,
    .producto-card .rating-tag {
        display: flex;
        align-items: center;
    }
    
    .producto-card .location-tag i,
    .producto-card .rating-tag i {
        font-size: 0.58rem;
    }
    
    .favorite-icon {
        font-size: 1.1rem;
        padding: 0.3rem !important;
    }
}

/* Móviles muy pequeños (400px o menos) */
@media (max-width: 400px) {
    .row-cols-2 > * {
        width: 48.5% !important;
        flex: 0 0 48.5% !important;
        max-width: 48.5% !important;
    }
    
    .producto-card {
        min-height: 240px;
    }
    
    .producto-card .image-container {
        height: 95px;
    }
    
    .producto-card .card-body {
        padding: 0.35rem 0.3rem;
    }
    
    .producto-card .card-title {
        font-size: 0.68rem;
        max-height: 2.72em;
    }
    
    .producto-card .card-text {
        font-size: 0.62rem;
    }
    
    .producto-card .current-price {
        font-size: 0.85rem;
    }
    
    .producto-card .original-price {
        font-size: 0.65rem;
    }
    
    .producto-card .btn-add-to-cart {
        font-size: 0.65rem;
        padding: 3px 8px;
    }
    
    .producto-card .btn-quantity {
        width: 24px;
        height: 24px;
        font-size: 0.85rem;
    }
    
    .producto-card .quantity-display {
        font-size: 0.85rem;
    }
    
    .producto-card .product-meta {
        font-size: 0.55rem !important;
    }
    
    .producto-card .button-wrapper {
        min-height: 32px;
    }
}

/* Móviles extra pequeños (360px o menos) */
@media (max-width: 360px) {
    .producto-card {
        min-height: 230px;
    }
    
    .producto-card .image-container {
        height: 85px;
    }
    
    .producto-card .card-title {
        font-size: 0.65rem;
        max-height: 2.6em;
    }
    
    .producto-card .current-price {
        font-size: 0.8rem;
    }
}