:root {
    --theme-primary: #D94A27;
    --theme-hover: #B83B1E;
    --theme-disabled: #FBDCD5;
    --theme-light: #FEF2E8;
    --theme-soft: #FFEDD5;
    --theme-border: #FDBA74;
}
body {
    font-family: 'DM Sans', sans-serif;
    background-color: #F8F9FA;
}
.btn-primary {
    background-color: var(--theme-primary);
    color: white;
}
.btn-primary:hover {
    background-color: var(--theme-hover);
}
.btn-primary:disabled {
    background-color: var(--theme-disabled);
    cursor: not-allowed;
}
.btn-secondary {
    background-color: #27D9A8; /* Turquesa brillante */
    color: white;
}
.btn-secondary:hover {
    background-color: #1EBB90;
}
.nav-item {
    color: #4A5568; /* gray-700 */
}
.nav-item.active, .nav-item:hover, .dropdown-menu a:hover, .dropdown-menu a.active {
    color: var(--theme-primary);
}
.dropdown-menu {
    display: none;
}
.scroll-container::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
.scroll-container::-webkit-scrollbar-track {
    background: var(--theme-light);
}
.scroll-container::-webkit-scrollbar-thumb {
    background-color: var(--theme-primary);
    border-radius: 20px;
    border: 3px solid var(--theme-light);
}

#main-nav-container {
    overflow: visible;
    scrollbar-width: none; 
}
#main-nav-container::-webkit-scrollbar {
    display: none;
}
#main-nav {
    flex-wrap: nowrap;
    white-space: nowrap;
    overflow-x: auto; 
    padding-bottom: 8px; 
}
.category-item.active {
    background-color: var(--theme-light);
    border-right: 4px solid var(--theme-primary);
}
.pos-tab.active, .payment-tab-btn.active, .payment-mode-btn.active {
    border-bottom-width: 3px;
    border-bottom-color: var(--theme-primary);
    color: var(--theme-primary);
    font-weight: 600;
}
.pos-tab {
    display: flex;
    align-items: center;
    justify-content: center;
}
.menu-category-btn.active, .payment-tab-btn.active, .payment-mode-btn.active {
    background-color: var(--theme-primary);
    color: white;
}

.selection-card.active {
    box-shadow: 0 0 0 3px var(--theme-primary);
    transform: scale(1.04);
    position: relative;
    z-index: 2;
}


.table-card.selected-for-merge {
    box-shadow: 0 0 0 4px #27D9A8;
    transform: scale(1.05);
    border: 2px solid #1EBB90;
}
/* Estilos para el Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 20px;
}
.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 20px;
}
.toggle-slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}
input:checked + .toggle-slider {
    background-color: #27D9A8;
}
input:checked + .toggle-slider:before {
    transform: translateX(20px);
}
.payment-method-btn.selected {
    background-color: var(--theme-primary);
    color: white;
    box-shadow: 0 0 0 2px var(--theme-primary);
}


#whatsapp-menu-btn {
    position: relative;
}
#whatsapp-dropdown {
    transform-origin: top right; 
}


/*
==============================================
ESTILOS COMPLETOS Y DEFINITIVOS PARA SIDEBAR (VERSIÓN FINAL)
==============================================
*/

/* --- ESTRUCTURA GENERAL DEL SIDEBAR --- */
#sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 280px; /* Ancho completo al abrirse */
    flex-shrink: 0;
    z-index: 1001; /* Por encima del overlay */
    transition: transform 0.3s ease-in-out;
    box-shadow: 0 0 15px rgba(0,0,0,0.2);
}

/* Estado por defecto: Oculto */
#sidebar.sidebar-hidden {
    transform: translateX(-100%);
}

/* Estado visible */
#sidebar.sidebar-visible {
    transform: translateX(0);
}

/* --- ENCABEZADO DEL SIDEBAR --- */
#sidebar-header {
    align-items: center;
    justify-content: space-between;
}
#sidebar-toggle-icon {
    transition: transform 0.3s ease-in-out;
}

/* --- CONTENEDOR DE NAVEGACIÓN --- */
#main-nav {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    overflow-y: auto; /* Permite scroll vertical si hay muchos items */
}

