/* ═══════════════════════════════════════════════════════════════
   checkout.css — Formulario de finalización de pedido
   ═══════════════════════════════════════════════════════════════ */

/* ── Contenedor principal ────────────────────────────────────── */
.chk {
    max-width: 1060px;
    margin: 0 auto;
    padding: 1.5rem 1rem 4rem;
}

/* ── Encabezado ──────────────────────────────────────────────── */
.chk__header {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    margin-bottom: 1.75rem;
    padding-bottom: 1.25rem;
    border-bottom: 1.5px solid #f0f0f0;
}

.chk__volver {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--color-primario);
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    font-family: var(--font);
    transition: gap .15s;
    flex-shrink: 0;
}

.chk__volver:hover { gap: 0.6rem; }

.chk__titulo {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--color-texto);
    margin: 0;
    letter-spacing: -.02em;
}

/* ── Layout dos columnas ─────────────────────────────────────── */
.chk__layout {
    display: grid;
    grid-template-columns: 1fr 22rem;
    gap: 2rem;
    align-items: start;
}

/* ── Formulario (columna izquierda) ──────────────────────────── */
.chk__form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

/* ── Secciones ───────────────────────────────────────────────── */
.chk__seccion {
    background: #fff;
    border: 1.5px solid #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
}

.chk__seccion-titulo {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    font-size: 0.9375rem;
    font-weight: 700;
    color: var(--color-texto);
    margin: 0;
    padding: 1rem 1.25rem;
    border-bottom: 1.5px solid #f0f0f0;
    letter-spacing: -.01em;
}

.chk__seccion-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
    background: var(--color-primario);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
    flex-shrink: 0;
}

.chk__seccion-opt {
    font-size: 0.75rem;
    font-weight: 400;
    color: #9ca3af;
    margin-left: 0.25rem;
}

.chk__seccion-cuerpo {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.875rem;
}

/* ── Campos de formulario ────────────────────────────────────── */
.chk__campo-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.chk__field { display: flex; flex-direction: column; gap: 0.35rem; }
.chk__field--full { grid-column: 1 / -1; }

.chk__label {
    font-size: 0.78rem;
    font-weight: 600;
    color: #374151;
}

.chk__req { color: #ef4444; margin-left: 0.1rem; }

.chk__input,
.chk__select,
.chk__textarea {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1.5px solid #e5e7eb;
    border-radius: 8px;
    font-size: 0.875rem;
    font-family: var(--font);
    color: var(--color-texto);
    background: #fff;
    transition: border-color .15s, box-shadow .15s;
    outline: none;
    box-sizing: border-box;
}

.chk__input:focus,
.chk__select:focus,
.chk__textarea:focus {
    border-color: var(--color-primario);
    box-shadow: 0 0 0 3px rgba(37,99,235,.08);
}

.chk__input--error { border-color: #ef4444; }
.chk__input--error:focus { box-shadow: 0 0 0 3px rgba(239,68,68,.08); }

.chk__input--locked {
    background: #f9fafb;
    color: #6b7280;
    cursor: default;
}

.chk__select { cursor: pointer; }
.chk__textarea { resize: vertical; min-height: 5rem; }

.chk__error {
    font-size: 0.72rem;
    color: #ef4444;
    font-weight: 500;
}

.chk__error--block { display: block; margin-top: 0.25rem; }

/* ── Alerta global ───────────────────────────────────────────── */
.chk__alerta {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.75rem 1rem;
    border-radius: 9px;
    font-size: 0.8125rem;
    font-weight: 500;
    margin-bottom: 1.25rem;
}

.chk__alerta--error {
    background: #fef2f2;
    border: 1.5px solid #fecaca;
    color: #b91c1c;
}

/* ── Indicador visual de radio ───────────────────────────────── */
.chk__metodo-check {
    width: 1rem;
    height: 1rem;
    border-radius: 50%;
    border: 2px solid #d1d5db;
    flex-shrink: 0;
    transition: border-color .15s, background .15s;
    position: relative;
}

.chk__metodo-check--sel {
    border-color: var(--color-primario);
    background: var(--color-primario);
}

.chk__metodo-check--sel::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 0.35rem;
    height: 0.35rem;
    border-radius: 50%;
    background: #fff;
}

/* ── Opción minimalista (entrega y pago) ─────────────────────── */
.chk__envio {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    border: 1.5px solid #e5e7eb;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,.05);
    cursor: pointer;
    transition: border-color .15s, box-shadow .15s, background .15s;
    text-align: left;
    width: 100%;
    font-family: var(--font);
}

.chk__envio:hover {
    border-color: #c0c8d4;
    box-shadow: 0 2px 6px rgba(0,0,0,.08);
}

.chk__envio--sel {
    border-color: var(--color-primario);
    background: #f0f6ff;
    box-shadow: 0 0 0 3px rgba(37,99,235,.08);
}

.chk__metodo-check { margin-top: 0.1rem; }

.chk__envio-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.chk__envio-nombre {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--color-texto);
    line-height: 1.3;
}

