/* --- BASE Y ESTILOS REUTILIZADOS --- */
* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
    --primary-color: #ff6b35; --secondary-color: #4CAF50; --accent-color: #ff8f65;
    --danger-color: #f44336; --info-color: #2196f3; --light-color: #ffffff; --dark-color: #1a1a1a;
    --gray-100: #f8f9fa; --gray-200: #e9ecef; --gray-300: #dee2e6; --gray-600: #6c757d;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1); --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
    --border-radius: 12px; --transition: all 0.3s ease;
}
[data-theme="dark"] {
    --light-color: #1a1a1a; --dark-color: #ffffff; --gray-100: #2d2d2d; --gray-200: #3a3a3a;
    --gray-300: #4a4a4a; --gray-600: #7a7a7a;
}
body {
    font-family: 'Poppins', sans-serif; background: var(--gray-100); color: var(--dark-color);
    transition: background 0.3s, color 0.3s; display: flex; flex-direction: column; height: 100vh; overflow-x: hidden;
}
.sidebar { position: fixed; left: -300px; top: 0; width: 300px; height: 100vh; background: var(--light-color); box-shadow: var(--shadow-lg); transition: var(--transition); z-index: 4000; padding: 2rem 0; }
.sidebar.active { left: 0; }
.sidebar-header { padding: 0 2rem 2rem; border-bottom: 1px solid var(--gray-300); margin-bottom: 1rem; }
.sidebar-title { font-size: 1.5rem; font-weight: 700; color: var(--primary-color); margin-bottom: 0.5rem; }
.sidebar-menu { list-style: none; }
.sidebar-menu li { margin: 0.5rem 0; }
.sidebar-menu a { display: flex; align-items: center; padding: 1rem 2rem; color: var(--dark-color); text-decoration: none; transition: var(--transition); font-weight: 500; }
.sidebar-menu a:hover { background: var(--gray-100); color: var(--primary-color); transform: translateX(5px); }
.sidebar-menu i { margin-right: 1rem; font-size: 1.2rem; }
.theme-toggle { display: flex; align-items: center; justify-content: space-between; padding: 1rem 2rem; cursor: pointer; transition: var(--transition); }
.toggle-switch { position: relative; width: 50px; height: 25px; background: var(--gray-300); border-radius: 15px; cursor: pointer; transition: var(--transition); }
.toggle-switch::before { content: ''; position: absolute; top: 2px; left: 2px; width: 21px; height: 21px; background: white; border-radius: 50%; transition: var(--transition); }
.toggle-switch.active { background: var(--primary-color); }
.toggle-switch.active::before { transform: translateX(25px); }
.overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.5); z-index: 3500; opacity: 0; visibility: hidden; transition: var(--transition); }
.overlay.active { opacity: 1; visibility: visible; }

/* --- HEADER DEL LOCAL (CSS CORREGIDO Y SIMPLIFICADO) --- */
.local-header {
    background: var(--light-color); padding: 1rem 1.5rem; box-shadow: var(--shadow);
    display: flex; align-items: center; gap: 1rem; z-index: 1000;
}
.menu-btn, .plus-btn {
    background: none; border: none; font-size: 1.5rem; color: var(--primary-color); cursor: pointer;
    flex-shrink: 0; /* Evita que los botones se encojan */
    padding: 0.5rem;
}
.plus-btn { background: var(--primary-color); color: white; width: 45px; height: 45px; border-radius: 50%; display: flex; justify-content: center; align-items: center; }
.search-container {
    flex-grow: 1; /* Hace que la barra de búsqueda ocupe el espacio disponible */
    position: relative;
}
.search-input { width: 100%; padding: 0.75rem 1rem 0.75rem 2.5rem; border: 2px solid var(--gray-200); border-radius: 25px; background: var(--gray-100); }
.search-icon { position: absolute; left: 0.8rem; top: 50%; transform: translateY(-50%); color: var(--gray-600); }
.plus-menu-container { position: relative; }
.dropdown-menu {
    display: none; position: absolute; top: 120%; right: 0; background: var(--light-color);
    border-radius: var(--border-radius); box-shadow: var(--shadow-lg); z-index: 1100;
    width: 220px; overflow: hidden;
}
.dropdown-menu.active { display: block; }
.dropdown-menu a { display: flex; align-items: center; padding: 1rem; color: var(--dark-color); text-decoration: none; transition: background 0.2s; }
.dropdown-menu a:hover { background: var(--gray-100); }
.dropdown-menu i { margin-right: 1rem; width: 20px; color: var(--primary-color); }

