/* ── Skeleton de carga inicial ── */
#checkout-skeleton {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 30px;
    align-items: start;
}

@media (max-width: 1200px) {
    #checkout-skeleton {
        grid-template-columns: 1fr;
    }
}

.checkout-skeleton-left {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.skeleton-seccion {
    background: #fff;
    border-radius: 7px;
    padding: 30px;
    box-shadow: 0px 4px 4px 0px rgba(0, 0, 0, 0.25);
}

.skeleton-seccion-titulo {
    height: 22px;
    width: 42%;
    margin-bottom: 20px;
}

.skeleton-direccion-card {
    height: 60px;
    border-radius: 8px;
    margin-bottom: 10px;
}

.skeleton-field-full {
    height: 40px;
    border-radius: 6px;
    margin-bottom: 16px;
}

.skeleton-field-row {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.skeleton-field-sm {
    flex: 1;
    height: 40px;
    border-radius: 6px;
}

.skeleton-textarea {
    height: 80px;
    border-radius: 6px;
}

/* ── Grid: el form es transparente al grid del main ── */
#checkout-form {
    display: contents;
}

/* ── Loader de página completa ── */
#checkout-loader {
    grid-column: 1 / -1;
}

/* ── Nueva dirección ── */
.ctn_direccion_entrega_titulo_y_btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.btn_nueva_direccion_checkout {
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 0.9rem;
}

/* ── Loader / error del checkout ── */
.checkout-error-msg {
    background: #fff3f3;
    border: 1px solid #f5c6c6;
    border-radius: 8px;
    padding: 12px 16px;
    color: #c0392b;
    font-size: 0.9rem;
    margin-bottom: 16px;
}

/* ── Flex Microform fields ── */
.flex-field-group {
    margin-bottom: 16px;
}

.checkout-label {
    display: block;
    font-weight: 600;
    color: #031130;
    margin-bottom: 6px;
    font-size: 0.95rem;
}

.flex-field {
    border: 1px solid #ccd;
    border-radius: 6px;
    padding: 8px 10px;
    height: 40px;
    background: #fff;
    transition: border-color 0.2s;
}

.flex-field.focus {
    border-color: #0066B3;
    outline: none;
}

.flex-field.invalid {
    border-color: #c0392b;
}

.flex-field-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.flex-field-row .flex-field-group {
    flex: 1;
    min-width: 80px;
}

.checkout-input {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #ccd;
    border-radius: 6px;
    font-size: 0.9rem;
    box-sizing: border-box;
}

.checkout-input:focus {
    outline: none;
    border-color: #0066B3;
}

.checkout-input.invalid {
    border-color: #c0392b;
}

/* ── Botón pagar ── */
#btn-pagar {
    width: 100%;
    padding: 15px 20px;
    cursor: pointer;
    transition: background 0.2s, opacity 0.2s;
}

#btn-pagar:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ── Pedido parcial ── */
.checkout-consentimiento {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 0.85rem;
    color: #031130;
    cursor: pointer;
    line-height: 1.4;
}

.checkout-consentimiento input[type="checkbox"] {
    margin-top: 2px;
    flex-shrink: 0;
    accent-color: #0066B3;
    width: 16px;
    height: 16px;
    cursor: pointer;
}

/* ── Textarea comentarios ── */
#checkout-comentarios {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #ccd;
    border-radius: 6px;
    font-size: 0.9rem;
    resize: vertical;
    box-sizing: border-box;
}

#checkout-comentarios:focus {
    outline: none;
    border-color: #0066B3;
}

/* ── Dirección de entrega seleccionada ── */
.opcion-checkout-direccion {
    border: 1px solid #dde;
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 10px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.opcion-checkout-direccion:hover {
    background: #f5f8fc;
}

.opcion-checkout-direccion.seleccionada {
    background: #9EC8E640;
    border-color: #0066B3;
}

.opcion-checkout-direccion input[type="radio"] {
    margin-top: 3px;
    flex-shrink: 0;
}

/* ── Modal error de pago ── */
#modal-pago-error {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

#modal-pago-error .modal-receta-contenedor {
    background: #031130;
    color: #fff;
}

#modal-pago-error .modal-receta-descripcion {
    color: #fff;
    text-align: center;
}

.modal-pago-error-cerrar {
    position: absolute;
    top: 12px;
    right: 12px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 4px;
    line-height: 0;
}

.modal-pago-error-cerrar svg path {
    fill: #fff;
}

.modal-pago-error-lo-siento {
    font-weight: 700;
    color: #fff;
    margin-bottom: 8px;
    text-align: center;
}

/* ── Overlay 3DS ── */
#threeds-overlay {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: rgba(0, 0, 0, 0.65);
    display: flex;
    align-items: center;
    justify-content: center;
}

.threeds-modal {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    width: min(520px, 92vw);
    height: min(640px, 92vh);
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.threeds-modal-title {
    padding: 16px 20px;
    font-weight: 700;
    color: #031130;
    border-bottom: 1px solid #eee;
    margin: 0;
    font-size: 1rem;
}

#threeds-iframe {
    flex: 1;
    border: none;
    width: 100%;
}
