/*
 * Archivo: assets/css/checkout.css
 *
 * Responsabilidad:
 *   Estilos del recuadro y las tarjetas de tarifas Starken y del selector de agencia, con prefijo
 *   se- para no interferir con otros plugins.
 *
 * Historial de versiones:
 *   1.3.1  Encabezado con responsabilidad e historial por versión (sin cambios de lógica).
 *   1.1.0  Valores de respaldo en todas las variables CSS.
 *   1.0.0  Versión inicial: selector de agencia, recuadro de tarifas, tarjetas y wordmark en
 *          negativo #1e4b22.
 */

/* ==========================================================================
   Starken Edit — tarjetas de envío en carrito y checkout
   --------------------------------------------------------------------------
   Sobre el uso de !important: el plugin Sendu aplica reglas !important e
   incluso estilos inline (vía JS) sobre TODOS los `li` y `label` dentro de
   .woocommerce-shipping-methods, incluidos los que no son suyos. Estas reglas
   suben la especificidad únicamente sobre NUESTROS elementos (.se-group,
   .se-item) para recuperar el control; ninguna toca los de Sendu.
   ========================================================================== */

:root {
    --se-green: #1e4b22;
    --se-green-dark: #163819;
    --se-green-soft: #eaf3ea;
    --se-green-tint: #f6faf6;
    --se-border: #d9e0e4;
    --se-border-strong: #c3ccd2;
    --se-ink: #22303a;
    --se-muted: #6b7a83;
}

/* --- Recuadro que agrupa las tarifas ------------------------------------ */

