/* =========================================
   CHECKOUT ULTRA PRO (Estilo Shopify)
   ========================================= */
html, body {
    overflow-x: hidden; /* Corta cualquier cosa que se salga de ancho */
    width: 100%;
    position: relative;
}
body {
    background-color: #fff;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    color: #333;
    margin: 0;
    overflow-x: hidden;
}

/* Layout Principal: Pantalla Partida */
.checkout-layout {
    display: flex;
    flex-wrap: wrap;
    min-height: 100vh;
}

/* --- COLUMNA IZQUIERDA (FORMULARIO) --- */
.checkout-main {
    flex: 1; /* Ocupa el espacio restante (aprox 55-60%) */
    padding: 50px 5%;
    background: #fff;
    border-right: 1px solid #e6e6e6;
    display: flex;
    justify-content: flex-end; /* Alinea el contenido hacia el centro de la pantalla */
}

.main-content {
    max-width: 600px; /* Ancho máximo para que no se estire */
    width: 100%;
}

/* Header Minimalista */
.checkout-header {
    margin-bottom: 40px;
    text-align: left;
}

.checkout-logo img {
    height: 50px; /* Logo discreto pero visible */
    margin-bottom: 20px;
    display: block;
}

/* Breadcrumbs (Migas de pan) */
.breadcrumb {
    padding: 0;
    margin: 0;
    background: transparent;
    font-size: 0.85rem;
}