.chk__envio-desc {
    font-size: 0.8125rem;
    color: #4b5563;
    line-height: 1.55;
}

.chk__envio-desc p { margin: 0; }
.chk__envio-desc ul { margin: 0.2rem 0 0 1rem; padding: 0; }
.chk__envio-desc li { margin-bottom: 0.1rem; }
.chk__envio-desc strong { font-weight: 600; color: var(--color-texto); }

.chk__envio-costo {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--color-texto);
    white-space: nowrap;
    flex-shrink: 0;
    margin-top: 0.05rem;
}

/* ── Dirección dentro del método de entrega ──────────────────── */
.chk__dir-envio {
    margin-top: 0.25rem;
    padding-top: 1rem;
    border-top: 1.5px dashed #e5e7eb;
}

/* ── Radio card: método de entrega (legacy, sin uso) ─────────── */
.chk__metodo {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 0.875rem 1rem;
    border: 1.5px solid #e5e7eb;
    border-radius: 9px;
    cursor: pointer;
    transition: border-color .15s, background .15s;
    user-select: none;
}

.chk__metodo:hover { border-color: #9ca3af; }

.chk__metodo--sel {
    border-color: var(--color-primario);
    background: #eff6ff;
}

.chk__metodo-radio { display: none; }

.chk__metodo-icono {
    font-size: 1.25rem;
    flex-shrink: 0;
    width: 2rem;
    text-align: center;
}

.chk__metodo-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.chk__metodo-nombre {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--color-texto);
}

.chk__metodo-desc {
    font-size: 0.73rem;
    color: #6b7280;
    line-height: 1.4;
}

.chk__metodo-costo {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--color-texto);
    flex-shrink: 0;
    white-space: nowrap;
}

