/* =========================================
   1. BASE Y VARIABLES
   ========================================= */
:root {
    --bg-dark: #0f172a;
    --bg-panel: #1e293b;
    --bg-input: rgba(0, 0, 0, 0.2);
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    --accent: #3b82f6;
    --success: #10b981;
    --border-color: rgba(255, 255, 255, 0.08);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
    margin: 0;
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    padding: 10px;
}

.app-container {
    max-width: 1400px; /* Ancho completo en monitores grandes */
    margin: 0 auto;
}

/* Header Compacto */
.header-publico { 
    text-align: center; 
    margin-bottom: 20px; 
}
.logo-area {
    width: 200px; height: 60px;
    background-image: url('../color/imagenes/LOGO NUEVO.png');
    background-size: contain; background-repeat: no-repeat; background-position: center;
    margin: 0 auto;
}

/* NUEVO: Botón de consulta flotante en el header */
.btn-consultar-flotante {
    background: var(--accent);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 50px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 10px;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
    transition: transform 0.2s, background 0.2s;
}
.btn-consultar-flotante:hover {
    background: #2563eb;
    transform: scale(1.02);
}

/* =========================================
   2. SISTEMA DE REJILLA (GRID) RESPONSIVO
   ========================================= */
.main-grid {
    display: grid;
    /* Por defecto (Móvil): 1 sola columna */
    grid-template-columns: 1fr; 
    gap: 20px;
}

/* EN PC Y TABLETS GRANDES (Más de 1024px) */
@media (min-width: 1024px) {
    .main-grid {
        /* 3 Columnas: 25% (Cliente) - 45% (Catálogo) - 30% (Final) */
        grid-template-columns: 1fr 1.8fr 1.2fr;
        align-items: start; /* Alineación superior */
        height: calc(100vh - 120px); /* Ocupar altura de pantalla */
    }

    /* En PC, las columnas tienen scroll interno independiente */
    .col-panel {
        height: 100%;
        overflow-y: auto;
    }
}

/* =========================================
   3. ESTILOS DE PANELES (COLUMNAS)
   ========================================= */
.col-panel {
    background: var(--bg-panel);
    border-radius: 16px;
    padding: 20px;
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}

.panel-header {
    display: flex; align-items: center; gap: 10px;
    margin-bottom: 20px; padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
}
.step-num {
    background: var(--accent); color: white;
    width: 28px; height: 28px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-weight: bold; font-size: 0.9rem;
}
h2 { margin: 0; font-size: 1.1rem; color: white; }

/* =========================================
   4. FORMULARIOS
   ========================================= */
.input-group { margin-bottom: 15px; }
.input-group label { display: block; margin-bottom: 6px; font-size: 0.85rem; color: var(--text-muted); }
.input-group input, .input-group select, .input-group textarea {
    width: 100%; padding: 12px;
    background: var(--bg-input); border: 1px solid var(--border-color);
    border-radius: 8px; color: white; font-size: 0.95rem;
}
.row-dual { display: flex; gap: 10px; }
.row-dual .input-group { flex: 1; }

/* Estilo para las opciones dentro de la lista desplegable */
.input-group select option {
    background-color: var(--bg-panel);
    color: white; 
    padding: 10px; 
}

.input-group select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.3);
    outline: none;
}

/* =========================================
   5. CATÁLOGO DE PRODUCTOS
   ========================================= */
.sticky-top { position: sticky; top: 0; background: var(--bg-panel); z-index: 10; padding-bottom: 10px; }
#buscadorPublico { padding: 12px 20px; border-radius: 50px; background: rgba(0,0,0,0.3); border: none; width: 100%; color: white; }

/* =========================================
   CORRECCIÓN LISTA LARGA (SCROLL INTERNO)
   ========================================= */
.product-list-scroll {
    max-height: 50vh; 
    overflow-y: auto; 
    background: rgba(0, 0, 0, 0.2); 
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 5px;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.3);
}

.product-list-scroll::-webkit-scrollbar { width: 6px; }
.product-list-scroll::-webkit-scrollbar-track { background: rgba(255, 255, 255, 0.05); border-radius: 4px; }
.product-list-scroll::-webkit-scrollbar-thumb { background: var(--accent); border-radius: 4px; }

.product-item {
    display: flex; justify-content: space-between; align-items: center;
    padding: 12px; margin-bottom: 8px;
    background: rgba(255,255,255,0.03); border-radius: 10px;
    border: 1px solid transparent; transition: all 0.2s;
}
.product-item.selected { border-color: var(--accent); background: rgba(59, 130, 246, 0.1); }
.prod-info h3 { margin: 0; font-size: 0.95rem; }
.prod-info small { color: var(--text-muted); font-size: 0.8rem; font-family: monospace; }

