/* Cesta de la compra con histórico de precios.
   Se apoya en el tema (Bootstrap) y solo añade lo propio de esta página. */

.cesta { max-width: 900px; }

/* --- cabecera --- */
.cesta-cabecera {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}
.cesta-titulo { font-size: 1.75rem; margin: 0 0 .25rem; }
.cesta-subtitulo { color: #52514e; margin: 0; }
.cesta-acciones { display: flex; gap: .5rem; }

.cesta-aviso {
    display: flex; flex-wrap: wrap; gap: .75rem; align-items: center;
    padding: .75rem 1rem; border-radius: .5rem; margin-bottom: 1.25rem;
}
.cesta-aviso p { margin: 0; }
.cesta-aviso--ajena { background: #fff6e5; border: 1px solid #f0d9a8; }

/* --- buscador --- */
.cesta-buscador { position: relative; margin-bottom: 2rem; }
.cesta-resultados {
    position: absolute; z-index: 20; left: 0; right: 0; top: 100%;
    background: #fff; border: 1px solid #e1e0d9; border-radius: .5rem;
    box-shadow: 0 8px 24px rgba(0,0,0,.08); overflow: hidden;
}
.cesta-resultado {
    display: flex; width: 100%; gap: 1rem; align-items: center; justify-content: space-between;
    padding: .7rem 1rem; background: none; border: 0; border-bottom: 1px solid #f1f0ec; text-align: left;
}
.cesta-resultado:last-child { border-bottom: 0; }
.cesta-resultado:hover, .cesta-resultado:focus { background: #f7f7f4; }
.cesta-resultado-nombre { flex: 1; }
.cesta-resultado-precio { font-weight: 600; white-space: nowrap; }
.cesta-resultado-vacio { margin: 0; padding: .9rem 1rem; color: #52514e; }

/* --- indicadores --- */
.cesta-kpis {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-bottom: 1.25rem;
}
.cesta-kpi {
    display: flex; flex-direction: column; gap: .15rem;
    padding: .9rem 1rem; border: 1px solid #e1e0d9; border-radius: .5rem; background: #fff;
}
.cesta-kpi-titulo { font-size: .8rem; color: #898781; text-transform: uppercase; letter-spacing: .03em; }
.cesta-kpi-valor { font-size: 1.5rem; line-height: 1.2; }
.cesta-kpi-pie { font-size: .85rem; color: #52514e; }
/* El color nunca va solo: la flecha del texto dice lo mismo para quien no lo distingue. */
.cesta-kpi.es-sube .cesta-kpi-valor { color: #d03b3b; }
.cesta-kpi.es-baja .cesta-kpi-valor { color: #006300; }

/* --- rangos --- */
.cesta-rangos { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: .75rem; }
.cesta-rango {
    padding: .35rem .9rem; border: 1px solid #d8d7cf; border-radius: 2rem;
    background: #fff; font-size: .9rem;
}
.cesta-rango.is-activo { background: #2a78d6; border-color: #2a78d6; color: #fff; }

/* --- gráfico --- */
.cesta-grafico-caja { position: relative; transition: opacity .15s ease; }
/* Al recargar se atenúa el gráfico anterior en vez de mostrar un esqueleto: así no
   salta el layout ni parpadea la página en cada cambio de rango. */
.cesta-grafico-caja.is-cargando { opacity: .6; }
.cesta-grafico-vacio {
    padding: 2.5rem 1rem; text-align: center; color: #52514e;
    border: 1px dashed #d8d7cf; border-radius: .5rem;
}

/* --- panel de cesta comparable --- */
.cesta-comparable {
    margin-top: 1rem; padding: 1rem 1.15rem;
    background: #f7f9fc; border: 1px solid #dbe5f2; border-radius: .5rem;
}
.cesta-comparable-titulo { font-weight: 600; margin: 0 0 .35rem; }
.cesta-comparable-texto { margin: 0 0 .5rem; color: #52514e; font-size: .95rem; }
.cesta-comparable-desde { margin: 0 0 .5rem; font-size: .95rem; }
.cesta-enlace {
    background: none; border: 0; padding: 0; color: #2a78d6;
    text-decoration: underline; font: inherit;
}
.cesta-excluidos summary { cursor: pointer; font-size: .95rem; }
.cesta-excluidos-lista { list-style: none; margin: .6rem 0 0; padding: 0; }
.cesta-excluido {
    display: flex; flex-wrap: wrap; gap: .5rem; justify-content: space-between;
    padding: .45rem 0; border-bottom: 1px solid #e6ecf5;
}
.cesta-excluido:last-child { border-bottom: 0; }
.cesta-excluido-motivo { color: #52514e; font-size: .875rem; }

.cesta-tabla-datos { margin-top: 1rem; }
.cesta-tabla-datos summary { cursor: pointer; color: #52514e; font-size: .95rem; }

/* --- artículos --- */
.cesta-seccion-titulo { font-size: 1.2rem; margin: 2rem 0 .75rem; }
.cesta-lista { list-style: none; margin: 0; padding: 0; }
.cesta-articulo {
    display: flex; gap: 1rem; align-items: center;
    padding: .75rem 0; border-bottom: 1px solid #eceae4;
}
.cesta-articulo--manual .cesta-articulo-nombre { font-style: italic; }
.cesta-articulo-info { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.cesta-articulo-nombre { color: inherit; }
.cesta-articulo-detalle { font-size: .85rem; color: #898781; }
.cesta-articulo-controles { display: flex; align-items: center; gap: .35rem; }
.cesta-articulo-cantidad { min-width: 1.75rem; text-align: center; }
.cesta-articulo-total { min-width: 5rem; text-align: right; font-weight: 600; }
.cesta-boton-icono {
    width: 1.85rem; height: 1.85rem; line-height: 1;
    border: 1px solid #d8d7cf; border-radius: 50%; background: #fff;
}
.cesta-articulo-quitar {
    width: 1.85rem; height: 1.85rem; line-height: 1;
    border: 0; background: none; color: #898781; font-size: 1.2rem;
}
.cesta-articulo-quitar:hover { color: #d03b3b; }
.cesta-vacia { color: #52514e; padding: 1.5rem 0; }
.cesta-pie { margin-top: 2.5rem; color: #898781; font-size: .9rem; }

/* --- avisos flotantes --- */
.cesta-toast {
    position: fixed; left: 50%; bottom: 1.5rem; transform: translateX(-50%);
    z-index: 1080; max-width: 90vw;
    padding: .7rem 1.1rem; border-radius: 2rem;
    background: #2b2a27; color: #fff; font-size: .95rem;
    box-shadow: 0 6px 20px rgba(0,0,0,.2);
}

@media (max-width: 575.98px) {
    .cesta-kpis { grid-template-columns: 1fr; gap: .6rem; }
    .cesta-kpi { flex-direction: row; align-items: baseline; justify-content: space-between; }
    .cesta-articulo { flex-wrap: wrap; }
    .cesta-articulo-total { min-width: auto; }
}
