/**
 * dessidecart — Front-end styles (tema theshopgamer)
 *
 * Carrito lateral (sidecart) adaptado a la línea visual de la web:
 * azul oscuro sobrio (#21274A) + acento rojo (#E5384A), fuente Outfit,
 * esquinas redondeadas y sombras suaves.
 *
 * Todas las propiedades de aspecto se controlan desde las variables
 * --ds-* declaradas justo debajo. Para reskinear el sidecart basta con
 * tocar este bloque :root (no hace falta buscar por todo el archivo).
 *
 * Convención BEM, prefijo des-. NO renombrar IDs/clases que usa front.js:
 *   #des-sidecart · #des-sidecart-overlay · #tool-cart-btn ·
 *   .tool-cart-btn__badge · .des-sidecart__close · .des-sidecart__item ·
 *   .des-sidecart__item-remove · #des-sidecart-body/-footer ·
 *   .des-sidecart__loading · estados --open / .des-body-lock
 *
 * @author    David Escudero Digital Studio <contacto@davidescudero.com>
 * @license   http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
 */

:root {
    /* Paleta (mapea la línea de la web; única fuente de control del sidecart) */
    --ds-primary:        #21274A;   /* navy — acciones principales, texto */
    --ds-primary-hover:  #17263F;
    --ds-accent:         #E5384A;   /* rojo — badge, precio destacado, eliminar */
    --ds-accent-soft:    #FDE7E9;

    /* Superficies y bordes */
    --ds-bg:             #FFFFFF;
    --ds-bg-soft:        #F7F8FB;
    --ds-bg-muted:       #F2F3F6;
    --ds-border:         #EEF0F5;
    --ds-border-strong:  #E6E8EE;

    /* Texto */
    --ds-text:           #21274A;
    --ds-text-muted:     #5A6473;
    --ds-text-soft:      #8A93A6;

    /* Formas */
    --ds-radius:         16px;
    --ds-radius-sm:      12px;
    --ds-radius-pill:    999px;
    --ds-shadow-panel:   -10px 0 44px rgba(33, 39, 74, .18);
    --ds-shadow-soft:    0 4px 16px rgba(33, 39, 74, .08);
    --ds-overlay-bg:     rgba(15, 20, 26, .5);

    /* Tipografía y motion */
    --ds-font:           "Outfit", system-ui, -apple-system, sans-serif;
    --ds-ease:           .38s cubic-bezier(.4, 0, .2, 1);

    /* Medidas */
    --ds-panel-w:        420px;
    --ds-pad-x:          24px;
    --ds-z-overlay:      9998;
    --ds-z-panel:        9999;
}

/* ═══════════════════════════════════════════════════════════════════
   ICONO CARRITO  (.tool-cart en displayNav2)
   ═══════════════════════════════════════════════════════════════════ */

.tool-cart .tool-cart-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    color: var(--ds-primary);
    transition: color .25s ease;
}
.tool-cart .tool-cart-btn:hover {
    color: var(--ds-primary-hover);
}
.tool-cart .tool-cart-btn .tool-cart__icon-wrapper {
    height: 24px;
    position: relative;
    display: flex;
    align-items: center;
}
.tool-cart .tool-cart-btn .tool-cart__icon-wrapper svg {
    display: block;
}
.tool-cart .tool-cart-btn .tool-cart__label {
    font: 500 13px/1 var(--ds-font);
    color: inherit;
}
.tool-cart .tool-cart-btn .tool-cart-btn__badge {
    position: absolute;
    top: -7px;
    right: -11px;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    background: var(--ds-accent);
    color: #fff;
    font: 700 10px/1 var(--ds-font);
    border-radius: var(--ds-radius-pill);
    border: 2px solid var(--ds-bg);
    display: flex;
    align-items: center;
    justify-content: center;
}
/* Estado oculto del badge (cubrimos ambos nombres que togglea el JS/tpl) */
.tool-cart-btn__badge--hidden,
.des-cart-btn__badge--hidden {
    display: none !important;
}

/* Scroll-lock del body cuando el sidecart está abierto */
body.des-body-lock {
    overflow: hidden;
}

/* ═══════════════════════════════════════════════════════════════════
   OVERLAY
   ═══════════════════════════════════════════════════════════════════ */

.des-sidecart-overlay {
    position: fixed;
    inset: 0;
    background: var(--ds-overlay-bg);
    z-index: var(--ds-z-overlay);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--ds-ease);
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
}
.des-sidecart-overlay--open {
    opacity: 1;
    pointer-events: auto;
}

/* ═══════════════════════════════════════════════════════════════════
   PANEL
   ═══════════════════════════════════════════════════════════════════ */