.breadcrumb-item a {
    color: var(--brand-blue, #0852a1);
    text-decoration: none;
    transition: color 0.2s;
}

.breadcrumb-item a:hover {
    color: var(--brand-accent, #ff9800);
}

.breadcrumb-item.active {
    color: #333;
    font-weight: 600;
}

/* Títulos de Sección */
.section-title {
    font-size: 1.15rem;
    font-weight: 600;
    margin-bottom: 20px;
    color: #1a1a1a;
}

/* Inputs Modernos (Floating Labels de Bootstrap tuneados) */
.form-floating > .form-control {
    border-radius: 8px;
    border: 1px solid #d9d9d9;
    box-shadow: none;
    height: 50px;
    font-size: 0.95rem;
}

.form-floating > label {
    padding-top: 0.85rem;
    color: #777;
    font-size: 0.9rem;
}

.form-floating > .form-control:focus {
    border-color: var(--brand-blue, #0852a1);
    box-shadow: 0 0 0 4px rgba(8, 82, 161, 0.1); /* Brillo azul suave */
}

/* Selector de Pagos (Cajas Seleccionables) */
.payment-selector {
    border: 1px solid #d9d9d9;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 20px;
}

.payment-option {
    position: relative;
    border-bottom: 1px solid #d9d9d9;
    transition: background 0.2s;
}

.payment-option:last-child {
    border-bottom: none;
}

/* Estilo cuando está seleccionado (el input radio busca al padre) */
.payment-option:has(.form-check-input:checked) {
    background-color: #f4f9ff; /* Fondo azul muy clarito */
    border-color: var(--brand-blue, #0852a1);
    z-index: 1;
}

.payment-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 20px 18px 50px; /* Espacio para el radio button */
    cursor: pointer;
    width: 100%;
    margin: 0;
}

.payment-option .form-check-input {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    margin: 0;
    cursor: pointer;
}

.payment-icons {
    display: flex;
    gap: 8px;
    color: #666;
    font-size: 1.2rem;
}

/* Acciones Finales */
.checkout-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.return-link {
    color: var(--brand-blue, #0852a1);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: color 0.2s;
}

.return-link:hover {
    color: #053a75;
}

.btn-pay-now {
    background-color: var(--brand-blue, #0852a1);
    color: #fff;
    padding: 18px 35px;
    border: none;
    border-radius: 8px;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.btn-pay-now:hover {
    background-color: #053a75; /* Azul más oscuro */
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.2);
}

.checkout-footer-mini {
    margin-top: 50px;
    border-top: 1px solid #eee;
    padding-top: 20px;
    font-size: 0.8rem;
    color: #999;
}

/* --- COLUMNA DERECHA (RESUMEN / SIDEBAR) --- */
.checkout-sidebar {
    flex: 0 0 42%; /* Ancho fijo del 42% */
    background: #fafafa; /* Gris muy suave */
    border-left: 1px solid #e6e6e6;
    padding: 50px 5%;
}

.sidebar-content {
    max-width: 450px;
    position: sticky; /* EFECTO CLAVE: Se queda fijo al scrollear */
    top: 40px;
}

/* Lista de Productos */
.order-items {
    max-height: 400px; /* Si hay muchos, scrollea solo esta parte */
    overflow-y: auto;
    padding-right: 10px; /* Espacio para scrollbar */
}

/* Scrollbar fina para la lista */
.order-items::-webkit-scrollbar {
    width: 4px;
}
.order-items::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}

.order-item {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
}

/* Miniatura del producto (Estilo Shopify) */
.item-thumbnail {
    position: relative;
    width: 64px;
    height: 64px;
}

.img-wrapper {
    width: 100%;
    height: 100%;
    background: #fff;
    border: 1px solid #e6e6e6;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.img-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* Recorta para llenar el cuadro */
}

/* La burbuja con la cantidad */
.item-qty {
    position: absolute;
    top: -10px;
    right: -10px;
    background: #666; /* Gris oscuro / negro */
    color: #fff;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    font-size: 0.75rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

.item-details {
    flex: 1; /* Ocupa el espacio medio */
}

.item-name {
    font-weight: 600;
    font-size: 0.95rem;
    margin: 0;
    color: #333;
}

.item-desc {
    font-size: 0.8rem;
    color: #777;
    margin: 0;
}

.item-price {
    font-weight: 600;
    color: #333;
    font-size: 0.95rem;
}

/* Separadores */
.divider {
    border-top: 1px solid #e1e1e1;
    margin: 25px 0;
    opacity: 1;
}

/* Código de Descuento */
.discount-code {
    display: flex;
    gap: 10px;
}

.discount-code .form-control {
    border-radius: 8px;
    border: 1px solid #d9d9d9;
}

.discount-code .btn {
    border-radius: 8px;
    font-weight: 600;
    padding: 0 20px;
    background-color: #e6e6e6;
    border: none;
    color: #555;
    transition: all 0.2s;
}

.discount-code .btn:hover {
    background-color: #d4d4d4;
    color: #333;
}

/* Totales */
.order-totals {
    color: #555;
}

.total-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
    font-size: 0.95rem;
}

.total-final {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e6e6e6;
    color: #333;
    font-size: 1.3rem;
    font-weight: 700;
    align-items: center;
}

.total-final small {
    font-size: 0.8rem;
    color: #999;
    font-weight: 400;
    margin-right: 5px;
    vertical-align: middle;
}

/* === RESPONSIVE (Celular) === */
@media (max-width: 991px) {
    .checkout-layout {
        flex-direction: column-reverse; /* En celular, el resumen suele ir arriba o colapsado, acá lo ponemos abajo para priorizar form */
        /* O podemos dejarlo normal: column. */
        flex-direction: column;
    }

    /* Ocultamos el borde y ajustamos anchos */
    .checkout-main {
        border-right: none;
        padding: 30px 20px;
    }

    .checkout-sidebar {
        width: 100%;
        border-left: none;
        border-bottom: 1px solid #e6e6e6; /* Separador abajo del resumen */
        background: #fdfdfd; /* Un gris aún más suave en mobile */
        padding: 20px;
        order: -1; /* Forzamos que el resumen aparezca PRIMERO en el HTML visual */
    }
    
    .sidebar-content {
        position: static; /* Ya no es sticky en celular */
    }

    /* Ajuste para que el logo no quede gigante */
    .checkout-logo img {
        height: 40px;
    }
}