/* assets/css/top.css — V5.0 (Diseño Premium Podio) */

/* --- CABECERA --- */
.search-header {
    margin-bottom: 40px;
}
.search-title {
    font-size: 2.2rem; font-weight: 800; color: var(--text); margin-bottom: 10px; letter-spacing: -1px;
}
.text-center { text-align: center; }

/* --- PODIO (TOP 3) --- */
.podium-container {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    gap: 30px;
    margin-bottom: 60px;
    padding-top: 20px;
    padding-bottom: 20px;
}

.podium-place {
    width: 280px;
    text-align: center;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Escalado del Podio */
.place-1 { z-index: 3; transform: scale(1.15); margin: 0 15px; }
.place-2 { z-index: 2; transform: scale(1); margin-bottom: -10px; }
.place-3 { z-index: 1; transform: scale(0.95); margin-bottom: -20px; }

/* Medallas */
.medal-icon {
    font-size: 3.5rem;
    margin-bottom: 15px;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.2));
    z-index: 4;
}
.medal-1 { color: #FFD700; } /* Oro */
.medal-2 { color: #C0C0C0; } /* Plata */
.medal-3 { color: #CD7F32; } /* Bronce */

/* Números Gigantes del Ranking (Debajo de la tarjeta) */
.podium-rank {
    font-size: 3.5rem; /* Un poco más pequeño para asegurar espacio */
    font-weight: 900;
    
    /* FIX: Usar margen positivo para empujarlo hacia abajo */
    margin-top: 15px; 
    
    /* Asegurar que se ve */
    z-index: 1; 
    line-height: 1;
    position: relative; /* Quitar absolute si lo tuviera */
}

/* --- COLORES DE LOS NÚMEROS DE RANKING --- */

/* Oro (#1) */
.place-1 .podium-rank {
    color: #FFD700; /* Dorado */
    text-shadow: 0 2px 15px rgba(255, 215, 0, 0.4); /* Brillo */
    opacity: 1; /* Quitamos la transparencia para que brille */
}

/* Plata (#2) */
.place-2 .podium-rank {
    color: #C0C0C0; /* Plateado */
    text-shadow: 0 2px 10px rgba(192, 192, 192, 0.4);
    opacity: 0.8;
}

/* Bronce (#3) */
.place-3 .podium-rank {
    color: #CD7F32; /* Bronce */
    text-shadow: 0 2px 10px rgba(205, 127, 50, 0.4);
    opacity: 0.8;
}

/* --- GRID --- */
.grid-products {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 30px;
    margin-bottom: 60px;
}

/* --- TARJETA PRODUCTO (Estilo Search Premium) --- */
.product-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 20px;
    overflow: hidden;
    position: relative;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    display: flex; flex-direction: column;
    text-decoration: none;
    box-shadow: 0 2px 10px rgba(0,0,0,0.03);
}
.product-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 35px rgba(0,0,0,0.08);
    border-color: color-mix(in srgb, var(--accent) 20%, transparent);
}

/* Tarjeta especial para el podio */
.card-podium {
    width: 100%;
    border: 2px solid transparent; /* Borde base transparente para que no salte al añadir color */
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
	transition: all 0.3s ease;
}

/* ORO (#1) */
.place-1 .card-podium { border: 2px solid #FFD700; box-shadow: 0 20px 50px rgba(255, 215, 0, 0.15); }

/* PLATA (#2) */
.place-2 .card-podium { 
    border-color: #C0C0C0; 
    box-shadow: 0 15px 40px rgba(192, 192, 192, 0.2); 
}

/* BRONCE (#3) */
.place-3 .card-podium { 
    border-color: #CD7F32; 
    box-shadow: 0 15px 40px rgba(205, 127, 50, 0.2); 
}

/* Imagen */
.card-img-wrapper {
    position: relative;
    width: 100%; padding-top: 100%;
    background-color: #fff;
    overflow: hidden;
}
.card-img-wrapper img {
    position: absolute;
    top: 15%; left: 15%; width: 70%; height: 70%;
    object-fit: contain;
    transition: transform 0.4s ease;
}
.product-card:hover .card-img-wrapper img { transform: scale(1.08); }

/* Badges Flotantes */
.floating-badges {
    position: absolute; top: 12px; left: 12px; z-index: 2;
    display: flex; flex-direction: column; gap: 6px;
}
.mini-badge {
    font-size: 0.65rem; font-weight: 800; padding: 4px 8px; border-radius: 6px;
    text-transform: uppercase; color: white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    text-align: center; min-width: 36px;
    backdrop-filter: blur(4px);
}

/* Favorito Flotante */
.btn-fav-float {
    position: absolute; top: 12px; right: 12px; z-index: 3;
    width: 40px; height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(0,0,0,0.05);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    font-size: 1.2rem; color: #cbd5e1;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    transition: all 0.2s;
}
.btn-fav-float:hover { transform: scale(1.1); color: #ef4444; }

/* Toggle Favoritos */
.btn-fav-float .icon-filled { display: none; }
.btn-fav-float.is-favorited .icon-filled { display: inline-block; color: #ef4444; }
.btn-fav-float.is-favorited .icon-empty { display: none; }

/* Info */
.card-info {
    padding: 18px; flex-grow: 1;
    display: flex; flex-direction: column;
    background: var(--card);
}
.card-title {
    font-size: 1.05rem; font-weight: 700; color: var(--text); margin: 0 0 10px 0;
    line-height: 1.4;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden;
}
.product-card:hover .card-title { color: var(--accent); }

/* Badge de Visitas (Fuego) */
.views-badge {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: 0.85rem; color: var(--muted); font-weight: 600;
    background: var(--bg); padding: 4px 10px; border-radius: 20px;
    width: fit-content; margin-top: auto;
}
.views-badge i { color: #f59e0b; }

/* Colores Badges */
.ns-a { background: #038141; } .ns-b { background: #85BB2F; } .ns-c { background: #FECB02; color:#333;} .ns-d { background: #EE8100; } .ns-e { background: #E63E11; }
.nova-1 { background: #00aa00; } .nova-2 { background: #ffcc00; color:#333;} .nova-3 { background: #ff6600; } .nova-4 { background: #ef4444; }

/* Paginación */
.pagination-wrapper {
    display: flex; flex-direction: column; align-items: center;
    gap: 15px; margin-top: 40px;
}
.pagination-controls {
    display: flex; gap: 8px;
    background: var(--card); padding: 6px;
    border-radius: 12px; border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}
.page-btn {
    width: 40px; height: 40px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 8px; color: var(--text);
    text-decoration: none; font-weight: 600; transition: 0.2s;
}
.page-btn:hover { background: var(--bg); }
.page-btn.active { background: var(--accent); color: white; box-shadow: 0 2px 8px rgba(16,185,129,0.3); }
.page-info { font-size: 0.9rem; color: var(--muted); font-weight: 500; }

/* Responsive */
@media (max-width: 900px) {
    .podium-container { flex-direction: column; align-items: center; gap: 40px; }
    .place-1 { order: -1; transform: scale(1.1); margin: 0; }
    .place-2, .place-3 { transform: scale(1); width: 100%; max-width: 300px; }
}

/* --- BADGES DE SALUD (Nutri-Score y NOVA) --- */
.floating-badges {
    position: absolute; top: 10px; left: 10px; z-index: 2;
    display: flex; flex-direction: column; gap: 5px;
}

.mini-badge {
    font-size: 0.65rem; font-weight: 800; padding: 4px 8px; border-radius: 6px;
    text-transform: uppercase; color: white;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    text-align: center; min-width: 32px;
    backdrop-filter: blur(4px);
}

/* Colores Oficiales */
.ns-a { background: #038141; } 
.ns-b { background: #85BB2F; } 
.ns-c { background: #FECB02; color:#333; } 
.ns-d { background: #EE8100; } 
.ns-e { background: #E63E11; }

.nova-1 { background: #00aa00; } 
.nova-2 { background: #ffcc00; color:#333; } 
.nova-3 { background: #ff6600; } 
.nova-4 { background: #ef4444; }

/* --- ARREGLO MODO OSCURO --- */

/* 1. Quitar fondo blanco de la imagen en Dark Mode */
html.dark .card-img-wrapper {
    background-color: transparent; /* O un gris muy oscuro si prefieres: #1e293b */
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

/* 2. Ajustar brillo de imagen para que no deslumbre */
html.dark .card-img-wrapper img {
    opacity: 0.9;
}

/* 3. Ajustar borde de la tarjeta */
html.dark .product-card {
    border-color: rgba(255,255,255,0.1);
}