/* --- TABLERO DE PEDIDOS --- */
.order-board {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem;
    padding: 1.5rem; flex-grow: 1; overflow-y: auto;
}
.order-column { background: var(--light-color); border-radius: var(--border-radius); display: flex; flex-direction: column; }
.column-title {
    padding: 1rem 1.5rem; border-bottom: 1px solid var(--gray-200); font-size: 1.2rem;
    position: sticky; top: 0; background: var(--light-color); z-index: 10;
}
.column-title i { margin-right: 0.75rem; }
#newOrdersColumn .column-title { color: var(--info-color); }
#pendingOrdersColumn .column-title { color: var(--primary-color); }
#completedOrdersColumn .column-title { color: var(--secondary-color); }
.column-content { padding: 1.5rem; overflow-y: auto; flex-grow: 1; display: flex; flex-direction: column; gap: 1rem; }
.order-card { background: var(--gray-100); padding: 1rem; border-radius: var(--border-radius); box-shadow: 0 2px 4px rgba(0,0,0,0.05); }
.order-card h4 { margin-bottom: 0.5rem; font-size: 1rem; }
.order-card p { font-size: 0.9rem; color: var(--gray-600); margin-bottom: 0.25rem; }
.order-card ul { list-style-position: inside; padding-left: 0.5rem; margin: 0.5rem 0; }
.order-card-actions { margin-top: 1rem; display: flex; gap: 0.5rem; }
.btn-primary { background: var(--primary-color); color: white; border: none; padding: 0.5rem 1rem; border-radius: 8px; cursor: pointer; transition: var(--transition); }
.btn-primary:hover { opacity: 0.9; }
.btn-secondary { background: var(--gray-200); color: var(--dark-color); border: none; padding: 0.5rem 1rem; border-radius: 8px; cursor: pointer; transition: var(--transition); }
.btn-secondary:hover { background: var(--gray-300); }
.btn-success { background: var(--secondary-color); color: white; border: none; padding: 0.5rem 1rem; border-radius: 8px; cursor: pointer; transition: var(--transition); }
.btn-success:hover { opacity: 0.9; }

/* --- MODALES --- */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.6); z-index: 2000; display: flex;
    justify-content: center; align-items: center;
    opacity: 0; visibility: hidden; transition: all 0.3s;
}
.modal-overlay:not(.hidden) { opacity: 1; visibility: visible; }
.modal-content {
    background: var(--light-color); padding: 2rem; border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg); width: 90%; max-width: 500px;
    transform: scale(0.9); transition: all 0.3s;
}
.modal-overlay:not(.hidden) .modal-content { transform: scale(1); }
.modal-content.wide { max-width: 800px; }
.modal-content h2 { margin-bottom: 1.5rem; }
.hidden { display: none !important; }
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; margin-bottom: 0.5rem; font-weight: 500; }
.form-group input, .form-group textarea, .form-group select {
    width: 100%; padding: 0.75rem; border: 1px solid var(--gray-300);
    border-radius: 8px; background: var(--gray-100); font-family: 'Poppins', sans-serif;
}
.form-group-inline { display: flex; gap: 1rem; }
.form-actions { margin-top: 2rem; display: flex; justify-content: flex-end; gap: 1rem; }

/* --- Listado de Productos en Modal --- */
.product-list-container { max-height: 60vh; overflow-y: auto; }
.product-list-item { display: flex; align-items: center; gap: 1rem; padding: 1rem; border-bottom: 1px solid var(--gray-200); }
.product-list-item:last-child { border-bottom: none; }
.product-list-item img { width: 50px; height: 50px; object-fit: cover; border-radius: 8px; }
.product-list-details { flex-grow: 1; }
.product-list-actions button { background: none; border: none; cursor: pointer; font-size: 1.2rem; padding: 0.5rem; }
.edit-btn { color: var(--primary-color); }
.delete-btn { color: var(--danger-color); }

/* --- RESPONSIVIDAD PARA MÓVILES (CORREGIDO) --- */
@media (max-width: 992px) {
    .order-board {
        grid-template-columns: 1fr; /* Apila las columnas */
    }
}
@media (max-width: 768px) {
    .local-header {
        padding: 0.5rem 1rem; /* Menos padding en móvil */
    }
    .order-board {
        padding: 1rem;
        gap: 1rem;
    }
}