.des-sidecart {
    position: fixed;
    top: 0;
    right: 0;
    width: var(--ds-panel-w);
    max-width: 100vw;
    height: 100vh; /* fallback */
    height: 100dvh;
    background: var(--ds-bg);
    z-index: var(--ds-z-panel);
    transform: translateX(100%);
    transition: transform var(--ds-ease);
    display: flex;
    flex-direction: column;
    box-shadow: var(--ds-shadow-panel);
    font-family: var(--ds-font);
}
.des-sidecart--open {
    transform: translateX(0);
}

/* ── Cabecera ──────────────────────────────────────────────────── */

.des-sidecart__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 20px var(--ds-pad-x);
    border-bottom: 1px solid var(--ds-border);
    flex-shrink: 0;
}
.des-sidecart__title {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font: 700 19px/1.2 var(--ds-font);
    color: var(--ds-text);
}
.des-sidecart__title .fas {
    font-size: 17px;
    color: var(--ds-primary);
}
.des-sidecart__close {
    flex-shrink: 0;
    width: 38px;
    height: 38px;
    background: var(--ds-bg-muted);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    color: var(--ds-text-muted);
    font-size: 17px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color .25s ease, background .25s ease;
}
.des-sidecart__close:hover,
.des-sidecart__close:focus-visible {
    color: var(--ds-text);
    background: var(--ds-border-strong);
    outline: none;
}

/* ── Cuerpo ────────────────────────────────────────────────────── */

.des-sidecart__body {
    flex: 1;
    overflow-y: auto;
    padding: 4px var(--ds-pad-x);
    scrollbar-width: thin;
    scrollbar-color: var(--ds-border-strong) transparent;
}
.des-sidecart__body::-webkit-scrollbar {
    width: 6px;
}
.des-sidecart__body::-webkit-scrollbar-thumb {
    background: var(--ds-border-strong);
    border-radius: var(--ds-radius-pill);
}

/* Estado vacío */
.des-sidecart__empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 64px 24px;
    color: var(--ds-text-soft);
}
.des-sidecart__empty .fas {
    font-size: 54px;
    color: var(--ds-border-strong);
    margin-bottom: 18px;
}
.des-sidecart__empty p {
    font: 500 16px/1.4 var(--ds-font);
    color: var(--ds-text-muted);
    margin: 0 0 20px;
}
.des-sidecart__shop-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 22px;
    font: 600 14px/1 var(--ds-font);
    color: #fff;
    background: var(--ds-primary);
    border-radius: var(--ds-radius-sm);
    text-decoration: none;
    transition: background .25s ease;
}
.des-sidecart__shop-link:hover {
    background: var(--ds-primary-hover);
    color: #fff;
}

/* Lista */
.des-sidecart__list {
    list-style: none;
    margin: 0;
    padding: 0;
}

/* ── Artículo ──────────────────────────────────────────────────── */

.des-sidecart__item {
    display: flex;
    gap: 14px;
    padding: 18px 0;
    border-bottom: 1px solid var(--ds-border);
    position: relative;
}
.des-sidecart__item:last-child {
    border-bottom: none;
}

/* Imagen */
.des-sidecart__item-img-wrap {
    flex-shrink: 0;
    display: block;
    width: 84px;
    height: 84px;
    border-radius: var(--ds-radius-sm);
    overflow: hidden;
    border: 1px solid var(--ds-border-strong);
    background: var(--ds-bg-soft);
}
.des-sidecart__item-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .3s ease;
}
.des-sidecart__item-img-wrap:hover .des-sidecart__item-img {
    transform: scale(1.05);
}
.des-sidecart__item-img--placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--ds-text-soft);
    font-size: 26px;
}

/* Info */
.des-sidecart__item-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding-right: 28px; /* hueco para el botón eliminar */
}
.des-sidecart__item-name {
    font: 600 14.5px/1.35 var(--ds-font);
    color: var(--ds-text);
    text-decoration: none;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color .2s ease;
}
.des-sidecart__item-name:hover {
    color: var(--ds-primary-hover);
}
.des-sidecart__item-attrs {
    font: 400 12.5px/1.3 var(--ds-font);
    color: var(--ds-text-soft);
}
.des-sidecart__item-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 4px;
}
.des-sidecart__item-qty {
    font: 400 13px/1 var(--ds-font);
    color: var(--ds-text-muted);
    white-space: nowrap;
}
.des-sidecart__item-qty strong {
    color: var(--ds-text);
    font-weight: 700;
}
.des-sidecart__item-total {
    font: 700 15px/1 var(--ds-font);
    color: var(--ds-text);
    white-space: nowrap;
}

