/**
 * DS Fast Order — Estilos del toggle urgente en el carrito
 */

/*
 * DS Fast Order — Cart row that hosts the urgent toggle label.
 * Inserted at the END of .product-line-grid-body (the left column with
 * product name, dimensions, Detalles + and Envío estimado).
 * Takes the column's width naturally — no need for clear: both tricks.
 */

.product-line-grid-body > .dsfastorder-line-extra-row {
    display: inline-block !important;
    float: none !important;
    position: static !important;
    clear: both !important;

    width: auto !important;
    max-width: 100%;
    box-sizing: border-box;

    margin: 8px 0 0 0;
    padding: 0;
    background: transparent;
    border: 0;
    border-radius: 0;
}

.product-line-grid-body > .dsfastorder-line-extra-row .dsfastorder-toggle-wrap {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    width: auto;
    margin: 0;
    padding: 0;
}

.product-line-grid-body > .dsfastorder-line-extra-row .dsfastorder-toggle-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    margin: 0;
    padding: 0;
    font-weight: normal;
    font-size: 0.85em;
    color: #333;
}

.product-line-grid-body > .dsfastorder-line-extra-row .dsfastorder-toggle-checkbox {
    width: 13px;
    height: 13px;
    cursor: pointer;
    margin: 0;
    flex: 0 0 auto;
}

.product-line-grid-body > .dsfastorder-line-extra-row .dsfastorder-toggle-checkbox:disabled {
    opacity: 0.5;
    cursor: wait;
}

.product-line-grid-body > .dsfastorder-line-extra-row .dsfastorder-toggle-text {
    font-size: 0.85em;
    font-weight: 500;
    font-style: italic;
    line-height: 1.3;
    text-decoration: underline;
    color: #066906;
}

/* === Mobile variant (< 992px) === */
@media (max-width: 991px) {
    .dsfastorder-surcharge-desktop {
        display: none !important;
    }

    /* Yellow box: flex row — toggle-wrap left, surcharge right, same line.
       En móvil sí ocupa el ancho completo para alinear el +€ a la derecha. */
    .product-line-grid-body > .dsfastorder-line-extra-row {
        display: flex !important;
        align-items: center;
        justify-content: space-between;
        flex-wrap: nowrap;
        gap: 12px;
        width: 100% !important;
    }

    .product-line-grid-body > .dsfastorder-line-extra-row .dsfastorder-toggle-wrap {
        display: flex;
        align-items: center;
        gap: 8px;
        flex: 1 1 auto;
        min-width: 0;
    }

    .dsfastorder-line-extra-row .dsfastorder-surcharge-amount.dsfastorder-surcharge-mobile {
        display: inline-block !important;
        text-align: right;
        color: #066906;
        font-weight: 600;
        font-size: 0.95em;
        margin: 0;
        padding: 0;
        white-space: nowrap;
        flex: 0 0 auto;
    }
}

/* === Desktop variant (≥ 992px) === */
@media (min-width: 992px) {
    .dsfastorder-surcharge-mobile {
        display: none !important;
    }

    /* Yellow box on desktop: keep as block, surcharge isn't inside it */
    .product-line-grid-body > .dsfastorder-line-extra-row {
        display: block;
    }

    .product-line-grid-body > .dsfastorder-line-extra-row .dsfastorder-toggle-wrap {
        display: flex;
        align-items: center;
        gap: 8px;
    }

    /* Desktop surcharge: mirrors .product-price structure, inherits theme styles.
       Small margin-top for separation from the price line. */
    .col-md-6.price > .product-price.dsfastorder-surcharge-desktop {
        display: block;
        margin-top: 4px;
    }

    .col-md-6.price > .product-price.dsfastorder-surcharge-desktop > strong {
        font-weight: 500;
    }

    .col-md-6.price > .product-price.dsfastorder-surcharge-desktop .dsfastorder-surcharge-amount {
        color: #066906;
        font-size: 0.95em;
        white-space: nowrap;
    }
}

/* Anti-flash: hide hook output until JS-move completes */
.cart-line-product-actions .dsfastorder-toggle-wrap:not([data-fastorder-moved="1"]),
.cart-line-product-actions .dsfastorder-surcharge-amount:not([data-fastorder-moved="1"]) {
    display: none !important;
}

.dsfastorder-line-extra-row .dsfastorder-toggle-wrap[data-fastorder-moved="1"] {
    display: flex !important;
}

/* ==========================================================================
   v2.1.7 — Side-cart interactive checkbox (panel "Mi carrito")
   ========================================================================== */

/* Side-cart label — texto inline, sin caja */
.product-item label.dsfastorder-sidecart-info {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
    padding: 0;
    background: transparent;
    border: 0;
    border-radius: 0;
    font-size: 0.85em;
    color: #066906;
    line-height: 1.2;
    cursor: pointer;
    user-select: none;
    width: auto;
    max-width: 100%;
    box-sizing: border-box;
}

