/* Variables de estilo Matisa */
:root {
    --primary-color: #000000;
    --accent-color: #D4AF37; 
    --bg-color: #f8f9fa;
    --card-bg: #ffffff;
    --text-main: #2d3436;
    --text-muted: #636e72;
    --border-radius: 16px;
    --shadow: 0 10px 30px rgba(0,0,0,0.05);
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
}

.checkout-container {
    max-width: 1100px;
    margin: 40px auto;
    padding: 0 15px;
}

/* --- GRID PRINCIPAL (Crucial para el orden) --- */
.checkout-grid {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 30px;
    align-items: start; /* Mantiene el aside arriba */
}

/* --- ENCABEZADO --- */
.checkout-header-main {
    text-align: center;
    margin-bottom: 40px;
}

.badge-final {
    background: var(--accent-color);
    color: #000;
    padding: 5px 15px;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.checkout-header-main h1 {
    font-size: 2.2rem;
    font-weight: 900;
    margin: 15px 0 5px 0;
    color: #000;
}

/* --- FORMULARIO Y BLOQUES --- */
.checkout-form-section {
    width: 100%;
    grid-column: 1;
}

.checkout-summary-section {
    grid-column: 2;
}

.form-block {
    background: var(--card-bg);
    padding: 30px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    margin-bottom: 25px;
    border: 1px solid rgba(0,0,0,0.03);
}

/* Botón Necesitás Factura */
.billing-toggle-container {
    margin-top: 20px;
}

.btn-secondary-outline {
    background: none;
    border: 2px solid #edf2f7;
    color: var(--text-muted);
    padding: 10px 20px;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-action {
    position: relative;
    z-index: 10; /* Asegura que estén por encima de cualquier resto del form */
    cursor: pointer !important;
    user-select: none;
}

.stock-warning-text {
    display: block;
    background: #fff5f5;
    color: #c53030;
    padding: 15px;
    border-radius: 10px;
    border: 1px solid #feb2b2;
    margin-top: 15px;
    font-weight: 600;
    line-height: 1.4;
    text-align: center;
}

.btn-secondary-outline:hover, .btn-secondary-outline.active {
    border-color: var(--accent-color);
    color: var(--primary-color);
    background: #fffdf0;
}

/* Grilla desplegable */
.invoice-details-grid {
    margin-top: 20px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 12px;
    border: 1px dashed #cbd5e0;
    transition: all 0.4s ease;
}

.invoice-details-grid select {
    width: 100%;
    padding: 14px 18px;
    border: 2px solid #edf2f7;
    border-radius: 12px;
    font-size: 1rem;
    background: #fff;
}

/* --- SELECTOR DE MÉTODOS (Botones modernos) --- */
.delivery-selector {
    display: flex;
    gap: 15px;
    margin: 20px 0 30px 0;
}

.method-option {
    flex: 1;
    cursor: pointer;
}

.method-option input {
    display: none; /* Escondemos el radio button original */
}

.method-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    border: 2px solid #edf2f7;
    border-radius: 16px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: #fff;
    color: #636e72;
    text-align: center;
}

.method-box i {
    font-size: 1.8rem;
    margin-bottom: 10px;
    transition: transform 0.3s ease;
}

.method-box span {
    font-weight: 700;
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Efecto al seleccionar */
.method-option input:checked + .method-box {
    border-color: var(--primary-color);
    background: var(--primary-color);
    color: #fff;
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
}

.method-option input:checked + .method-box i {
    color: var(--accent-color); /* El icono se pone dorado */
    transform: translateY(-3px);
}

.method-option:hover .method-box {
    border-color: var(--accent-color);
    transform: translateY(-2px);
}

/* --- ESTILOS DEL MAPA Y SUCURSAL --- */
#mapa-sucursales {
    width: 100%;
    height: 350px;
    border-radius: 16px;
    border: 1px solid #ddd;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.sucursal-info-text {
    background: #fffdf0; /* Un crema sutil */
    padding: 18px;
    border-radius: 12px;
    border-left: 5px solid var(--accent-color);
    margin-top: 15px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 600;
    color: #2d3436;
    animation: slideIn 0.4s ease;
}

.sucursal-info-text i {
    color: var(--accent-color);
    font-size: 1.2rem;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(-10px); }
    to { opacity: 1; transform: translateX(0); }
}

