/* =============================================================
   MecatoNatural — Checkout Moderno (Estilo WC Blocks)
   ============================================================= */

/* ===================== FONDO GRIS + TARJETA BLANCA ========== */
.mn-checkout-bg {
    background: #f5f5f5;
    min-height: 70vh;
    padding: 30px 0 60px;
}

.mn-checkout {
    max-width: 1140px;
    margin: 0 auto;
    padding: 0 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    color: #1e1e1e;
    box-sizing: border-box;
}

.mn-checkout *,
.mn-checkout *::before,
.mn-checkout *::after {
    box-sizing: border-box;
}

/* Tarjeta blanca */
.mn-card {
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 10px;
    padding: 28px 32px;
    margin-bottom: 20px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}

/* ============= LAYOUT: GRID DE DOS COLUMNAS ================= */
.mn-checkout-grid {
    display: flex;
    gap: 28px;
    align-items: flex-start;
    position: relative;
    /* Base para el sticky */
}

.mn-checkout-col-left {
    flex: 1 1 0%;
    min-width: 0;
}

.mn-checkout-col-right {
    flex: 0 0 380px;
    position: -webkit-sticky;
    /* Soporte Safari */
    position: sticky;
    top: 30px;
    align-self: flex-start;
    z-index: 100;
}

/* ================== BILLING / SHIPPING ====================== */
.mn-checkout .col2-set {
    width: 100% !important;
}

.mn-checkout .col2-set .col-1,
.mn-checkout .col2-set .col-2 {
    float: none !important;
    width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
}

.mn-checkout .col2-set .col-2 {
    margin-top: 6px !important;
}

/* Grid interno de campos: 2 columnas */
.mn-checkout .woocommerce-billing-fields__field-wrapper,
.mn-checkout .woocommerce-shipping-fields__field-wrapper {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px 16px; /* Aumentado a 15px para consistencia visual */
}

/* Campos anchos */
.mn-checkout #billing_address_1_field,
.mn-checkout #billing_address_2_field,
.mn-checkout #billing_company_field,
.mn-checkout #billing_email_field,
.mn-checkout #shipping_address_1_field,
.mn-checkout #shipping_address_2_field,
.mn-checkout #shipping_company_field,
.mn-checkout #order_comments_field,
.mn-checkout .form-row-wide {
    grid-column: 1 / -1;
}

/* =================== TÍTULOS ================================ */
.mn-checkout .woocommerce-billing-fields h3,
.mn-checkout .woocommerce-shipping-fields h3,
.mn-checkout .woocommerce-additional-fields h3 {
    font-size: 18px !important;
    font-weight: 700 !important;
    color: #1e1e1e !important;
    margin: 25px 0 18px 0 !important;
    /* Un poco más de margen superior para separar secciones */
    padding: 0 0 12px 0 !important;
    border-bottom: 2px solid #0C5736 !important;
}

/* Título de dirección diferente más discreto */
.mn-checkout #ship-to-different-address {
    font-size: 15px !important;
    margin: 20px 0 15px 0 !important;
    padding: 0 !important;
    border: none !important;
    /* Opcional: quita la línea verde si es muy invasiva para un sub-título */
    font-weight: 600 !important;
}

.mn-checkout #ship-to-different-address label {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    font-weight: 700 !important;
}

.mn-checkout #ship-to-different-address input {
    margin: 0 !important;
}

/* =================== LABELS ================================ */
.mn-checkout .form-row,
.mn-checkout .form-row-first,
.mn-checkout .form-row-last,
.mn-checkout .form-row-wide {
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    float: none !important;
    display: block !important;
    clear: both !important;
}

.mn-checkout .form-row label {
    font-size: 13px;
    font-weight: 500;
    color: #333;
    margin-bottom: 5px;
    display: block;
}

.mn-checkout .form-row label .required {
    color: #0C5736;
}

.mn-checkout .form-row label .optional {
    color: #999;
    font-size: 12px;
}

/* =================== INPUTS ================================ */
.mn-checkout .input-text,
.mn-checkout input[type="text"],
.mn-checkout input[type="email"],
.mn-checkout input[type="tel"],
.mn-checkout input[type="password"],
.mn-checkout input[type="number"],
.mn-checkout textarea {
    width: 100% !important;
    padding: 11px 14px !important;
    border: 1.5px solid #ddd !important;
    border-radius: 6px !important;
    font-size: 14px !important;
    color: #1e1e1e !important;
    background: #fafafa !important;
    transition: border-color 0.15s, box-shadow 0.15s, background 0.15s !important;
    outline: none !important;
    box-shadow: none !important;
    min-height: 48px !important;
    /* Base mínima */
}