.prod-action { display: flex; align-items: center; gap: 8px; }
.qty-btn { width: 32px; height: 32px; border-radius: 50%; border: none; font-weight: bold; cursor: pointer; }
.btn-minus { background: #334155; color: white; }
.btn-plus { background: var(--accent); color: white; }

/* =========================================
   6. RESUMEN Y LEGAL
   ========================================= */
.live-summary {
    background: rgba(0,0,0,0.3); border-radius: 10px;
    padding: 15px; margin-bottom: 20px;
    min-height: 100px; max-height: 250px; overflow-y: auto;
}
.empty-msg { text-align: center; color: var(--text-muted); font-style: italic; margin-top: 30px; }

.summary-item {
    display: flex; justify-content: space-between;
    padding: 8px 0; border-bottom: 1px solid rgba(255,255,255,0.05);
    font-size: 0.9rem;
}
.summary-item strong { color: var(--accent); }

/* Checkbox Legal */
.checkbox-container { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; font-size: 0.85rem; color: var(--text-muted); }
.checkbox-container input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--accent); }
.checkbox-container a { color: var(--accent); text-decoration: underline; }

.btn-enviar-final {
    width: 100%; padding: 16px; margin-top: 20px;
    background: var(--success); color: white; border: none;
    border-radius: 10px; font-weight: 800; font-size: 1.1rem;
    cursor: pointer; transition: transform 0.2s;
    box-shadow: 0 5px 15px rgba(16, 185, 129, 0.3);
}
.btn-enviar-final:hover { background: #059669; }
.btn-enviar-final:active { transform: scale(0.98); }

/* Toast */
.toast {
    position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%) translateY(100px);
    background: var(--bg-panel); color: var(--text-main); border: 1px solid var(--accent); padding: 12px 25px; border-radius: 50px; font-weight: bold;
    transition: transform 0.3s; z-index: 2000;
}
.toast.show { transform: translateX(-50%) translateY(0); }

/* CAJA DE CONTACTO / MÁS INFO */
.info-contacto-box {
    margin-top: 25px;
    padding: 15px;
    background: rgba(59, 130, 246, 0.1); 
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: 12px;
    text-align: center;
}

.info-contacto-box h4 {
    margin: 0 0 10px 0;
    color: var(--accent);
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.info-contacto-box p {
    margin: 5px 0;
    font-size: 0.9rem;
    color: var(--text-main);
}

/* =========================================
   7. MODAL LEGAL Y DE CONSULTA (MODO OSCURO)
   ========================================= */
.modal-legal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.8);
    z-index: 9999;
    display: flex; justify-content: center; align-items: center;
}
.modal-legal-content {
    background: var(--bg-panel); /* Cambiado al azul oscuro de los paneles */
    width: 90%; max-width: 800px; height: 85vh;
    border-radius: 12px;
    display: flex; flex-direction: column;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0,0,0,0.8);
    border: 1px solid var(--border-color);
}
.modal-legal-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 15px 20px;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid var(--border-color);
}
.modal-legal-header h3 {
    margin: 0; 
    color: var(--text-main); /* Título blanco */
    font-size: 1.1rem;
}
.btn-cerrar-modal {
    background: rgba(239, 68, 68, 0.2); 
    color: #fca5a5;
    border: 1px solid #ef4444; 
    padding: 8px 15px;
    border-radius: 8px; cursor: pointer;
    font-weight: bold; transition: all 0.2s;
}
.btn-cerrar-modal:hover { background: #ef4444; color: white; }

.modal-legal-body, .modal-consulta-body {
    flex-grow: 1;
    background: var(--bg-dark); /* Fondo general más oscuro */
    color: var(--text-main);
}

/* Tarjetas de resultados de pedidos (Modo Oscuro) */
.card-pedido {
    background: var(--bg-panel);
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 15px;
    border: 1px solid var(--border-color);
    color: var(--text-main);
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

.card-pedido .header-p {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.badge-status {
    padding: 6px 12px;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Estados en Modo Oscuro (Fondos translúcidos con bordes neón) */
.status-pendiente { background: rgba(245, 158, 11, 0.15); color: #fcd34d; border: 1px solid rgba(245, 158, 11, 0.5); }
.status-proceso { background: rgba(139, 92, 246, 0.15); color: #c4b5fd; border: 1px solid rgba(139, 92, 246, 0.5); }
.status-entregado-vendedor { background: rgba(14, 165, 233, 0.15); color: #7dd3fc; border: 1px solid rgba(14, 165, 233, 0.5); }
.status-despachado { background: rgba(16, 185, 129, 0.15); color: #6ee7b7; border: 1px solid rgba(16, 185, 129, 0.5); }
.status-entregado { background: rgba(59, 130, 246, 0.15); color: #93c5fd; border: 1px solid rgba(59, 130, 246, 0.5); }
.status-cancelado { background: rgba(239, 68, 68, 0.15); color: #fca5a5; border: 1px solid rgba(239, 68, 68, 0.5); }

.item-pedido-lista {
    font-size: 0.85rem;
    color: var(--text-muted);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding-top: 8px;
    margin-top: 8px;
}
/* Color específico para Pedido Asignado a Vendedor */
.status-asignado_vendedor { 
    background: rgba(14, 165, 233, 0.15); 
    color: #7dd3fc; 
    border: 1px solid rgba(14, 165, 233, 0.5); 
}