:root {
    --primary-color: #06b6d4; /* Color base (Cyan) */
    --card-bg: #fff;
    --shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    --red-btn: #dc3545;
    --green-btn: #28a745;
    --gray-btn: #6c757d;
}

body {
    font-family: sans-serif;
    background-color: #f4f7f6;
    margin: 0;
    padding: 20px;
}

/* --- ESTILOS GLOBALES Y ENCABEZADO --- */
.page-header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 10px;
    border-bottom: 1px solid #ddd;
}

.page-header h1 {
    font-size: 2em; /* Título principal grande */
    margin: 0 0 5px 0;
}

.page-header p {
    font-size: 1.1em; /* Subtítulo más pequeño */
    color: #555;
    margin: 0;
}


/* Estructura principal con CSS Grid */
.main-container {
    display: grid;
    grid-template-columns: 3fr 1fr; /* Columna de productos (3) y columna de carrito (1) */
    gap: 20px;
    max-width: 1400px;
    margin: 0 auto;
}

/* El área de productos y el área adicional se agrupan */
.productos-container {
    grid-column: 1 / 2;
    display: grid;
    grid-template-columns: repeat(2, 1fr); /* Dos columnas en pantallas grandes */
    gap: 20px;
    margin-bottom: 20px;
}

.carrito-lateral {
    grid-column: 2 / 3;
    background-color: var(--card-bg);
    border-radius: 10px;
    padding: 20px;
    box-shadow: var(--shadow);
    height: fit-content; 
    position: sticky; 
    top: 20px;
}