.chk__metodo-costo--gratis { color: #16a34a; }

/* ── Radio card: método de pago ─────────────────────────────── */
.chk__pago {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 0.875rem 1rem;
    border: 1.5px solid #e5e7eb;
    border-radius: 9px;
    cursor: pointer;
    transition: border-color .15s, background .15s;
    user-select: none;
}

.chk__pago:hover { border-color: #9ca3af; }

.chk__pago--sel {
    border-color: var(--color-primario);
    background: #eff6ff;
}

.chk__pago-img {
    width: 2.5rem;
    height: 2.5rem;
    object-fit: contain;
    border-radius: 6px;
    border: 1px solid #f0f0f0;
    flex-shrink: 0;
}

.chk__pago-icono {
    font-size: 1.5rem;
    width: 2.5rem;
    text-align: center;
    flex-shrink: 0;
}

.chk__pago-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.chk__pago-nombre {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--color-texto);
}

.chk__pago-desc {
    font-size: 0.73rem;
    color: #6b7280;
    line-height: 1.4;
}

.chk__pago-ref-badge {
    font-size: 0.65rem;
    font-weight: 700;
    color: #b45309;
    background: #fef3c7;
    border-radius: 4px;
    padding: 0.15rem 0.5rem;
    white-space: nowrap;
    flex-shrink: 0;
}

.chk__sin-opciones {
    font-size: 0.875rem;
    color: #9ca3af;
    margin: 0;
}

.chk__sin-opciones--error {
    color: #b91c1c;
    background: #fef2f2;
    border: 1.5px solid #fecaca;
    border-radius: 7px;
    padding: 0.625rem 0.875rem;
    font-size: 0.8125rem;
}

/* ── Resumen (columna derecha) ───────────────────────────────── */
.chk__resumen {
    background: #fff;
    border: 1.5px solid #e5e7eb;
    border-radius: 14px;
    padding: 1.375rem 1.25rem;
    position: sticky;
    top: calc(var(--navbar-h) + 1rem);
}

.chk__resumen-titulo {
    font-size: 0.9375rem;
    font-weight: 700;
    color: var(--color-texto);
    margin: 0 0 1rem;
}

/* ── Items en el resumen ─────────────────────────────────────── */
.chk__resumen-items {
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
    margin-bottom: 0.5rem;
}

.chk__resumen-item {
    display: flex;
    align-items: center;
    gap: 0.625rem;
}

.chk__resumen-img {
    position: relative;
    width: 2.5rem;
    height: 2.5rem;
    flex-shrink: 0;
}

.chk__resumen-img-el {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid #f0f0f0;
}

.chk__resumen-img-ph {
    width: 100%;
    height: 100%;
    background: #f4f4f5;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #d1d5db;
}

.chk__resumen-qty {
    position: absolute;
    top: -0.35rem;
    right: -0.35rem;
    background: #374151;
    color: #fff;
    font-size: 0.6rem;
    font-weight: 700;
    border-radius: 99px;
    min-width: 1.1rem;
    height: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 0.2rem;
    line-height: 1;
}

.chk__resumen-variante {
    display: block;
    font-size: 0.72rem;
    font-weight: 400;
    color: var(--color-texto-muted);
}

.chk__resumen-nombre {
    flex: 1;
    font-size: 0.8rem;
    color: var(--color-texto);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chk__resumen-precio {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--color-texto);
    white-space: nowrap;
    flex-shrink: 0;
}

/* ── Líneas de totales ───────────────────────────────────────── */
.chk__resumen-sep {
    border: none;
    border-top: 1.5px solid #f0f0f0;
    margin: 0.875rem 0;
}

.chk__resumen-linea {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 0.5rem;
}

.chk__resumen-label {
    font-size: 0.8125rem;
    color: #6b7280;
}

.chk__resumen-valor {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--color-texto);
}

.chk__resumen-total {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 1.1rem;
}

.chk__resumen-total-label {
    font-size: 0.9375rem;
    font-weight: 700;
    color: var(--color-texto);
}

.chk__resumen-total-valor {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--color-texto);
    letter-spacing: -.02em;
}

/* ── Botón confirmar ─────────────────────────────────────────── */
.chk__btn-confirmar {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: #111827;
    color: #fff;
    border: none;
    border-radius: 9px;
    font-size: 0.9375rem;
    font-weight: 700;
    font-family: var(--font);
    cursor: pointer;
    transition: background .15s, opacity .15s;
}