.product-item label.dsfastorder-sidecart-info .dsfastorder-sidecart-checkbox-input {
    width: 14px;
    height: 14px;
    margin: 0;
    cursor: pointer;
    accent-color: #b22222;
    flex: 0 0 auto;
}

.product-item label.dsfastorder-sidecart-info .dsfastorder-sidecart-label {
    font-weight: 500;
    font-style: italic;
    white-space: normal;
    overflow-wrap: anywhere;
    text-decoration: underline;
    color: #066906;
}

/* Surcharge amount: INSIDE .product-price, aligned at the height of the price */
.product-item .product-price .dsfastorder-sidecart-amount {
    color: #066906;
    font-weight: 500;
    font-size: 0.9em;
    margin-top: 4px;
    text-align: right;
    white-space: nowrap;
    line-height: 1.2;
    display: block;
}

/* Mobile: slightly smaller to avoid overflow on narrow screens */
@media (max-width: 767px) {
    .product-item label.dsfastorder-sidecart-info {
        font-size: 0.8em;
        padding: 3px 6px;
    }
    .product-item .product-price .dsfastorder-sidecart-amount {
        font-size: 0.85em;
    }

    /* v2.2.0: when box is a sibling of .price_controls (inside .name_price_cart),
       force block display so it sits below the price+qty area as a clean row */
    .product-item .name_price_cart > .dsfastorder-sidecart-info {
        display: flex;
        margin-top: 6px;
        width: 100%;
        box-sizing: border-box;
    }
}

/* ==========================================================================
   v2.3.0 — Checkout summary (/pedido) "Tu compra actual"
   Indicador info-only debajo de cada producto urgente activo, con sangría.
   ========================================================================== */

.cart-summary-products .media-list .dsfastorder-checkout-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 6px 0 0 16px;          /* sangría 16px desde la izquierda */
    padding: 0;
    background: transparent;
    border: 0;
    border-radius: 0;
    font-size: 0.85em;
    color: #066906;
    line-height: 1.3;
    width: fit-content;
    max-width: 100%;
    box-sizing: border-box;
}

.cart-summary-products .media-list .dsfastorder-checkout-indicator .dsfastorder-checkout-arrow {
    color: #066906;
    font-weight: 700;
    flex: 0 0 auto;
}

.cart-summary-products .media-list .dsfastorder-checkout-indicator .dsfastorder-checkout-label {
    flex: 1 1 auto;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-decoration: underline;
    font-style: italic;
    font-weight: 500;
    color: #066906;
}

/* Forzar el `<li class="media">` a estirar las columnas a la misma altura,
   para que el recargo de la columna derecha alinee verticalmente con el
   indicador del label en la columna izquierda. */
.cart-summary-products .media-list > li.media {
    align-items: stretch !important;
}

/* `.media-right` como columna flex: precio arriba, recargo abajo.
   Sin esto el theme posiciona el precio absoluto/inline y el recargo se solapa. */
.cart-summary-products .media-list > li.media .media-right {
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-end !important;
    justify-content: space-between !important;
    text-align: right !important;
    position: relative !important;
}

/* Forzar a que TODOS los hijos de .media-right entren en el flujo flex:
   anula cualquier position:absolute / float que el theme aplique al precio. */
.cart-summary-products .media-list > li.media .media-right > * {
    position: static !important;
    float: none !important;
    top: auto !important;
    right: auto !important;
    bottom: auto !important;
    left: auto !important;
}

/* Importe del recargo: alineado abajo a la derecha, a la altura del indicador.
   font-size 14px = mismo tamaño que el resto de precios del resumen. */
.cart-summary-products .media-list .media-right .dsfastorder-checkout-amount-right {
    color: #066906;
    font-weight: 500;
    font-size: 14px;
    text-align: right;
    white-space: nowrap;
    line-height: 1.3;
    margin-top: auto;     /* empuja al fondo de la columna flex */
    align-self: flex-end;
}

/* Mobile: evitar que el flex de Bootstrap colapse el ancho del .media-body o
   .media-right cortando el precio. min-width:0 permite que el body pueda
   shrink, y .media-right toma el ancho de su contenido sin overflow. */
@media (max-width: 767px) {
    .cart-summary-products .media-list .dsfastorder-checkout-indicator {
        font-size: 0.8em;
        margin-left: 8px;
    }
    .cart-summary-products .media-list > li.media {
        flex-wrap: nowrap;
    }
    .cart-summary-products .media-list > li.media .media-body {
        min-width: 0;
        flex: 1 1 auto;
    }
    .cart-summary-products .media-list > li.media .media-right {
        flex: 0 0 auto;
        white-space: nowrap;
    }
    .cart-summary-products .media-list > li.media .media-right .product-price {
        white-space: nowrap;
    }
    .cart-summary-products .media-list .media-right .dsfastorder-checkout-amount-right {
        font-size: 14px;
    }
}

