/* =========================================================
   BARRA DE BÚSQUEDA (header)
========================================================= */
.header-busqueda {
    position: relative;
    flex: 0 0 auto;
    width: 42px;
    min-width: 0 !important;
    margin: 0 0 0 16px;
    transition: width 0.22s ease;
}

.header-busqueda-caja {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 42px;
    min-height: 40px;
    background: #fff;
    border: 1px solid #e2e2e2;
    border-radius: 999px;
    padding: 8px 12px;
    cursor: text;
    transition: width 0.22s ease, box-shadow 0.22s ease;
}

.header-busqueda-caja i {
    color: #9a9a9a;
    font-size: 14px;
    flex: 0 0 auto;
}

.header-busqueda-caja input {
    border: none;
    outline: none;
    width: 0;
    min-width: 0;
    padding: 0;
    font-size: 14px;
    background: transparent;
    opacity: 0;
    transition: width 0.22s ease, opacity 0.18s ease;
}

.header-busqueda:focus-within,
.header-busqueda:focus-within .header-busqueda-caja {
    width: 230px;
}

.header-busqueda:focus-within .header-busqueda-caja {
    box-shadow: 0 6px 18px rgba(21, 63, 175, 0.18);
}

.header-busqueda:focus-within .header-busqueda-caja input {
    width: 100%;
    opacity: 1;
}

.header-busqueda-resultados {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.12);
    overflow: hidden;
    z-index: 50;
}

.header-busqueda-resultados.activo {
    display: block;
}

.busqueda-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 16px;
    text-decoration: none;
    color: #222;
    border-bottom: 1px solid #f0f0f0;
}

.busqueda-item:hover {
    background: #f7f7f7;
}

.busqueda-item-precio {
    font-weight: 600;
}

.busqueda-sin-resultados {
    padding: 14px 16px;
    color: #888;
    font-size: 14px;
}

/* =========================================================
   ÍCONO DE CARRITO (header)
========================================================= */
.header-carrito {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: #f2f2f2;
    color: #222;
    font-size: 18px;
    text-decoration: none;
    margin-right: 8px;
}

.header-carrito-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    background: var(--color-primario, #2563eb);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    border-radius: 999px;
    align-items: center;
    justify-content: center;
}

/* =========================================================
   PÁGINA "MI CARRITO"
========================================================= */
.carrito-pagina {
    padding: 32px 0 64px;
}

.carrito-breadcrumb {
    font-size: 13px;
    color: #888;
    margin-bottom: 12px;
}

.carrito-breadcrumb a {
    color: #888;
    text-decoration: none;
}

.carrito-titulo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 26px;
    margin-bottom: 24px;
}

.carrito-vacio {
    text-align: center;
    padding: 80px 20px;
}

.carrito-vacio-icono {
    font-size: 48px;
    color: #d4d4d4;
    margin-bottom: 16px;
}

.carrito-vacio-titulo {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 4px;
}

.carrito-vacio-texto {
    color: #999;
    margin-bottom: 20px;
}

.carrito-grid {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 24px;
    align-items: start;
}

@media (max-width: 860px) {
    .carrito-grid {
        grid-template-columns: 1fr;
    }
}

.carrito-item {
    display: grid;
    grid-template-columns: 72px 1fr auto auto auto;
    align-items: center;
    gap: 16px;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 12px;
    padding: 14px;
    margin-bottom: 12px;
}

.carrito-item-imagen {
    width: 72px;
    height: 72px;
    border-radius: 8px;
    background: #f5f5f5;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    color: #ccc;
    font-size: 22px;
}

.carrito-item-imagen img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.carrito-item-datos h3 {
    font-size: 15px;
    margin: 0 0 4px;
}

.carrito-item-precio-unit {
    font-size: 13px;
    color: #888;
    margin: 0;
}

.carrito-item-cantidad {
    display: flex;
    align-items: center;
    border: 1px solid #e2e2e2;
    border-radius: 8px;
    overflow: hidden;
}

.carrito-cantidad-btn {
    width: 30px;
    height: 32px;
    border: none;
    background: #f7f7f7;
    cursor: pointer;
    font-size: 16px;
}

.carrito-cantidad-input {
    width: 42px;
    text-align: center;
    border: none;
    border-left: 1px solid #e2e2e2;
    border-right: 1px solid #e2e2e2;
    height: 32px;
    -moz-appearance: textfield;
}

.carrito-item-subtotal {
    font-weight: 700;
    min-width: 90px;
    text-align: right;
}

.carrito-item-eliminar {
    border: none;
    background: transparent;
    color: #c0392b;
    cursor: pointer;
    font-size: 16px;
}

.carrito-resumen {
    background: #fff;
    border: 1px solid #eee;
    border-radius: 12px;
    padding: 20px;
    position: sticky;
    top: 20px;
}

.carrito-resumen h2 {
    font-size: 16px;
    margin: 0 0 16px;
}

.carrito-resumen-linea {
    display: flex;
    justify-content: space-between;
    font-size: 15px;
    margin-bottom: 8px;
}

.carrito-resumen-nota {
    font-size: 12px;
    color: #999;
    margin-bottom: 16px;
}

.carrito-checkout-btn {
    width: 100%;
    justify-content: center;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Botón "Agregar al carrito" en tarjetas de producto */
.btn-agregar-carrito.agregado {
    background: #16a34a !important;
}
/* =========================================================
   BOTÓN "VER PRODUCTOS" - CARRITO VACÍO
========================================================= */

.carrito-vacio .btn-agregar-carrito {
    width: 180px;
    margin: 25px auto 0;
    padding: 12px 20px;
    display: block;
    text-align: center;
}
/* Botón "Ver productos" cuando el carrito está vacío */
.carrito-ver-productos {
    width: 180px;
    margin: 25px auto 0;
    padding: 12px 20px;
    display: block;
    text-align: center;
    box-sizing: border-box;
}