/* Reducir notas del pedido a aprox 2 filas */
.mn-checkout textarea#order_comments {
    height: 72px !important;
    min-height: 72px !important;
}

.mn-checkout .input-text:focus,
.mn-checkout input[type="text"]:focus,
.mn-checkout input[type="email"]:focus,
.mn-checkout input[type="tel"]:focus,
.mn-checkout textarea:focus {
    border-color: #0C5736 !important;
    background: #fff !important;
    box-shadow: 0 0 0 3px rgba(12, 87, 54, 0.1) !important;
}

/* =================== SELECTS ================================ */
.mn-checkout select {
    width: 100% !important;
    padding: 11px 14px !important;
    border: 1.5px solid #ddd !important;
    border-radius: 6px !important;
    font-size: 14px !important;
    background: #fafafa !important;
    transition: border-color 0.15s, box-shadow 0.15s !important;
    cursor: pointer;
}

.mn-checkout select:focus {
    border-color: #0C5736 !important;
    background: #fff !important;
    box-shadow: 0 0 0 3px rgba(12, 87, 54, 0.1) !important;
    outline: none !important;
}

/* Select2 (Departamentos y Ciudades de Colombia) - Usando clases del usuario */
.mn-checkout .md_form_departamento .select2-container,
.mn-checkout .md_form_ciudad .select2-container {
    margin: 0 !important; /* Elimina espacios extra que rompen la simetría */
}

.mn-checkout .md_form_departamento .select2-selection--single,
.mn-checkout .md_form_ciudad .select2-selection--single {
    height: 48px !important;
    padding: 0 !important; /* Reseteo total para evitar que sume al padding interno */
    border: 1.5px solid #ddd !important;
    border-radius: 6px !important;
    background: #fafafa !important;
    display: flex !important;
    align-items: center !important;
    position: relative !important;
    outline: none !important;
}

.mn-checkout .md_form_departamento .select2-selection__rendered,
.mn-checkout .md_form_ciudad .select2-selection__rendered {
    padding: 0 !important; /* Limpiamos paddings heredados */
    padding-left: 14px !important; /* Alineación exacta de 14px */
    margin: 0 !important;
    line-height: normal !important;
    font-size: 14px !important;
    color: #1e1e1e !important;
    width: 100% !important;
    display: block !important;
    text-align: left !important;
}

.mn-checkout .md_form_departamento .select2-selection__arrow,
.mn-checkout .md_form_ciudad .select2-selection__arrow {
    height: 20px !important; /* Altura controlada para el icono */
    width: 20px !important;
    top: 50% !important; /* Centrado vertical absoluto */
    transform: translateY(-50%);
    right: 12px !important;
    position: absolute !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.mn-checkout .md_form_departamento .select2-selection__arrow b,
.mn-checkout .md_form_ciudad .select2-selection__arrow b {
    position: static !important;
    margin: 0 !important;
    border-width: 5px 4px 0 4px !important; /* Flecha más limpia */
}

.mn-checkout .select2-container--focus .select2-selection--single,
.mn-checkout .select2-container--open .select2-selection--single {
    border-color: #0C5736 !important;
    box-shadow: 0 0 0 3px rgba(12, 87, 54, 0.1) !important;
}

.select2-dropdown {
    border: 1.5px solid #0C5736 !important;
    border-radius: 8px !important;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1) !important;
    overflow: hidden !important;
    z-index: 9999 !important;
}

.select2-results__option {
    padding: 10px 15px !important;
    font-size: 14px !important;
    color: #333 !important;
    transition: all 0.15s ease !important;
}

.select2-container--default .select2-results__option--highlighted[aria-selected] {
    background-color: #0C5736 !important;
    color: #ffffff !important;
}

.select2-container--default .select2-results__option[aria-selected="true"] {
    background-color: #f4f4f4 !important;
    color: #0C5736 !important;
    font-weight: 600 !important;
}

/* =================== CHECKBOX / RADIO ======================= */
.mn-checkout input[type="checkbox"],
.mn-checkout input[type="radio"] {
    accent-color: #0C5736;
}

.mn-checkout .woocommerce-account-fields,
.mn-checkout .create-account {
    margin-top: 15px !important;
    clear: both;
}

/* =============================================================
   COLUMNA DERECHA — RESUMEN (Estilo tarjeta con thumbnails)
   ============================================================= */