/* Contenedor para Despacho y Términos (debajo de las 2 columnas de productos) */
.adicional-container {
    grid-column: 1 / 2;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.despacho-option, .terminos-condiciones {
    background-color: var(--card-bg);
    padding: 20px;
    border-radius: 10px;
    box-shadow: var(--shadow);
}

/* --- ESTILOS DE PRODUCTOS --- */
.product-card {
    background-color: var(--card-bg);
    border-radius: 10px;
    padding: 20px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.product-image-container {
    padding: 10px;
    margin-bottom: 10px;
    background-color: #f0f0f0; 
    border-radius: 8px;
}

.product-card img {
    width: 80px;
    height: 80px;
    object-fit: contain;
}

.product-info {
    width: 100%;
    margin-top: 10px;
}

/* Disminuir la separación entre name, code y para */
.product-info h3 {
    margin: 5px 0 2px 0; /* Menos margen inferior */
    font-size: 1.1em;
}

.product-info p {
    margin: 1px 0; /* Margen muy pequeño */
    font-size: 0.9em;
    color: #666;
}

/* Estilo del Precio (Rectángulo Azul/Cyan) */
.price-display {
    width: 90%; 
    margin: 15px 0;
    padding: 10px;
    border-radius: 8px;
    color: #fff; /* Letra blanca */
    font-size: 1.4em; /* Letra más grande */
    font-weight: bold; /* Bold */
    text-shadow: 1px 1px 2px rgba(0,0,0,0.2); 
    background: linear-gradient(90deg, #6c5ce7, var(--primary-color)); 
}

/* --- BOTONES DE CANTIDAD (+/-) --- */
.counter-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 10px 0;
    gap: 20px; /* Separar los botones del número central */
}

/* Estilo del display central */
.counter-display {
    font-size: 1.5em; /* Numeral más grande */
    font-weight: bold;
    width: 30px; 
    text-align: center;
    padding: 0 10px; 
}

.counter-controls button {
    border-radius: 50%;
    width: 35px; /* Botón más grande */
    height: 35px;
    font-size: 1.4em; /* Signo más grande */
    cursor: pointer;
    transition: opacity 0.2s;
}

/* Botón - (Menos): Redondo, Blanco, Signo Negro */
.counter-controls button[data-action="decrease"] {
    background-color: white; 
    color: black; 
    border: 1px solid #ccc; 
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Botón + (Más): Redondo, Negro, Signo Blanco */
.counter-controls button[data-action="increase"] {
    background-color: black; 
    color: white; 
    border: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.counter-controls button:hover {
    opacity: 0.8;
}

.subtotal-display {
    margin-top: 10px;
    font-size: 1em;
    color: #555;
}

/* --- ESTILOS DE CARRITO/DETALLE --- */
.carrito-lateral h2 {
    margin-top: 0;
    padding-bottom: 10px;
    border-bottom: 2px solid #eee;
}

.carrito-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 0; /* Menor padding para ahorrar espacio */
    border-bottom: 1px dashed #eee;
}

.carrito-item:last-child {
    border-bottom: none;
}

.item-details strong, .item-price {
    font-size: 0.85em; /* Tamaño reducido */
}

.item-details span {
    font-size: 0.75em; /* Letra más pequeña para el x Precio */
    color: #888;
}

.carrito-vacio-msg {
    color: #999;
    text-align: center;
    padding: 20px 0;
}

/* --- MONTOS FINALES (Lateral) --- */
.montos-finales {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 2px solid #ddd;
}

.monto-linea {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
    font-size: 0.95em; 
}

.total-cotizacion {
    border-top: 1px dashed #aaa;
    padding-top: 5px;
    font-size: 1.1em;
    font-weight: bold;
}

/* --- BOTONES DE ACCIÓN (Enviar/Limpiar) --- */
.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

.btn-action {
    width: 100%;
    padding: 10px;
    border: none;
    border-radius: 5px;
    color: white;
    font-weight: bold;
    cursor: pointer;
    transition: opacity 0.2s;
}

.btn-action:hover {
    opacity: 0.8;
}

.btn-red { background-color: var(--red-btn); }
.btn-green { background-color: var(--green-btn); }
.btn-gray { background-color: var(--gray-btn); }


/* --- SECCIÓN DE DESPACHO y TÉRMINOS --- */
.despacho-option {
    text-align: center; /* Centrar el título */
}

.despacho-option h3 {
    font-size: 1.3em; 
    margin-top: 0;
    display: flex; 
    justify-content: center;
    align-items: center;
    gap: 10px;
}

.truck-icon {
    color: var(--green-btn); /* Ícono de Camión Verde */
    font-size: 1.5em; 
}

.btn-toggle-despacho {
    background-color: var(--green-btn);
    color: white;
    padding: 10px 15px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    margin-top: 10px;
    transition: background-color 0.2s;
}

.btn-toggle-despacho:hover {
    background-color: #218838;
}

.btn-toggle-despacho.active {
    background-color: var(--red-btn); /* Rojo cuando está agregado */
}

/* --- TÉRMINOS Y CONDICIONES --- */
.terminos-condiciones h3 {
    border-bottom: 1px solid #eee;
    padding-bottom: 5px;
    margin-top: 0;
}

.terminos-condiciones pre {
    white-space: pre-wrap; 
    font-size: 1.1em; /* Letra 3 puntos más grande */
    color: #444;
}

/* --- MODAL (Ventana de Contacto) --- */
.modal {
    display: none; 
    position: fixed;
    z-index: 10; 
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.4); 
}

.modal-content {
    background-color: #fefefe;
    margin: 15% auto; 
    padding: 20px;
    border: 1px solid #888;
    width: 80%; 
    max-width: 400px;
    border-radius: 8px;
    position: relative;
}

.close-btn {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
}

.close-btn:hover,
.close-btn:focus {
    color: #000;
    text-decoration: none;
    cursor: pointer;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

.form-group input {
    width: 95%;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

#modal-confirm-btn {
    width: 100%;
    padding: 10px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}


/* ================================================= */
/* === AJUSTES DE RESPONSIVIDAD PARA MÓVILES === */
/* ================================================= */
@media (max-width: 768px) {
    /* Cambiar la dirección del layout principal (vertical) */
    .main-container {
        grid-template-columns: 1fr; /* Una sola columna para todo */
        padding: 10px; 
    }

    .productos-container {
        grid-column: 1 / 2;
        grid-template-columns: 1fr; /* Una sola columna para móviles */
        order: 2; /* Productos debajo del carrito */
    }

    .carrito-lateral {
        grid-column: 1 / 2;
        order: 1; /* Carrito arriba */
        position: static; 
        margin-bottom: 20px;
    }
    
    .adicional-container {
        grid-column: 1 / 2;
        order: 3; /* Despacho y Términos al final */
        flex-direction: column; 
    }
}
