/**
 * Enow CodigosPostales - Widget de entrega
 *
 * Paleta:
 *   Primario:     #f0c040 (dorado)
 *   Secundario:   #000    (negro)
 *   Acento:       #d4a017 (dorado oscuro hover)
 *   Superficie:   #faf8f2 (crema cálido)
 *   Borde:        #e8e2d0 (arena)
 *   Texto:        #1a1a1a (negro suave)
 *   Texto muted:  #5e5e5e (gris medio)
 *   Éxito:        #2e8b57 (verde entrega)
 *   Error:        #c0392b
 */

/* ═══════════════════════════════════════════
   BASE: Contenedor principal
   ═══════════════════════════════════════════ */

.enow-postal-widget {
    font-family: inherit;
    line-height: 1.5;
}

/* ═══════════════════════════════════════════
   PRODUCTO: Layout completo
   ═══════════════════════════════════════════ */

.divEntrega {
    margin: 16px 0;
    border: 1px solid #e8e2d0;
    border-radius: 6px;
    overflow: hidden;
    max-width: 375px;
}

.divEntrega .OpcionesEntrega {
    padding: 16px 18px 8px;
}

.divEntrega .cod-det {
    display: flex;
    justify-content: center;
    padding: 10px 18px 14px;
    background: #fff;
    border-top: 1px solid #e8e2d0;
}

/* ═══════════════════════════════════════════
   PRODUCTO: Stock bar dentro de divEntrega
   ═══════════════════════════════════════════ */

.divEntrega .enow-stock-product {
    padding: 0;
}

.divEntrega .enow-stock-bar {
    padding: 12px 18px;
    background: #faf8f2;
}

.divEntrega .enow-stock-msg {
    font-size: 13px;
}

.divEntrega .enow-stock-track {
    height: 7px;
}

/* ═══════════════════════════════════════════
   FORMULARIO
   ═══════════════════════════════════════════ */

.enow-postal-form {
    display: flex;
    align-items: center;
    gap: 8px;
}

.enow-postal-form .postal-label {
    font-size: 12px;
    font-weight: 600;
    color: #1a1a1a;
    white-space: nowrap;
    letter-spacing: 0.02em;
}

.enow-postal-form .postal-input {
    width: 120px;
    padding: 8px 12px;
    border: 2px solid #e8e2d0;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    color: #1a1a1a;
    background: #fff;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    -moz-appearance: textfield;
}

.enow-postal-form .postal-input::-webkit-outer-spin-button,
.enow-postal-form .postal-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.enow-postal-form .postal-input:focus {
    outline: none;
    border-color: #f0c040;
    box-shadow: 0 0 0 3px rgba(240, 192, 64, 0.2);
}

.enow-postal-form .postal-input::placeholder {
    color: #b0a890;
    font-weight: 400;
}

/* Botón producto */
.enow-postal-form .comp-postal {
    padding: 8px 20px;
    background: #000;
    color: #f0c040;
    border: 2px solid #000;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.enow-postal-form .comp-postal:hover {
    background: #f0c040;
    color: #000;
}

.enow-postal-form .comp-postal:active {
    transform: scale(0.97);
}

/* Botón categoría */
.enow-postal-form .postal-submit {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    padding: 0;
    background: #000;
    color: #f0c040;
    border: 2px solid #000;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.enow-postal-form .postal-submit:hover {
    background: #f0c040;
    color: #000;
}

.enow-postal-form .postal-submit:active {
    transform: scale(0.95);
}

/* ═══════════════════════════════════════════
   LOADING
   ═══════════════════════════════════════════ */

.enow-postal-loading {
    display: none;
    padding: 14px 18px;
    color: #5e5e5e;
    font-size: 13px;
    font-style: italic;
}

.enow-postal-loading::before {
    content: '';
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2.5px solid #e8e2d0;
    border-top-color: #f0c040;
    border-radius: 50%;
    margin-right: 10px;
    vertical-align: middle;
    animation: enow-spin 0.6s linear infinite;
}

@keyframes enow-spin {
    to { transform: rotate(360deg); }
}

/* ═══════════════════════════════════════════
   RESULTADO: Fecha de entrega
   ═══════════════════════════════════════════ */

.enow-postal-result .listaopciones,
[data-role="postal-result"] .listaopciones {
    padding: 0;
}

.rec_fecha {
    display: block;
    font-size: 13px;
    color: #5e5e5e;
    margin-bottom: 4px;
    line-height: 1.6;
}

.recibelo {
    display: inline-block;
    font-size: 16px;
    font-weight: 700;
    color: #2e8b57;
    letter-spacing: -0.01em;
    margin: 0 !important;
}

