/* ==========================================================
   REBALLING STORE - TARJETAS DE TRANSPORTISTA
   PrestaShop 8.2.x
   Requiere data-carrier-grade en shipping.tpl
   ========================================================== */

#checkout-delivery-step .delivery-option {
    position: relative;
    display: flex;
    align-items: stretch;
    min-height: 104px;
    margin-bottom: 12px;
    padding: 0 !important;
    background: #fff !important;
    border: 1px solid #dce3ea;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 6px rgba(0,0,0,.035);
    transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease;
}

#checkout-delivery-step .delivery-option:hover {
    border-color: #1067b3;
    box-shadow: 0 5px 16px rgba(16,103,179,.12);
    transform: translateY(-1px);
}

#checkout-delivery-step .delivery-option.rs-selected {
    border: 2px solid #1067b3;
    background: linear-gradient(90deg, rgba(16,103,179,.055), #fff) !important;
    box-shadow: 0 5px 18px rgba(16,103,179,.14);
}

/* Radio centrado verticalmente */
#checkout-delivery-step .delivery-option > .col-sm-1 {
    position: absolute !important;
    z-index: 2;
    left: 0;
    top: 0;
    bottom: 0;
    width: 42px !important;
    max-width: 42px !important;
    height: 100% !important;
    padding: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

#checkout-delivery-step .delivery-option .custom-radio {
    float: none !important;
    margin: 0 !important;
    width: 19px;
    height: 19px;
}

/* Contenido */
#checkout-delivery-step .delivery-option > label {
    float: none !important;
    width: 100% !important;
    max-width: none !important;
    flex: 0 0 100% !important;
    margin: 0 !important;
    padding: 15px 18px 15px 48px !important;
    cursor: pointer;
    display: flex;
    align-items: center;
}

#checkout-delivery-step .delivery-option > label > .row {
    width: 100%;
    display: flex;
    align-items: center;
    margin: 0;
}

/* Logo */
#checkout-delivery-step .carrier-logo {
    min-height: 68px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#checkout-delivery-step .carrier-logo img {
    width: auto !important;
    height: auto !important;
    max-width: 110px !important;
    max-height: 68px !important;
    object-fit: contain;
    transition: transform .2s ease;
}

#checkout-delivery-step .delivery-option:hover .carrier-logo img {
    transform: scale(1.05);
}

/* Nombre */
#checkout-delivery-step .carrier-name {
    font-size: 16px !important;
    font-weight: 700 !important;
    color: #141414;
    line-height: 1.15;
}

/* Tiempo */
#checkout-delivery-step .carrier-delay {
    position: relative;
    display: block;
    padding-left: 21px;
    font-size: 14px;
    line-height: 1.3;
    color: #222;
}

#checkout-delivery-step .carrier-delay::before {
    content: "◷";
    position: absolute;
    left: 0;
    top: -2px;
    font-size: 18px;
    color: #1067b3;
}

/* Precio: JS separa importe e IVA */
#checkout-delivery-step .carrier-price {
    display: block;
    text-align: right;
    white-space: nowrap !important;
    color: #141414;
}

#checkout-delivery-step .rs-price-value {
    display: block;
    font-size: 20px;
    line-height: 1.05;
    font-weight: 800;
    white-space: nowrap;
}

#checkout-delivery-step .rs-price-tax {
    display: block;
    margin-top: 4px;
    font-size: 10px;
    line-height: 1;
    font-weight: 400;
    color: #7b7b7b;
    letter-spacing: .35px;
    text-transform: uppercase;
    white-space: nowrap;
}

#checkout-delivery-step .carrier-price.rs-free-price .rs-price-value {
    color: #10a84d;
    font-size: 23px;
    font-weight: 900;
}

#checkout-delivery-step .delivery-option label > .row > .col-sm-3 {
    padding-left: 5px;
    padding-right: 0;
}

/* Badges */
#checkout-delivery-step .rs-carrier-badges {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 5px;
    margin-top: 7px;
}

#checkout-delivery-step .rs-carrier-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 9px;
    border-radius: 20px;
    font-size: 10px;
    line-height: 1;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .3px;
    white-space: nowrap;
    transform-origin: center;
    animation: rsBadgePulse 3.2s ease-in-out infinite;
}

