/* ===================== AGRUPADOR DE ÍCONOS (modo oscuro + carrito) ===================== */

.acciones-header {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* ===================== ÍCONO DEL CARRITO (header) ===================== */

.btn-carrito {
    position: relative;
    background-color: var(--azul-principal);
    padding: 10px;
    border: none;
    border-radius: 40px;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease;
}

.btn-carrito:hover {
    background-color: #2563eb;
    transform: scale(1.05);
}

.btn-carrito i {
    color: var(--blanco);
    font-size: 22px;
    display: block;
}

.carrito-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    background: #e0433f;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

/* ===================== OVERLAY + PANEL LATERAL ===================== */

.carrito-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 1099;
}

.carrito-overlay.activo {
    opacity: 1;
    pointer-events: all;
}

.carrito-panel {
    position: fixed;
    top: 0;
    right: -450px;
    width: 100%;
    max-width: 400px;
    height: 100vh;
    background: var(--card-bg, var(--bg-header));
    box-shadow: -5px 0 25px rgba(0,0,0,0.2);
    z-index: 1100;
    display: flex;
    flex-direction: column;
    transition: right 0.3s ease;
}

.carrito-panel.activo {
    right: 0;
}

.carrito-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    border-bottom: 1px solid rgba(128,128,128,0.15);
}

.carrito-header h2 {
    font-size: 20px;
    color: var(--text-main);
}

.carrito-cerrar {
    background: transparent;
    border: none;
    font-size: 20px;
    color: var(--text-muted);
    cursor: pointer;
}

.carrito-lista {
    flex: 1;
    overflow-y: auto;
    padding: 15px 20px;
}

.carrito-vacio {
    text-align: center;
    color: var(--text-muted);
    margin-top: 40px;
}

.carrito-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 0;
    border-bottom: 1px solid rgba(128,128,128,0.12);
}

.carrito-item img {
    width: 55px;
    height: 55px;
    object-fit: contain;
    background: var(--bg-body);
    border-radius: 8px;
    padding: 4px;
}

.carrito-item-info {
    flex: 1;
    min-width: 0;
}

.carrito-item-nombre {
    font-size: 14px;
    color: var(--text-main);
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.carrito-item-precio {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.carrito-item-cantidad {
    display: flex;
    align-items: center;
    gap: 10px;
}

.carrito-item-cantidad span {
    color: var(--text-main);
    font-weight: 600;
    min-width: 14px;
    text-align: center;
}

.btn-cantidad {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    border: 1px solid rgba(128,128,128,0.3);
    background: transparent;
    color: var(--text-main);
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
}

.btn-cantidad:hover {
    background: var(--bg-body);
}

.carrito-item-quitar {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 15px;
    align-self: flex-start;
}

.carrito-item-quitar:hover {
    color: #e0433f;
}

.carrito-footer {
    padding: 18px 20px;
    border-top: 1px solid rgba(128,128,128,0.15);
}

.carrito-total-linea {
    font-size: 15px;
    color: var(--text-main);
    margin-bottom: 4px;
}

.carrito-footer-acciones {
    display: flex;
    gap: 10px;
    margin-top: 14px;
}

#btn-ir-checkout {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    background: var(--azul-principal);
    color: #fff;
    text-decoration: none;
    padding: 12px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 700;
    text-align: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#btn-ir-checkout:hover {
    box-shadow: 0 5px 20px rgba(30,136,229,0.35);
    transform: translateY(-1px);
}

.btn-vaciar {
    background: transparent;
    border: 1px solid rgba(128,128,128,0.4);
    color: var(--text-main);
    padding: 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
}

.btn-vaciar:hover {
    background: rgba(224,67,63,0.1);
    border-color: #e0433f;
    color: #e0433f;
}

@media (max-width: 380px) {
    .acciones-header {
        gap: 8px;
    }

    .dark-toggle,
    .btn-carrito {
        padding: 8px;
    }

    .dark-toggle i,
    .btn-carrito i {
        font-size: 18px;
    }
}

@media (max-width: 480px) {
    .carrito-panel {
        max-width: 100%;
    }

    .carrito-header {
        padding: 16px;
    }

    .carrito-lista {
        padding: 10px 16px;
    }

    .carrito-footer {
        padding: 14px 16px;
    }

    .carrito-item img {
        width: 45px;
        height: 45px;
    }

    .carrito-item-nombre {
        font-size: 13px;
    }
}