.woocommerce-shipping-methods li.se-group,
.woocommerce-checkout .woocommerce-shipping-methods li.se-group {
    display: block !important;
    align-items: initial !important;
    min-width: 0 !important;
    min-height: 0 !important;
    width: auto !important;
    margin: 0 0 14px 0 !important;
    padding: 0 !important;
    border: 1px solid var(--se-border, #d9e0e4) !important;
    border-radius: 12px !important;
    background: #fff !important;
    box-shadow: none !important;
    overflow: hidden;
    list-style: none !important;
}

.se-group-head {
    padding: 10px 14px;
    background: var(--se-green-soft, #eaf3ea);
    border-bottom: 1px solid var(--se-border, #d9e0e4);
}

.se-group-title {
    display: block;
    margin: 0;
    font-size: 13.5px;
    font-weight: 700;
    line-height: 1.3;
    color: var(--se-green, #1e4b22);
    letter-spacing: 0.005em;
}

.se-group-sub {
    display: block;
    margin-top: 2px;
    font-size: 12px;
    font-weight: 400;
    line-height: 1.35;
    color: #55665c;
}

.se-group-list {
    margin: 0 !important;
    padding: 8px !important;
    list-style: none !important;
    display: block;
}

/* --- Cada opción -------------------------------------------------------- */

.woocommerce-shipping-methods li.se-item,
.woocommerce-checkout .woocommerce-shipping-methods li.se-item {
    display: block !important;
    align-items: initial !important;
    min-width: 0 !important;
    min-height: 0 !important;
    width: auto !important;
    margin: 0 0 8px 0 !important;
    padding: 0 !important;
    border: 1.5px solid #dfe4e8 !important;
    border-radius: 10px !important;
    background: #fff !important;
    box-shadow: none !important;
    list-style: none !important;
    transition: border-color .15s ease, background-color .15s ease, box-shadow .15s ease;
}

.woocommerce-shipping-methods li.se-item:last-child {
    margin-bottom: 0 !important;
}

.woocommerce-shipping-methods li.se-item:hover {
    border-color: var(--se-border-strong, #c3ccd2) !important;
    box-shadow: none !important;
}

.woocommerce-shipping-methods li.se-item.se-checked,
.woocommerce-checkout .woocommerce-shipping-methods li.se-item.se-checked {
    border-color: var(--se-green, #1e4b22) !important;
    background: var(--se-green-tint, #f6faf6) !important;
    box-shadow: 0 0 0 3px rgba(30, 75, 34, .12) !important;
}

/* El radio real se oculta y se dibuja uno propio, para verse igual con o sin
   Sendu instalado. */
.woocommerce-shipping-methods li.se-item input.shipping_method {
    position: absolute !important;
    opacity: 0 !important;
    width: 0 !important;
    height: 0 !important;
    margin: 0 !important;
}

.woocommerce-shipping-methods li.se-item > label,
.woocommerce-checkout .woocommerce-shipping-methods li.se-item > label {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 12px;
    width: 100%;
    margin: 0 !important;
    padding: 12px 14px !important;
    font-size: 14px !important;
    font-weight: 400 !important;
    line-height: 1.35;
    color: var(--se-ink, #22303a) !important;
    cursor: pointer;
    text-transform: none !important;
}

.woocommerce-shipping-methods li.se-item > label::before {
    content: '';
    display: block;
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    margin: 0 !important;
    border: 2px solid var(--se-border-strong, #c3ccd2);
    border-radius: 50%;
    background: #fff;
    box-shadow: none;
    transition: border-color .15s ease, background-color .15s ease, box-shadow .15s ease;
}

.woocommerce-shipping-methods li.se-item input.shipping_method:checked + label::before {
    border-color: var(--se-green, #1e4b22);
    background: var(--se-green, #1e4b22);
    box-shadow: inset 0 0 0 3.5px #fff;
}

.woocommerce-shipping-methods li.se-item > label::after {
    content: none !important;
}

/* --- Contenido de la etiqueta ------------------------------------------- */

.se-rate {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1 1 auto;
    min-width: 0;
}

/* Wordmark en negativo: fondo verde, letras blancas. */
.se-brand {
    display: inline-flex;
    align-items: center;
    flex: 0 0 auto;
    padding: 6px 10px;
    border-radius: 6px;
    background: var(--se-green, #1e4b22);
    line-height: 1;
    font-family: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.se-brand-word {
    display: inline-block;
    font-size: 15px;
    font-weight: 800;
    letter-spacing: -0.035em;
    color: #fff;
    white-space: nowrap;
}

/* La "r" va en recuadro invertido, como en el logo original. */
.se-brand-r {
    display: inline-block;
    margin: 0 1px;
    padding: 0 2px;
    border-radius: 2px;
    background: #fff;
    color: var(--se-green, #1e4b22);
}

.se-body {
    display: flex;
    flex-direction: column;
    gap: 1px;
    flex: 1 1 auto;
    min-width: 0;
}

.se-title {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.3;
    color: var(--se-ink, #22303a);
}

.se-meta {
    font-size: 11.5px;
    line-height: 1.35;
    color: var(--se-muted, #6b7a83);
}

.se-price {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 1px;
    flex: 0 0 auto;
    text-align: right;
}

.se-price .se-amount,
.se-price .se-amount .woocommerce-Price-amount {
    font-size: 15px !important;
    font-weight: 700 !important;
    line-height: 1.2;
    color: var(--se-green, #1e4b22) !important;
    white-space: nowrap;
}

.se-note {
    font-size: 10.5px;
    line-height: 1.2;
    color: var(--se-muted, #6b7a83);
    white-space: nowrap;
}

.se-free {
    font-size: 15px;
    font-weight: 700;
    color: var(--se-green, #1e4b22);
}

/* --- Selector de agencia dentro del recuadro ---------------------------- */

.se-group > .se-agency-field {
    margin: 0;
    padding: 12px 14px;
    border-top: 1px solid var(--se-border, #d9e0e4);
    background: #fbfcfb;
}

.se-agency-label {
    display: block !important;
    margin: 0 0 6px 0 !important;
    padding: 0 !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    line-height: 1.3;
    color: var(--se-green, #1e4b22) !important;
    text-transform: none !important;
    cursor: pointer;
}

.se-agency-select {
    display: block;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    padding: 9px 10px;
    border: 1.5px solid var(--se-border, #d9e0e4) !important;
    border-radius: 8px;
    background-color: #fff;
    font-size: 13.5px;
    line-height: 1.35;
    color: var(--se-ink, #22303a);
}

.se-agency-select:focus {
    border-color: var(--se-green, #1e4b22) !important;
    outline: none;
    box-shadow: 0 0 0 3px rgba(30, 75, 34, .12);
}

.se-agency-hint {
    display: block;
    margin-top: 6px;
    font-size: 11px;
    line-height: 1.35;
    color: var(--se-muted, #6b7a83);
}

.se-agency-empty {
    display: block;
    font-size: 12.5px;
    line-height: 1.4;
    color: #b32d2e;
}

/* Cuando falta elegir agencia, se marca el selector. */
.se-agency-field.se-agency-missing .se-agency-select {
    border-color: #d98324 !important;
    box-shadow: 0 0 0 3px rgba(217, 131, 36, .12);
}

#place_order.starken-edit-blocked {
    opacity: .55;
    cursor: not-allowed;
}

/* --- Pantallas chicas ---------------------------------------------------- */

@media (max-width: 560px) {
    .woocommerce-shipping-methods li.se-item > label,
    .woocommerce-checkout .woocommerce-shipping-methods li.se-item > label {
        flex-wrap: wrap;
        padding: 11px 12px !important;
        gap: 10px;
    }

    .se-rate {
        flex-wrap: wrap;
        gap: 8px;
    }

    .se-body {
        flex: 1 1 100%;
        order: 3;
        width: 100%;
    }

    .se-brand {
        order: 1;
    }

    .se-price {
        order: 2;
        margin-left: auto;
    }

    .se-meta {
        font-size: 11px;
    }
}