#checkout-delivery-step .rs-badge-free {
    color: #087d39;
    background: #dcf7e7;
    border: 1px solid #9de1b9;
    animation: rsBadgePulse 3.2s ease-in-out infinite, rsGreenGlow 2.8s ease-in-out infinite;
}

#checkout-delivery-step .rs-badge-cheapest {
    color: #087d39;
    background: #e9f9ef;
    border: 1px solid #b5e7c7;
    animation: rsBadgePulse 3.4s ease-in-out infinite, rsGreenGlow 3s ease-in-out infinite;
}

#checkout-delivery-step .rs-badge-fast {
    color: #075b9f;
    background: #e8f4ff;
    border: 1px solid #9dcefa;
    animation: rsBadgePulse 3.1s ease-in-out infinite, rsBlueGlow 2.8s ease-in-out infinite;
}

#checkout-delivery-step .rs-badge-fastest {
    color: #704b00;
    background: #fff1c2;
    border: 1px solid #f3cf56;
    animation: rsBadgePulse 2.9s ease-in-out infinite, rsGoldGlow 2.4s ease-in-out infinite;
}

#checkout-delivery-step .rs-badge-slowest {
    color: #b42318;
    background: #fff0ee;
    border: 1px solid #f3aaa3;
    animation: rsBadgePulse 3.5s ease-in-out infinite, rsRedGlow 3s ease-in-out infinite;
}

@keyframes rsBadgePulse {
    0%, 100% { transform: scale(1); filter: brightness(1); }
    50% { transform: scale(1.045); filter: brightness(1.06); }
}

@keyframes rsGreenGlow {
    0%, 100% { box-shadow: 0 0 3px rgba(18,168,78,.08); }
    50% { box-shadow: 0 0 9px rgba(18,168,78,.32); }
}

@keyframes rsBlueGlow {
    0%, 100% { box-shadow: 0 0 3px rgba(16,103,179,.08); }
    50% { box-shadow: 0 0 9px rgba(16,103,179,.30); }
}

@keyframes rsGoldGlow {
    0%, 100% { box-shadow: 0 0 3px rgba(243,207,86,.12); }
    50% { box-shadow: 0 0 11px rgba(243,207,86,.55); }
}

@keyframes rsRedGlow {
    0%, 100% { box-shadow: 0 0 3px rgba(180,35,24,.06); }
    50% { box-shadow: 0 0 8px rgba(180,35,24,.25); }
}

/* Indicador 0-9 convertido a 5 puntos */
#checkout-delivery-step .rs-speed {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 7px;
    padding-left: 0;
}

#checkout-delivery-step .rs-speed-dot {
    flex: 0 0 auto;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #d9dee3;
}

#checkout-delivery-step .rs-speed-dot.active {
    background: #1067b3;
}

#checkout-delivery-step .rs-speed-text {
    margin-left: 5px;
    font-size: 10px;
    line-height: 1.15;
    font-weight: 400;
    color: #777;
}

/* Móvil */
@media (max-width: 767px) {
    #checkout-delivery-step .delivery-option {
        min-height: 0;
    }

    #checkout-delivery-step .delivery-option > .col-sm-1 {
        width: 36px !important;
        max-width: 36px !important;
    }

    #checkout-delivery-step .delivery-option > label {
        padding: 13px 10px 13px 40px !important;
    }

    #checkout-delivery-step .delivery-option > label > .row {
        display: block;
    }

    #checkout-delivery-step .carrier-logo img {
        max-width: 90px !important;
        max-height: 58px !important;
    }

    #checkout-delivery-step .carrier-name {
        font-size: 15px !important;
    }

    #checkout-delivery-step .carrier-delay {
        margin-top: 8px;
    }

    #checkout-delivery-step .carrier-price {
        text-align: left;
        margin-top: 9px;
    }

    #checkout-delivery-step .rs-price-value {
        font-size: 19px;
    }

    #checkout-delivery-step .rs-price-tax {
        display: inline-block;
        margin: 0 0 0 5px;
        vertical-align: baseline;
    }
}

@media (prefers-reduced-motion: reduce) {
    #checkout-delivery-step .rs-carrier-badge {
        animation: none !important;
    }
}