/* --- SECCIÓN DE PAGO (TRANSICIÓN FINAL) --- */
/* Ajustada para que herede el espacio del formulario */
#payment-section {
    display: none; 
    opacity: 0;
    background: #fff;
    padding: 30px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    text-align: center;
    width: 100%;
    box-sizing: border-box;
    margin-bottom: 30px; /* Separación si hay otros elementos debajo */
}

.payment-header i { font-size: 3.5rem; color: #2ecc71; margin-bottom: 20px; }
.bank-card {
    border: 2px solid var(--accent-color);
    background: #fffdf0;
    padding: 25px;
    border-radius: 12px;
    margin: 25px 0;
    text-align: left;
}

/* --- RESUMEN (COLUMNA DERECHA) --- */
.summary-card {
    background: var(--primary-color);
    color: #fff;
    padding: 25px;
    border-radius: var(--border-radius);
    position: sticky;
    top: 20px;
    z-index: 10;
}

.summary-row.total {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--accent-color);
    border-top: 1px solid rgba(255,255,255,0.1);
    padding-top: 15px;
}

.summary-line {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    color: #ccc;
    font-size: 0.95rem;
}

/* El texto verde del ahorro */
.discount-text {
    color: #2ecc71 !important;
    font-weight: 500;
}

/* Fila del Total Final */
.total-row {
    color: #fff;
    font-weight: bold;
    font-size: 1.1rem;
    align-items: center;
}

.final-price {
    color: #D4AF37;
    font-size: 1.4rem;
}

/* Contenedor de cada fila de producto */
.checkout-item-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1); /* Línea divisoria sutil */
    gap: 15px;
}

/* Columna 1: Foto */
.col-img {
    flex: 0 0 50px; /* Ancho fijo para la imagen */
}

.col-img img {
    width: 50px;
    height: 50px;
    object-fit: contain;
    background: white; /* Para que resalte sobre el fondo negro */
    border-radius: 6px;
}

/* Columna 2: Nombre (La más ancha) */
.col-name {
    flex: 1; /* Ocupa el espacio restante */
    color: #fff;
    font-size: 0.9rem;
    line-height: 1.2;
}

/* Columna 3: Cantidad */
.col-qty {
    flex: 0 0 40px;
    color: #D4AF37; /* Color dorado para que resalte */
    font-weight: bold;
    text-align: center;
}

/* Columna 4: Precio */
.col-price {
    flex: 0 0 90px;
    text-align: right;
    color: #fff;
    font-weight: 600;
}

/* Ajuste para el texto del total */
.summary-totals {
    margin-top: 10px;
    padding-top: 15px;
}

/* --- BOTONES --- */
.btn-confirm-checkout {
    width: 100%;
    padding: 20px;
    background-color: #ffffff;
    color: #000;
    border: 1px solid;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    text-transform: uppercase;
    transition: 0.3s;
}

.btn-confirm-checkout:hover {
    background-color: #f0f0f0;
    color: #000000;
}

/* --- ARREGLO DE BOTONES (Para que no se vean amontonados) --- */
.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px; /* Espacio real entre botones */
    margin-top: 25px;
    width: 100%;
}

.btn-action {
    display: flex !important; /* Forzamos el modo flex */
    align-items: center;
    justify-content: center;
    padding: 18px !important;
    width: 100% !important;
    border-radius: 12px;
    font-weight: 700;
    text-decoration: none;
    border: none;
    cursor: pointer;
}

.btn-action i {
    font-size: 1.3rem;
    margin-right: 10px;
}

.btn-action.whatsapp { background: #25d366; color: #fff; }
.btn-action.email { background: #333; color: #fff; }

/* --- ANIMACIONES --- */
.fade-in-up {
    animation: fadeInUp 0.7s forwards cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- RESPONSIVE (MOBILE) --- */
@media (max-width: 992px) {
    .checkout-container { margin: 20px auto; }
    
    .checkout-grid {
        display: flex;
        flex-direction: column; /* Apilamos en mobile */
    }

    .checkout-summary-section {
        width: 100%;
        margin-bottom: 20px;
    }

    .summary-card {
        position: static; /* Quitamos el sticky para que no flote en mobile */
    }

    .checkout-header-main h1 { font-size: 1.8rem; }
    
    .form-block { padding: 20px; }
    
    /* Ajuste para los campos del formulario en mobile para que no se vean apretados */
    .form-row {
        display: flex;
        flex-direction: column;
        gap: 0;
    }
}