/* =========================================
   PRODUCTS VIEW (MIS PRODUCTOS)
   ========================================= */

.products-view {
    padding-top: 24px; /* Espacio extra vertical solicitado */
    padding-bottom: 80px; /* Espacio para navbar móvil */
    animation: fadeIn 0.3s ease-in-out;
}

/* --- Header & Controls --- */
.products-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 0 4px;
}

.products-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-text-primary);
    margin: 0;
}

.products-controls {
    display: flex;
    gap: 10px;
}

/* --- Grid/List de Productos --- */
/* Ahora es una lista vertical */
.products-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-bottom: 20px;
}

/* --- Tarjeta de Producto (Formato Lista) --- */
.product-card {
    background: var(--color-surface);
    border-radius: 12px;
    padding: 12px 16px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--color-border);
    transition: all 0.2s ease;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 16px;
    position: relative;
    overflow: hidden;
    height: auto; /* Altura automática en lista */
}

.product-card:hover {
    transform: translateX(4px); /* Efecto slide suave al hover */
    box-shadow: var(--shadow-md);
    border-color: var(--color-primary-light);
}

.product-icon-placeholder {
    width: 40px;
    height: 40px;
    min-width: 40px; /* Evitar que se aplaste */
    background: var(--color-surface-variant);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: var(--color-primary);
    margin-bottom: 0; /* Reset margin */
}

/* Contenedor central (Nombre y Media) */
.product-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0; /* Para que funcione el text-overflow */
}

.product-name {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--color-text-primary);
    margin: 0 0 4px 0;
    line-height: 1.2;
    
    /* Truncate text (1 linea en lista) */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block; /* Reset del box clamp anterior */
}

.product-avg-label {
    font-size: 0.75rem;
    color: var(--color-text-tertiary);
}

/* Sección Precio (Derecha) */
.product-price-section {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    margin-bottom: 0;
}

.product-last-price {
    font-size: 1rem;
    font-weight: 700;
    color: var(--color-text-primary);
    letter-spacing: -0.5px;
}

.product-trend-badge {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 1px 5px;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    gap: 2px;
}

.trend-up {
    background: rgba(var(--color-danger-rgb), 0.1);
    color: var(--color-danger);
}

.trend-down {
    background: rgba(var(--color-success-rgb), 0.1);
    color: var(--color-success);
}

.trend-neutral {
    background: var(--color-surface-variant);
    color: var(--color-text-secondary);
}

/* Mini Sparkline (Opcional: Detrás o pequeño) */
/* En modo lista es mejor ocultarlo para limpiar o ponerlo muy sutil */
.product-sparkline-container {
    display: none; /* Oculto en vista lista para mas limpieza */
}


/* --- Detalle de Producto (Modal/Vista) --- */
.product-detail-header-card {
    background: var(--color-surface);
    border-radius: 24px;
    padding: 24px;
    margin-bottom: 24px;
    text-align: center;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--color-border);
}

.product-detail-icon {
    width: 80px;
    height: 80px;
    background: var(--color-surface-variant);
    border-radius: 20px;
    margin: 0 auto 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
}

.product-detail-name {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.product-detail-stats-row {
    display: flex;
    justify-content: center;
    gap: 32px;
    margin-top: 24px;
}

.stat-item {
    display: flex;
    flex-direction: column;
}

.stat-label {
    font-size: 0.8rem;
    color: var(--color-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--color-text-primary);
}

.fusion-suggestion {
    background: rgba(var(--color-primary-rgb), 0.05);
    border: 1px dashed var(--color-primary);
    border-radius: 12px;
    padding: 12px;
    margin-top: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Animations */
/* --- Price Alert Carousel Modal --- */
.modal-alert-carousel {
    background: #fff;
    width: 90%;
    max-width: 320px; /* Cuadrado / Compacto */
    border-radius: 24px;
    padding: 30px 20px;
    text-align: center;
    position: relative;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    animation: popIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popIn {
    from { opacity: 0; transform: scale(0.8); }
    to { opacity: 1; transform: scale(1); }
}

.modal-close-alert {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--color-text-tertiary);
    cursor: pointer;
    line-height: 1;
}

.alert-icon-wrapper {
    width: 64px;
    height: 64px;
    background: rgba(var(--color-danger-rgb), 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
}

.alert-icon-emoji {
    font-size: 2rem;
}

.alert-product-name {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--color-text-primary);
}

.alert-price-change {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--color-danger);
    margin-bottom: 8px;
    letter-spacing: -1px;
}

.alert-message {
    font-size: 0.9rem;
    color: var(--color-text-secondary);
    line-height: 1.4;
    margin-bottom: 20px;
}

/* Nav Controls */
.alert-carousel-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 10px;
    min-height: 40px;
}

.nav-btn {
    background: #e0e0e0; /* Gris claro visible */
    border: none;
    width: 44px; /* Un poco más grande para tocar bien con ratón/dedo */
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #333; /* Texto oscuro */
    transition: background 0.2s;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1); /* Sombra sutil para destacar */
}

.nav-btn:hover { background: var(--color-border); }
.nav-btn.hidden { visibility: hidden; pointer-events: none; }

.carousel-dots {
    display: flex;
    gap: 6px;
}

.dot {
    width: 8px;
    height: 8px;
    background: var(--color-border);
    border-radius: 50%;
    transition: all 0.3s;
}

.dot.active {
    background: var(--color-primary);
    width: 20px; 
    border-radius: 4px;
}