/* Precio unitario */
.des-sidecart__item-unit {
    font: 400 12.5px/1.3 var(--ds-font);
    color: var(--ds-text-soft);
}

/* Selector de cantidad (stepper +/-) */
.des-sidecart__qty {
    display: inline-flex;
    align-items: center;
    background: var(--ds-bg);
    border: 1px solid var(--ds-border-strong);
    border-radius: var(--ds-radius-pill);
    overflow: hidden;
}
.des-sidecart__qty-btn {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--ds-bg-muted);
    border: none;
    cursor: pointer;
    color: var(--ds-text);
    font-size: 10px;
    line-height: 1;
    transition: background .2s ease, color .2s ease;
}
.des-sidecart__qty-btn:hover:not(:disabled),
.des-sidecart__qty-btn:focus-visible:not(:disabled) {
    background: var(--ds-primary);
    color: #fff;
    outline: none;
}
.des-sidecart__qty-btn:disabled {
    opacity: .4;
    cursor: not-allowed;
}
.des-sidecart__qty-value {
    min-width: 32px;
    text-align: center;
    font: 700 13px/1 var(--ds-font);
    color: var(--ds-text);
    -webkit-user-select: none;
    user-select: none;
}

/* Eliminar (icono circular, top-right) */
.des-sidecart__item-remove {
    position: absolute;
    top: 16px;
    right: 0;
    width: 30px;
    height: 30px;
    flex-shrink: 0;
    background: var(--ds-bg-muted);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    color: var(--ds-text-soft);
    font-size: 12px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color .2s ease, background .2s ease;
}
.des-sidecart__item-remove:hover,
.des-sidecart__item-remove:focus-visible {
    color: var(--ds-accent);
    background: var(--ds-accent-soft);
    outline: none;
}

/* ── Pie ───────────────────────────────────────────────────────── */

.des-sidecart__footer {
    flex-shrink: 0;
    padding: 18px var(--ds-pad-x) 22px;
    border-top: 1px solid var(--ds-border);
    background: var(--ds-bg-soft);
}
.des-sidecart__subtotal {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}
.des-sidecart__subtotal-label {
    font: 600 15px/1.2 var(--ds-font);
    color: var(--ds-text-muted);
}
.des-sidecart__subtotal-note {
    display: block;
    font: 400 12px/1.2 var(--ds-font);
    color: var(--ds-text-soft);
    margin-top: 3px;
}
.des-sidecart__subtotal-price {
    font: 800 24px/1 var(--ds-font);
    color: var(--ds-text);
    white-space: nowrap;
}
.des-sidecart__actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Botones */
.des-btn-sidecart {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 20px;
    border-radius: var(--ds-radius-sm);
    font: 700 14px/1 var(--ds-font);
    text-decoration: none;
    cursor: pointer;
    border: 1.5px solid transparent;
    transition: background .25s ease, color .25s ease, border-color .25s ease, box-shadow .25s ease;
}
.des-btn-sidecart .fas {
    font-size: 13px;
}
.des-btn-sidecart--outline {
    background: var(--ds-bg);
    color: var(--ds-primary);
    border-color: var(--ds-border-strong);
}
.des-btn-sidecart--outline:hover,
.des-btn-sidecart--outline:focus-visible {
    border-color: var(--ds-primary);
    color: var(--ds-primary-hover);
    outline: none;
}
.des-btn-sidecart--primary {
    background: var(--ds-primary);
    color: #fff;
    box-shadow: var(--ds-shadow-soft);
}
.des-btn-sidecart--primary:hover,
.des-btn-sidecart--primary:focus-visible {
    background: #1340ff;
    color: #fff;
    box-shadow: 0 6px 20px rgba(33, 39, 74, .22);
    outline: none;
}

/* ── Spinner ───────────────────────────────────────────────────── */

.des-sidecart__loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px;
    color: var(--ds-border-strong);
    font-size: 30px;
}
.des-sidecart__loading .fas {
    animation: des-spin .8s linear infinite;
}
@keyframes des-spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

/* ═══════════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════════ */

@media (max-width: 575px) {
    :root {
        --ds-panel-w: 100vw;
        --ds-pad-x: 18px;
    }
    .des-sidecart__item-img-wrap {
        width: 72px;
        height: 72px;
    }
    .des-sidecart__subtotal-price {
        font-size: 21px;
    }
}

/* Hover del icono de carrito: azul de marca (el SVG usa fill=currentColor,
   así que sigue al color). Override del navy --ds-primary-hover para este icono. */
.tool-cart .tool-cart-btn:hover,
.tool-cart .tool-cart-btn:focus-visible { color: #1440FF; }