/* --- ESTILOS DE ENLACES DE NAVEGACIÓN --- */
.nav-item, .sub-nav-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: background-color 0.2s, color 0.2s;
}
.nav-item:hover, .sub-nav-item:hover {
    background-color: #F3F4F6; /* gray-100 */
}
.nav-item-icon {
    width: 24px;
    text-align: center;
    margin-right: 16px;
    font-size: 1.125rem; /* Restaura el tamaño del ícono */
}

/* --- ESTILOS DE ESTADO ACTIVO --- */
.nav-item.active {
    background-color: var(--theme-light);
    color: var(--theme-primary);
    font-weight: 700;
}

/* Estilo SUTIL para el menú principal cuando está desplegado */
.nav-dropdown.open > .nav-item {
    color: var(--theme-primary); /* Solo cambia el color del texto y el ícono */
    font-weight: 700;
}


.sub-nav-item {
    padding-left: 56px; /* Indentación para sub-opciones */
}
.sub-nav-item.active {
    background-color: #E5E7EB; /* gray-200 */
    font-weight: 600;
}

/* --- LÓGICA DE SUB-MENÚ (ACORDEÓN Y FLOTANTE) --- */
.sub-menu {
    display: none;
    margin-top: 4px;
    /* Los sub-items dentro se apilarán verticalmente por defecto */
}
.nav-dropdown.open > .sub-menu {
    display: block;
}
.nav-item .nav-item-arrow {
    margin-left: auto;
    transition: transform 0.2s;
}
.nav-dropdown.open > .nav-item .nav-item-arrow {
    transform: rotate(90deg);
}

/* El overlay para oscurecer el fondo (ahora es global) */
#sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    transition: opacity 0.3s ease-in-out;
    /* La clase 'hidden' de Tailwind se usará para mostrar/ocultar */
}

/*
==============================================
ESTILOS PARA EL NUEVO BOTÓN DE MENÚ DE USUARIO
==============================================
*/
#user-menu-btn img {
    height: 100px; /* Aumentamos el tamaño (equivalente a h-14 de Tailwind) */
    object-fit: contain; /* Asegura que todo el logo sea visible sin ser recortado */
    /* Se han eliminado las reglas de borde y radio que creaban el círculo */
}

#user-menu-btn .fa-chevron-down {
    /* Pequeña transición para la flecha */
    transition: transform 0.2s ease-in-out;
}

/*
==============================================
ANIMACIÓN Y ALINEACIÓN PARA MENÚ DE USUARIO
==============================================
*/

/* Estilo base para la flecha, asegurando que no tenga animación */
#user-menu-btn .fa-chevron-down {
    transition: none;
}

/* Rota la flecha cuando el botón tiene la clase 'active' */
#user-menu-btn.active .fa-chevron-down {
    transform: rotate(180deg);
}

/*
==============================================
MODO ENFOQUE (OCULTAR HEADER)
==============================================
*/
#main-app-view.header-hidden #main-header {
    display: none;
}

@media (min-width: 768px) {
    #main-app-view.header-hidden main {
        height: 100vh;
        max-height: 100vh;
        overflow: hidden;
        padding: 0.75rem 1rem;
    }

    #main-app-view.header-hidden #pos-view {
        height: 100%;
        min-height: 0;
        overflow: hidden;
    }

    #main-app-view.header-hidden #order-entry-view {
        height: 100%;
        max-height: 100%;
        min-height: 0;
        overflow: hidden;
    }

    #main-app-view.header-hidden #order-summary-column,
    #main-app-view.header-hidden #product-selection-column,
    #main-app-view.header-hidden #customer-search-column,
    #main-app-view.header-hidden #discount-selection-column,
    #main-app-view.header-hidden #final-payment-column {
        height: 100%;
        max-height: 100%;
        min-height: 0;
        overflow: hidden;
    }

    #order-entry-view > .hidden {
        display: none !important;
    }
}

/*
==============================================
--- Estilos para el Switch de Sugerencia de Compra ---
==============================================

/* --- AJUSTE FINAL: Estilos para Switch Mínimo/Personalizado --- */
.suggestion-switch-container {
    display: flex;
    align-items: center;
    gap: 0.75rem; /* 12px */
}