.mn-order-card {
    padding: 0 !important;
    background: #fff !important;
    border: 1px solid #e5e5e5 !important;
    border-radius: 12px !important;
    overflow: hidden !important;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.05) !important;
}

/* Header verde del resumen integrado */
.mn-checkout-col-right #order_review_heading {
    font-size: 16px !important;
    font-weight: 700 !important;
    color: #fff !important;
    margin: 0 !important;
    padding: 20px 24px !important;
    background: #0C5736 !important;
    border: none !important;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

/* Eliminar fondos extra que causan el efecto de "doble card" y márgenes residuales */
.mn-checkout-col-right .your_order_box,
.mn-checkout-col-right .woocommerce-checkout-review-order {
    background: transparent !important;
    padding: 0 !important;
    border: none !important;
    box-shadow: none !important;
    margin: 0 !important;
    width: 100% !important;
}

/* Tabla de productos en resumen */
.mn-checkout-col-right .shop_table,
.mn-checkout-col-right .woocommerce-checkout-review-order-table {
    border: none !important;
    margin: 0 !important;
    width: 100% !important;
    border-collapse: collapse !important;
}

.mn-checkout-col-right .shop_table thead th {
    display: none !important;
    /* Ocultar cabecera, las imágenes hablan solas */
}

.mn-checkout-col-right .shop_table tbody td {
    padding: 20px 24px !important;
    border: none !important;
    border-bottom: 1px solid #f2f2f2 !important;
    font-size: 14px !important;
    color: #1e1e1e !important;
    vertical-align: middle !important;
}

/* Thumbnails con badge de cantidad */
.mn-product-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.mn-thumb-wrap {
    position: relative;
    flex-shrink: 0;
    width: 56px;
    height: 56px;
}

.mn-order-thumb {
    width: 56px !important;
    height: 56px !important;
    object-fit: cover !important;
    border-radius: 8px !important;
    border: 1px solid #eee !important;
}

.mn-qty-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    background: #0C5736;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.mn-product-name {
    font-weight: 500;
    font-size: 13px;
    line-height: 1.4;
    color: #333;
}

/* Precio por producto */
.mn-checkout-col-right .shop_table .product-total {
    text-align: right !important;
    font-weight: 600 !important;
    white-space: nowrap !important;
}

/* Ocultar la columna de cantidad (ya está en el badge) */
.mn-checkout-col-right .shop_table .product-name .product-quantity {
    display: none !important;
}

/* Subtotal, envío, etc. */
.mn-checkout-col-right .shop_table tfoot tr:not(.order-total) th,
.mn-checkout-col-right .shop_table tfoot tr:not(.order-total) td {
    padding: 12px 24px !important;
    font-size: 14px !important;
    color: #444 !important;
    border: none !important;
    border-bottom: 1px solid #f2f2f2 !important;
    background: transparent !important;
}

/* TOTAL — destacado y moderno */
.mn-checkout-col-right .shop_table .order-total td,
.mn-checkout-col-right .shop_table .order-total th {
    padding: 24px 24px !important;
    font-size: 20px !important;
    font-weight: 800 !important;
    color: #0C5736 !important;
    background: #f8fdfa !important;
    border: none !important;
}

/* =============================================================
   SECCIÓN DE PAGO (Columna izquierda, abajo)
   ============================================================= */
.mn-payment-card {
    padding: 20px 24px !important;
}

.mn-checkout #payment {
    background: transparent !important;
    border: none !important;
    border-radius: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    box-shadow: none !important;
}

.mn-checkout #payment ul.payment_methods {
    padding: 0 !important;
    margin: 0 !important;
    /* Eliminar margen para compactar */
    border: none !important;
}

.mn-checkout #payment ul.payment_methods li {
    list-style: none !important;
    padding: 10px 14px !important;
    border: 1.5px solid #e5e5e5 !important;
    border-radius: 8px !important;
    margin-bottom: 0 !important;
    /* Quitar margen inferior para evitar líneas dobles */
    transition: all 0.2s ease !important;
}

.mn-checkout #payment ul.payment_methods li:has(input:checked),
.mn-checkout #payment ul.payment_methods li.payment_method_selected {
    border-color: #0C5736 !important;
    background: #f8fdf9 !important;
}

.mn-checkout #payment ul.payment_methods li label {
    font-size: 14px !important;
    font-weight: 500 !important;
    color: #1e1e1e !important;
    cursor: pointer;
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
}