/* Icono camión SVG negro */
.rec_fecha::before {
    content: '';
    display: inline-block;
    width: 22px;
    height: 18px;
    margin-right: 8px;
    vertical-align: middle;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 640 512'%3E%3Cpath fill='%23000' d='M48 0C21.5 0 0 21.5 0 48v320c0 26.5 21.5 48 48 48h16c0 53 43 96 96 96s96-43 96-96h128c0 53 43 96 96 96s96-43 96-96h32c17.7 0 32-14.3 32-32s-14.3-32-32-32V282.6c0-17-6.7-33.3-18.7-45.3L512 160h-64V48c0-26.5-21.5-48-48-48H48zm400 282.6V224h50.7l53.3 53.3v5.3H448zM160 464a48 48 0 1 1 0-96 48 48 0 0 1 0 96zm368-48a48 48 0 1 1-96 0 48 48 0 0 1 96 0z'/%3E%3C/svg%3E") no-repeat center / contain;
}

/* ═══════════════════════════════════════════
   RESULTADO: Lista de servicios
   ═══════════════════════════════════════════ */

.lstop {
    list-style: none;
    padding: 0;
    margin: 10px 0 4px;
}

.lstop li {
    position: relative;
    padding: 6px 0 6px 24px;
    font-size: 12.5px;
    line-height: 1.55;
    color: #1a1a1a;
    border-bottom: 1px solid rgba(232, 226, 208, 0.5);
}

.lstop li:last-child {
    border-bottom: none;
}

/* Checkmark icon via CSS (reemplaza .check::before y fa-check) */
.lstop li .check::before,
.lstop li > span > i.fa-check::before {
    content: '✓';
    font-style: normal;
    font-family: inherit;
}

.lstop li .check::before {
    content: '';
}

.lstop li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 9px;
    width: 16px;
    height: 16px;
    background: #2e8b57;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lstop li::after {
    content: '✓';
    position: absolute;
    left: 3px;
    top: 9px;
    font-size: 11px;
    font-weight: 800;
    color: #fff;
    line-height: 16px;
}

.lstop li strong {
    color: #000;
    font-weight: 700;
}

.lstop li a {
    color: #000;
    font-weight: 700;
    text-decoration: underline;
    text-decoration-color: #f0c040;
    text-underline-offset: 2px;
    text-decoration-thickness: 2px;
    transition: text-decoration-color 0.2s ease;
}

.lstop li a:hover {
    text-decoration-color: #000;
}

/* Override iconos FontAwesome embebidos en bloques CMS (fallback) */
.lstop li > span > i.fa {
    display: none;
}

/* ═══════════════════════════════════════════
   ESTADO: Sin código postal
   ═══════════════════════════════════════════ */

.tituloEntrega {
    display: block;
    font-size: 15px;
    font-weight: 700;
    color: #000;
    margin-bottom: 6px;
    letter-spacing: 0.02em;
}

.subtituloEntrega {
    display: block;
    font-size: 13px;
    color: #5e5e5e;
    line-height: 1.6;
}

.subtituloEntrega strong {
    color: #f0c040;
    font-weight: 700;
    font-size: 12.5px;
}

/* ═══════════════════════════════════════════
   ESTADO: Error
   ═══════════════════════════════════════════ */

.enow-error .recibelo {
    color: #c0392b !important;
}

.enow-error .rec_fecha::before {
    content: '\26A0';
}

.enow-error .lstop li::before {
    background: #c0392b;
}

.enow-error .lstop li::after {
    content: '!';
    color: #fff;
    font-weight: 800;
    left: 5px;
}

[data-role="postal-result"] .listaopciones .fa-exclamation-triangle,
.listaopciones .fa-exclamation-triangle {
    display: none;
}

/* ═══════════════════════════════════════════
   SERVICIOS EXTRA (subida, instalación...)
   ═══════════════════════════════════════════ */

.servicios-extra {
    display: block;
    margin-top: 6px;
    padding-left: 4px;
}

.servicios-extra > span {
    display: block;
    margin-top: 3px;
    font-size: 12px;
    color: #5e5e5e;
}

/* ═══════════════════════════════════════════
   CONTEXTO: Categoría (compacto inline)
   ═══════════════════════════════════════════ */

.ctx-categoria-form {
    display: flex;
    align-items: center;
    justify-content: space-evenly;
    background: #f3f3f3;
    border-radius: 10px;
    margin-bottom: 10px;
    padding: 4px 10px;
    gap: 10px;
    flex-wrap: wrap;
}

.ctx-categoria-form .cod {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px;
}

.ctx-categoria-form .texto {
    display: none;
}

.ctx-categoria-form .postal-label {
    font-size: 12px;
    font-weight: 600;
    color: #1a1a1a;
    white-space: nowrap;
}

.ctx-categoria-form .postal-input {
    width: 90px;
    padding: 6px 10px;
    font-size: 13px;
    text-align: center;
}