/* ==========================================================================
   v2.5.0 — Indicador en pantalla de confirmación de pedido
   ========================================================================== */

.dsfastorder-confirmation-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    width: fit-content;
    max-width: 100%;
    margin: 4px 0 8px 0;
    padding: 0;
    background: transparent;
    color: #066906;
    font-size: 0.95em;
    font-style: italic;
    font-weight: 500;
    line-height: 1.3;
}

.dsfastorder-confirmation-indicator .dsfastorder-confirmation-arrow {
    color: #066906;
    font-weight: 700;
    flex: 0 0 auto;
}

.dsfastorder-confirmation-indicator .dsfastorder-confirmation-label {
    text-decoration: underline;
    color: #066906;
    flex: 0 1 auto;
}

/* v2.5.9 — Línea del recargo bajo el Total, para que el cliente vea
   de dónde sale la diferencia entre la suma de líneas y el subtotal. */
.order-line .details .dsfastorder-confirmation-surcharge {
    display: block;
    margin-top: 2px;
    color: #066906;
    font-weight: 500;
    font-size: 1em;
    line-height: 1.4;
}

.order-line .details .dsfastorder-confirmation-surcharge strong {
    color: #066906;
    font-weight: 700;
}

/* ==========================================================================
   v2.4.0 — Info tooltip: botón ℹ + burbuja flotante (click toggle)
   Aplica al carrito principal, side-cart y checkout summary.
   ========================================================================== */

.dsfastorder-info-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    margin-left: 4px;
    padding: 0;
    background: transparent;
    border: 0;
    color: #856404;
    cursor: pointer;
    line-height: 1;
    flex: 0 0 auto;
    vertical-align: middle;
    border-radius: 50%;
    transition: background 0.15s ease, color 0.15s ease;
}

.dsfastorder-info-trigger:hover,
.dsfastorder-info-trigger:focus {
    background: rgba(133, 100, 4, 0.12);
    color: #5a4400;
    outline: none;
}

.dsfastorder-info-trigger > .material-icons {
    font-size: 16px;
    line-height: 1;
}

/* Burbuja del tooltip — posicionada relativa al .dsfastorder-info-wrap */
.dsfastorder-info-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.dsfastorder-info-bubble {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    min-width: 220px;
    max-width: 280px;
    padding: 8px 10px;
    background: #333;
    color: #fff;
    font-size: 0.8em;
    font-weight: normal;
    line-height: 1.35;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
    white-space: normal;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s ease, visibility 0.15s ease;
}

.dsfastorder-info-bubble::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #333;
}

.dsfastorder-info-trigger[aria-expanded="true"] + .dsfastorder-info-bubble {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* Mobile: la burbuja crece por la izquierda para no salirse del viewport */
@media (max-width: 575px) {
    .dsfastorder-info-bubble {
        left: auto;
        right: 0;
        transform: none;
        min-width: 180px;
        max-width: 240px;
    }
    .dsfastorder-info-bubble::after {
        left: auto;
        right: 8px;
        transform: none;
    }
}

/* ==========================================================================
   v2.8.0 — Mi cuenta > detalle del pedido
   Dos modos: destacado (como BO) o texto simple.
   ========================================================================== */
.dsfastorder-account-urgent {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    width: fit-content;
    max-width: 100%;
    margin-top: 7px;
    font-size: 0.88rem;
    line-height: 1.25;
}

.dsfastorder-account-urgent.is-highlighted .dsfastorder-account-urgent-label {
    display: inline-flex;
    align-items: center;
    padding: 4px 7px;
    border: 1px solid #ffe69c;
    border-radius: 4px;
    background: #fff3cd;
    color: #664d03;
    font-weight: 700;
}

.dsfastorder-account-urgent.is-highlighted .dsfastorder-account-urgent-amount {
    color: #664d03;
    font-weight: 600;
}

.dsfastorder-account-urgent.is-highlighted .dsfastorder-account-urgent-amount.is-free {
    padding: 2px 6px;
    border-radius: 10px;
    background: #d1e7dd;
    color: #0f5132;
    font-weight: 700;
}

.dsfastorder-account-urgent.is-simple {
    gap: 4px;
}

.dsfastorder-account-urgent.is-simple .dsfastorder-account-urgent-label,
.dsfastorder-account-urgent.is-simple .dsfastorder-account-urgent-amount {
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    font-weight: 500;
}

.dsfastorder-account-urgent.is-simple .dsfastorder-account-urgent-amount.is-free {
    font-weight: 700;
}

@media (max-width: 767px) {
    .dsfastorder-account-urgent {
        margin-top: 5px;
        font-size: 0.82rem;
    }
}