/* Imagen del gateway (Wompi, etc.) — limitada a 80px */
.mn-checkout #payment ul.payment_methods li label img {
    max-height: 28px !important;
    width: auto !important;
    object-fit: contain !important;
}

/* Caja de descripción del método de pago */
.mn-checkout #payment .payment_box {
    background: #f7f9f8 !important;
    color: #222 !important;
    padding: 12px 14px !important;
    margin: 8px 0 0 0 !important;
    border-radius: 6px !important;
    font-size: 13px !important;
    line-height: 1.4 !important;
    border: 1px solid #ebf0ee !important;
    display: block !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

.mn-checkout #payment .payment_box::before {
    display: none !important;
    /* Quita la flechita */
}

/* Imagen dentro de payment_box (Wompi logo grande) */
.mn-checkout #payment .payment_box img {
    max-width: 120px !important;
    height: auto !important;
    display: block;
    margin: 0 0 8px 0;
}

/* =================== WOMPI ELEGANT FIX ====================== */
/* Forzar que el LI de Wompi sea un contenedor flex compacto para alinear TODO en una fila */
.mn-checkout #payment ul.payment_methods li.payment_method_wompi {
    display: flex !important;
    flex-wrap: nowrap !important; /* Forzar una sola fila */
    align-items: center !important;
    gap: 12px !important;
    padding: 10px 15px !important; /* Padding reducido */
}

/* Radio botón */
.mn-checkout #payment ul.payment_methods li.payment_method_wompi input[type="radio"] {
    margin: 0 !important;
    width: 20px !important;
    height: 20px !important;
    flex-shrink: 0;
}

/* Label (Nombre/Logo) */
.mn-checkout #payment ul.payment_methods li.payment_method_wompi label {
    margin: 0 !important;
    padding: 0 !important;
    width: auto !important;
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    flex-shrink: 0;
}

/* OCULTAR IMAGEN PRINCIPAL DE WOMPI (Solicitado por usuario) */
.mn-checkout #payment ul.payment_methods li.payment_method_wompi label img {
    display: none !important;
}

/* Texto del título (si existe) */
.mn-checkout #payment ul.payment_methods li.payment_method_wompi label span {
    color: #1e1e1e !important;
    font-size: 15px !important;
    font-weight: 700 !important;
}

/* La descripción se ajusta proporcionalmente */
.mn-checkout #payment ul.payment_methods li.payment_method_wompi .payment_box {
    flex: 1 1 auto !important;
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
    font-size: 14px !important;
    color: #555 !important;
    box-shadow: none !important;
    display: block !important;
    line-height: 1.4 !important;
}

.mn-checkout #payment ul.payment_methods li.payment_method_wompi .payment_box p {
    margin: 0 !important;
}

/* Banner de medios de pago con dimensiones exactas del usuario */
.mn-checkout #payment ul.payment_methods li.payment_method_wompi::after {
    content: "";
    display: block !important;
    width: 190px !important; 
    height: 170px; 
    background: url('http://mosquera.mecatonatural.com/wp-content/uploads/sites/4/2025/10/Pasarela-de-pagos-img-sin-fondo.png') no-repeat center right;
    background-size: contain;
    margin: 0 !important;
    flex-shrink: 0;
    order: 20;
}

/* Ajustes para móviles: Radio y Texto en una fila, Imagen abajo */
@media (max-width: 768px) {
    .mn-checkout #payment ul.payment_methods li.payment_method_wompi {
        flex-wrap: wrap !important;
        display: flex !important;
        align-items: center !important;
        padding: 15px !important;
        gap: 10px !important;
    }

    .mn-checkout #payment ul.payment_methods li.payment_method_wompi input[type="radio"] {
        flex: 0 0 auto !important;
    }

    /* Forzar que la descripción no ocupe todo el ancho para que quepa con el radio */
    .mn-checkout #payment ul.payment_methods li.payment_method_wompi .payment_box {
        flex: 1 !important;
        min-width: 200px !important; /* Permitir que se acomode al lado */
        margin: 0 !important;
    }

    /* Imagen ocupa toda la fila de abajo */
    .mn-checkout #payment ul.payment_methods li.payment_method_wompi::after {
        width: 100% !important;
        height: 140px; /* Un poco más de altura para mejor impacto en móvil */
        background-position: center;
        margin-top: 15px !important;
        order: 10; /* Se asegura de estar al final */
    }
}