.chk__btn-confirmar:hover:not(:disabled) { background: #1f2937; }
.chk__btn-confirmar:disabled,
.chk__btn-confirmar--loading { opacity: .6; cursor: not-allowed; }

.chk__resumen-aviso {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    margin-top: 0.875rem;
    font-size: 0.72rem;
    color: #9ca3af;
}

/* ── Botón "Completar orden" activo en el carrito ────────────── */
.cr-btn-orden--activo {
    cursor: pointer;
    opacity: 1;
    background: #111827;
}

.cr-btn-orden--activo:hover { background: #1f2937; }

/* ── Móvil ───────────────────────────────────────────────────── */
@media (max-width: 780px) {
    .chk {
        padding: 1.25rem 0 3rem;
    }

    .chk__header {
        padding: 0 1rem 1.25rem;
    }

    .chk__alerta {
        margin: 0 1rem 1.25rem;
    }

    .chk__layout {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .chk__resumen {
        position: static;
        order: -1;
        border-radius: 0;
        border-left: none;
        border-right: none;
    }

    .chk__seccion {
        border-radius: 0;
        border-left: none;
        border-right: none;
    }
}

/* ── Ítems no disponibles en resumen de checkout ─────────────── */
.chk__resumen-aviso-nd {
    display: flex;
    align-items: flex-start;
    gap: 0.375rem;
    background: #fff7ed;
    border: 1px solid #fed7aa;
    border-radius: 6px;
    padding: 0.5rem 0.625rem;
    font-size: 0.75rem;
    color: #92400e;
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

.dark .chk__resumen-aviso-nd {
    background: rgb(67 20 7 / .25);
    border-color: rgb(154 52 18 / .4);
    color: #fdba74;
}

.chk__resumen-item--nd {
    pointer-events: none;
}

.chk__resumen-nd-badge {
    display: inline-block;
    font-style: normal;
    font-size: 0.65rem;
    font-weight: 600;
    color: #ef4444;
    text-decoration: none;
    letter-spacing: .01em;
    text-transform: uppercase;
}

@media (max-width: 640px) {
    .chk__campo-grid { grid-template-columns: 1fr; }
    .chk__seccion-cuerpo { padding: 1rem; }
}

/* ── Modal de confirmación de datos ─────────────────────────── */
.conf-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.48);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9900;
    padding: 1rem;
}

.conf-modal {
    background: #fff;
    border-radius: 16px;
    width: 100%;
    max-width: 440px;
    padding: 1.625rem 1.5rem 1.375rem;
    box-shadow: 0 10px 48px rgba(0,0,0,.2);
    display: flex;
    flex-direction: column;
    gap: 1.125rem;
}

.conf-modal__header {
    display: flex;
    align-items: flex-start;
    gap: 0.875rem;
}

.conf-modal__icono {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    background: #eff6ff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #2563eb;
}

.conf-modal__titulos { flex: 1; }

.conf-modal__titulo {
    font-size: 1rem;
    font-weight: 700;
    color: #111827;
    margin: 0 0 0.25rem;
    line-height: 1.3;
}

.conf-modal__sub {
    font-size: 0.8125rem;
    color: #6b7280;
    margin: 0;
    line-height: 1.45;
}

.conf-modal__datos {
    background: #f9fafb;
    border: 1.5px solid #e5e7eb;
    border-radius: 10px;
    padding: 0.875rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.conf-dato {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.5rem;
    font-size: 0.8125rem;
}

.conf-dato__label {
    color: #6b7280;
    font-weight: 500;
    flex-shrink: 0;
}

.conf-dato__valor {
    color: #111827;
    font-weight: 600;
    text-align: right;
    word-break: break-word;
}

.conf-modal__sep {
    border: none;
    border-top: 1.5px solid #e5e7eb;
    margin: 0.125rem 0;
}

.conf-modal__total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    font-weight: 600;
    color: #374151;
    padding: 0.25rem 0;
}

.conf-modal__total-valor {
    font-size: 1.25rem;
    font-weight: 800;
    color: #111827;
    letter-spacing: -.025em;
}

.conf-modal__acciones {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.625rem;
}

.conf-modal__btn-editar {
    padding: 0.65rem 1rem;
    border: 1.5px solid #e5e7eb;
    border-radius: 9px;
    background: #fff;
    font-size: 0.875rem;
    font-weight: 600;
    font-family: var(--font);
    color: #374151;
    cursor: pointer;
    transition: border-color .15s, background .15s;
}

.conf-modal__btn-editar:hover { border-color: #9ca3af; background: #f9fafb; }

.conf-modal__btn-ok {
    padding: 0.65rem 1rem;
    border: none;
    border-radius: 9px;
    background: #111827;
    font-size: 0.875rem;
    font-weight: 700;
    font-family: var(--font);
    color: #fff;
    cursor: pointer;
    transition: background .15s, opacity .15s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
}

.conf-modal__btn-ok:hover:not(:disabled) { background: #1f2937; }
.conf-modal__btn-ok:disabled { opacity: .65; cursor: not-allowed; }

@media (max-width: 480px) {
    .conf-modal { padding: 1.375rem 1.125rem 1.25rem; }
    .conf-modal__acciones { grid-template-columns: 1fr; }
    .conf-modal__btn-ok { order: -1; }
}