.ctx-categoria-form .postal-submit {
    height: 30px;
    padding: 0 12px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.05em;
    width: unset;
}

/* Resultado inline en categoría */
.ctx-categoria-form [data-role="postal-result"] {
    display: flex;
    align-items: center;
    padding: 5px;
}

.ctx-categoria-form [data-role="postal-result"] .enow-cat-result {
    display: flex;
    align-items: center;
    gap: 10px;
    white-space: nowrap;
}

.ctx-categoria-form [data-role="postal-result"] .rec_fecha {
    margin: 0;
    font-size: 14px;
}

.ctx-categoria-form [data-role="postal-result"] .recibelo {
    font-size: 14px;
}

.ctx-categoria-form [data-role="postal-result"] .enow-cat-summary {
    font-size: 13px;
    color: #1a1a1a;
}

.ctx-categoria-form [data-role="postal-result"] .enow-cat-summary strong {
    font-weight: 700;
}

.ctx-categoria-form .enow-postal-loading {
    padding: 5px 10px;
}

/* ═══════════════════════════════════════════
   CATALOG: Barra de stock (inyectada por JS)
   ═══════════════════════════════════════════ */

.enow-stock-bar {
    margin: 10px 0 8px;
    padding: 0;
}

.enow-stock-msg {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 5px;
    line-height: 1.4;
}

.enow-stock-track {
    width: 100%;
    height: 6px;
    background: #e8e2d0;
    border-radius: 3px;
    overflow: hidden;
}

.enow-stock-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.6s ease-out;
}

.enow-stock-danger {
    background: linear-gradient(90deg, #c0392b, #e74c3c);
}

.enow-stock-warning {
    background: linear-gradient(90deg, #d4a017, #f0c040);
}

.enow-stock-success {
    background: linear-gradient(90deg, #1e7a42, #2e8b57);
}

/* ═══════════════════════════════════════════
   CATALOG: Badge de entrega (inyectado por JS)
   ═══════════════════════════════════════════ */

.enow-delivery-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 10px 0 4px;
    padding: 8px 10px;
    background: #faf8f2;
    border: 1px solid #e8e2d0;
    border-radius: 5px;
}

.enow-delivery-icon {
    flex-shrink: 0;
    width: 24px;
    height: 20px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 640 512'%3E%3Cpath fill='%23000' d='M48 0C21.5 0 0 21.5 0 48v320c0 26.5 21.5 48 48 48h16c0 53 43 96 96 96s96-43 96-96h128c0 53 43 96 96 96s96-43 96-96h32c17.7 0 32-14.3 32-32s-14.3-32-32-32V282.6c0-17-6.7-33.3-18.7-45.3L512 160h-64V48c0-26.5-21.5-48-48-48H48zm400 282.6V224h50.7l53.3 53.3v5.3H448zM160 464a48 48 0 1 1 0-96 48 48 0 0 1 0 96zm368-48a48 48 0 1 1-96 0 48 48 0 0 1 96 0z'/%3E%3C/svg%3E") no-repeat center / contain;
}

.enow-delivery-text {
    display: flex;
    flex-direction: column;
    line-height: 1.3;
}

.enow-delivery-label {
    font-size: 11px;
    color: #5e5e5e;
}

.enow-delivery-date {
    font-size: 13px;
    font-weight: 700;
    color: #2e8b57;
}

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

@media (max-width: 767px) {
    .divEntrega {
        margin: 12px 0;
    }

    .divEntrega .OpcionesEntrega {
        padding: 14px 14px 6px;
    }

    .divEntrega .cod-det {
        padding: 10px 14px 12px;
    }

    .enow-postal-form {
        flex-wrap: wrap;
    }

    .enow-postal-form .postal-input {
        flex: 1;
        min-width: 100px;
    }

    .enow-postal-form .comp-postal {
        flex: 0 0 auto;
    }

    .recibelo {
        font-size: 15px;
    }

    .lstop li {
        font-size: 12px;
    }

    /* Categoría: stack vertical en móvil */
    .ctx-categoria-form {
        flex-direction: column;
        padding: 8px 12px;
        gap: 6px;
    }

    .ctx-categoria-form .enow-cat-result {
        flex-wrap: wrap;
        justify-content: center;
    }

    .enow-delivery-badge {
        padding: 6px 8px;
        gap: 6px;
    }

    .enow-delivery-icon {
        width: 20px;
        height: 16px;
    }

    .enow-delivery-date {
        font-size: 12px;
    }

    .enow-stock-msg {
        font-size: 11px;
    }
}

@media (max-width: 480px) {
    .enow-postal-form .comp-postal {
        width: 100%;
        text-align: center;
        padding: 10px 20px;
    }

    .enow-postal-form .postal-input {
        width: 100%;
    }
}