/* ========= TÉRMINOS Y CONDICIONES ========================== */
.mn-checkout .woocommerce-terms-and-conditions-wrapper,
.mn-checkout .woocommerce-terms-and-conditions-wrapper p,
.mn-checkout .woocommerce-terms-and-conditions-wrapper span,
.mn-checkout .woocommerce-terms-and-conditions-wrapper label {
    padding: 0 !important;
    font-size: 13px !important;
    color: #333 !important;
    border: none !important;
    margin: 0 !important;
    line-height: 1.4 !important;
}

.mn-checkout .woocommerce-terms-and-conditions-wrapper a {
    color: #0C5736 !important;
    text-decoration: underline !important;
    font-weight: 700 !important;
}

.mn-checkout .woocommerce-terms-and-conditions-wrapper .woocommerce-form__label {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    font-size: 13px !important;
    line-height: 1.4 !important;
    cursor: pointer;
    margin: 15px 0 !important;
    padding: 0 !important;
    border: none !important;
}

/* Forzar que el checkbox sea visible y no tenga bordes extraños */
.mn-checkout .woocommerce-terms-and-conditions-wrapper input[type="checkbox"] {
    width: 18px !important;
    height: 18px !important;
    margin: 0 !important;
    flex-shrink: 0;
}

.mn-checkout .woocommerce-privacy-policy-text {
    font-size: 12px !important;
    color: #777 !important;
    margin-bottom: 8px !important;
    line-height: 1.4 !important;
}

/* Forzar color de texto en la caja de pago para evitar invisibilidad */
.mn-checkout #payment .payment_box p,
.mn-checkout #payment .payment_box span,
.mn-checkout #payment .payment_box {
    color: #222 !important;
}

.mn-checkout #payment .payment_box strong {
    color: #000 !important;
}

/* ========= BOTÓN REALIZAR PEDIDO ============================ */
.mn-checkout #place_order {
    width: 100% !important;
    padding: 16px 28px !important;
    background: #0C5736 !important; /* Verde principal actualizado */
    color: #fff !important;
    border: none !important;
    border-radius: 8px !important;
    font-size: 16px !important;
    font-weight: 700 !important;
    cursor: pointer !important;
    transition: background 0.2s, transform 0.1s !important;
    box-shadow: 0 4px 12px rgba(12, 87, 54, 0.2) !important;
    letter-spacing: 0.02em !important;
    text-transform: uppercase !important;
}

.mn-checkout #place_order:hover {
    background: #0a4a2e !important; /* Verde un poco más oscuro para el hover */
}

.mn-checkout #place_order:active {
    transform: scale(0.99) !important;
}

/* ================== CUPÓN / LOGIN ========================== */
.woocommerce-form-login-toggle,
.woocommerce-form-coupon-toggle {
    margin-bottom: 12px;
}

.mn-checkout .woocommerce-form-login,
.mn-checkout .checkout_coupon {
    background: #fff !important;
    border: 1px solid #e5e5e5 !important;
    border-radius: 10px !important;
    padding: 20px 24px !important;
    margin-bottom: 20px !important;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04) !important;
}

/* ============== ERRORES / AVISOS ============================ */
.mn-checkout .woocommerce-error,
.mn-checkout .woocommerce-message,
.mn-checkout .woocommerce-info {
    border-radius: 8px !important;
    font-size: 14px !important;
    padding: 14px 20px !important;
}

.mn-checkout .woocommerce-error {
    border-top-color: #d94f4f !important;
}

/* =================== RESPONSIVE ============================ */
@media (max-width: 991px) {
    .mn-checkout-grid {
        flex-direction: column;
        gap: 20px;
    }

    .mn-checkout-col-left {
        width: 100%;
    }

    .mn-checkout-col-right {
        width: 100%;
        flex: none;
        position: static;
        order: -1;
        /* Resumen arriba en móvil */
    }

    .mn-checkout .woocommerce-billing-fields__field-wrapper,
    .mn-checkout .woocommerce-shipping-fields__field-wrapper {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .mn-checkout-bg {
        padding: 15px 0 30px;
    }

    .mn-checkout {
        padding: 0 12px;
    }

    .mn-card {
        padding: 18px 16px;
        border-radius: 8px;
    }

    .mn-checkout-col-right .shop_table tbody td {
        padding: 10px 12px !important;
    }

    .mn-thumb-wrap {
        width: 44px;
        height: 44px;
    }

    .mn-order-thumb {
        width: 44px !important;
        height: 44px !important;
    }

    .mn-qty-badge {
        width: 17px;
        height: 17px;
        font-size: 10px;
        top: -4px;
        right: -4px;
    }
}