.switch-control {
    position: relative;
    display: flex;
    align-items: center;
    width: 220px; /* <-- Aumentamos el ancho para el nuevo texto */
    height: 38px;
    background-color: #e5e7eb; /* gris-200 de Tailwind */
    border-radius: 9999px;
    padding: 4px;
    cursor: pointer;
}

.switch-control input {
    display: none;
}

.switch-control .slider {
    position: absolute;
    top: 4px;
    left: 4px;
    width: calc(50% - 4px);
    height: calc(100% - 8px);
    background-color: var(--theme-primary);
    border-radius: 9999px;
    transition: transform 0.3s ease-in-out;
    z-index: 1;
}

.switch-control .switch-label {
    flex: 1;
    text-align: center;
    font-size: 13px;
    font-weight: 600;
    color: #4b5563; /* gris-600 */
    position: relative;
    z-index: 2;
    transition: color 0.3s ease-in-out;
}

/* Mover el slider cuando el input está 'checked' */
.switch-control input:checked ~ .slider {
    transform: translateX(calc(100% + 4px));
}

/* Poner en blanco el texto de "Mínimo" cuando el input NO está checked */
.switch-control input:not(:checked) ~ .switch-label:first-of-type {
    color: white;
}

/* Poner en blanco el texto de "Personalizado" cuando el input SÍ está checked */
.switch-control input:checked ~ .switch-label:last-of-type {
    color: white; /* <-- Corregido para el último elemento de tipo span */
}

/* --- NUEVO: Añadimos esta regla para cambiar el texto --- */
.switch-control input:checked ~ .switch-label:last-of-type:after {
    content: 'Personalizado'; /* Texto cuando está activo */
    position: absolute;
    left: 0;
    right: 0;
}

.switch-control input:not(:checked) ~ .switch-label:last-of-type:after {
    content: 'Optimizado'; /* Texto original cuando no está activo */
     position: absolute;
    left: 0;
    right: 0;
}


/* --- Estilos para las Listas del Dashboard --- */
.top-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0; /* 12px de padding vertical */
    border-bottom: 1px solid #e5e7eb; /* Borde gris-200 */
    font-size: 0.875rem; /* 14px */
}

.top-list-item:last-child {
    border-bottom: none;
}


/* --- Estilos para el Tablero de Domicilios --- */
#delivery-board-container {
    /* Asegura que las columnas no superen la altura de la pantalla */
    grid-template-rows: minmax(0, 1fr);
}

.delivery-column {
    border: 1px solid #e5e7eb; /* border-gray-200 */
}

.delivery-card {
    border: 1px solid #e5e7eb; /* border-gray-200 */
    border-left-width: 4px;
    transition: box-shadow 0.2s ease-in-out;
}

.delivery-card:hover {
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1); /* shadow-md */
}

/*
==============================================
ESTILOS RESPONSIVE PARA SIDEBAR (MÓVILES)
==============================================
*/
@media (max-width: 768px) {
    /* Ya no se necesitan estilos específicos para la barra lateral aquí */
}

/* Colores de borde para cada estado */
.delivery-card.status-new { border-left-color: #3b82f6; } /* blue-500 */
.delivery-card.status-prep { border-left-color: #f97316; } /* orange-500 */
.delivery-card.status-ready { border-left-color: #8b5cf6; } /* violet-500 */
.delivery-card.status-delivery { border-left-color: #10b981; } /* green-500 */

/*
==============================================
ESTILOS PARA TABLERO KANBAN RESPONSIVE (DOMICILIOS)
==============================================
*/
/* Ocultar la barra de scroll en el tablero de domicilios en móvil, pero mantener la funcionalidad */
#delivery-board-container::-webkit-scrollbar {
    display: none;
}
#delivery-board-container {
    -ms-overflow-style: none;  /* IE and Edge */
    scrollbar-width: none;  /* Firefox */
}

/*
==============================================
ESTILOS PARA NOTIFICACIONES TOAST
==============================================
*/
.toast-notification {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    color: white;
    min-width: 250px;
    max-width: 350px;
    opacity: 0;
    transform: translateX(calc(100% + 20px)); /* Empieza fuera de la pantalla a la derecha */
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.27, 1.55); /* Transición con efecto de rebote */
}

.toast-notification.show {
    opacity: 1;
    transform: translateX(0);
}

.toast-notification.success { background-color: #27D9A8; } /* Turquesa (btn-secondary) */
.toast-notification.error { background-color: #ef4444; }   /* Tailwind red-500 */
.toast-notification.info { background-color: #3b82f6; }    /* Tailwind blue-500 */

.toast-icon {
    margin-right: 12px;
    font-size: 1.25rem;
}

.toast-content .title {
    font-weight: 700;
}

.toast-content .message {
    font-size: 0.875rem;
    margin-top: 2px;
}

/*
==============================================
ESTILOS PARA BARRA DE ACCIONES CON ICONOS (INVENTARIO)
==============================================
*/

/* Contenedor para el botón y su tooltip */
.action-tooltip-container {
    position: relative;
    display: inline-flex; /* Asegura que el contenedor se ajuste al botón */
}

/* Estilo base para los botones de acción de solo ícono */
.action-btn-icon {
    width: 44px;         /* Ancho fijo */
    height: 44px;        /* Alto fijo */
    border-radius: 8px; /* Bordes redondeados */
    color: white;
    font-size: 1rem;     /* Tamaño del ícono (16px) */
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

.action-btn-icon:hover {
    transform: translateY(-2px); /* Efecto de elevación al pasar el cursor */
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

/* Estilo para el tooltip (la etiqueta de texto) */
.action-tooltip {
    position: absolute;
    bottom: 100%; /* Se posiciona encima del botón */
    left: 50%;
    transform: translateX(-50%) translateY(10px); /* Centrado y ligeramente abajo */
    background-color: #334155; /* Color de fondo oscuro (slate-700) */
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.75rem; /* Texto pequeño (12px) */
    font-weight: 600;
    white-space: nowrap; /* Evita que el texto se parta en varias líneas */
    opacity: 0; /* Oculto por defecto */
    visibility: hidden;
    transition: opacity 0.2s ease-in-out, transform 0.2s ease-in-out;
    pointer-events: none; /* Evita que el tooltip interfiera con el cursor */
    margin-bottom: 8px; /* Espacio entre el botón y el tooltip */
}

/* Muestra el tooltip cuando se pasa el cursor sobre el contenedor */
.action-tooltip-container:hover .action-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0); /* Vuelve a su posición final */
}

/*
==============================================
CINTAS DE NAVEGACIÓN HORIZONTAL (POS SPLIT-SCREEN)
==============================================
*/
.horizontal-scroll-row {
    display: flex;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
    padding: 6px 8px 10px 8px; /* Margen de seguridad para que el recuadro activo y sombra no se corten */
    scrollbar-width: none; /* Firefox: oculta la barra para diseño nativo limpio */
    -ms-overflow-style: none; /* IE y Edge */
}

.horizontal-scroll-row::-webkit-scrollbar {
    display: none; /* Chrome, Safari, WebView: oculta la barra para experiencia tipo App */
}

/* --- MAPEO DINÁMICO DE COLOR DE MARCA PARA CLASES DE ACENTO --- */
.bg-orange-500, .bg-orange-600 { background-color: var(--theme-primary) !important; }
.hover\:bg-orange-600:hover, .hover\:bg-orange-700:hover { background-color: var(--theme-hover) !important; }
.bg-orange-50 { background-color: var(--theme-light) !important; }
.bg-orange-100, .hover\:bg-orange-100:hover { background-color: var(--theme-soft) !important; }
.text-orange-500, .text-orange-600, .text-orange-700, .hover\:text-orange-600:hover, .hover\:text-orange-700:hover { color: var(--theme-primary) !important; }
.border-orange-500, .border-orange-600, .focus\:border-orange-500:focus { border-color: var(--theme-primary) !important; }
.border-orange-100, .border-orange-200, .border-orange-400 { border-color: var(--theme-border) !important; }
.focus\:ring-orange-500:focus { --tw-ring-color: var(--theme-primary) !important; }
