:root {
    /* Variables dinámicas desde header.php:
       --color-base
       --color-sidebar
       --font-family
       --color-texto-layout
       --color-texto-contenido
       --bg-color */
} 

body {
    margin: 0;
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--color-texto-contenido);
}

body.sidebar-open {
    overflow: hidden; /* Evita el scroll en el body cuando el menú está abierto */
}

header, footer {
    background-color: var(--color-base);
    color: var(--color-texto-layout);
    padding: 15px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

header img {
    max-height: 40px;
}

main {
    display: flex;
    min-height: calc(100vh - 100px); /* header + footer */
}

.sidebar {
    width: 200px; 
    background-color: var(--color-sidebar);
    color: var(--color-texto-layout);
    padding: 20px;
    flex-shrink: 0;
    transition: transform 0.3s ease-in-out; 
}

.sidebar-close {
    display: none;
}

/* Estilos para el encabezado del sidebar */
.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.sidebar a {
    display: block;
    color: var(--color-texto-layout);
    text-decoration: none;
    margin-bottom: 10px;
}

.sidebar a:hover {
    background-color: var(--color-texto-layout);
    color: var(--color-base);
}

.sidebar-backdrop {
    display: none; 
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 999;
}

.content {
    flex: 1;
    padding: 20px;
    background-color: var(--bg-color);
    color: var(--color-texto-contenido);
    transition: margin-left 0.3s ease-in-out;
}

.menu-toggle {
    display: none; 
    font-size: 2rem;
    background: none;
    border: none;
    color: var(--color-texto-layout);
    cursor: pointer;
}

button {
    background-color: var(--color-base);
    color: var(--color-texto-layout);
    border: none;
    padding: 8px 16px;
    cursor: pointer;
}

button:hover {
    opacity: 0.9;
}

/* Estilo general para campos de formularios */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="file"],
textarea,
select {
    background-color: #fff;
    border: 1px solid #ccc;
    border-radius: 8px;
    padding: 10px 1px;
    font-size: 16px;
    width: 80%;
    font-family: var(--font-family);
    color: var(--color-texto-contenido);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 1);
    transition: all 0.2s ease-in-out;
    margin: 10px;
}
#num-comensales-input {
    width: 30%;       /* O el ancho que necesites en el modal */
    margin: 0 auto;         /* Quita el margen que empuja el elemento */
    padding: 8px 12px; /* Mejora el espacio interno lateral */
    box-shadow: none;  /* A veces en modales el shadow se ve muy pesado */
}
#filtro-comensal-comanda {
    width: 35% !important;   /* Ocupa todo el ancho del contenedor lateral */
    /* margin: 5px 0 !important; /* Elimina el margen lateral de 10px que lo descentra */
    margin-left: 10px;
    padding: 5px 5px;        /* Espaciado interno más equilibrado */
    border-radius: 6px;
    border: 1px solid #d1d3e2; /* Un borde gris suave estilo Bootstrap */
    background-color: #f8f9fc; /* Fondo ligeramente gris para diferenciarlo */
    font-size: 0.85rem;       /* Fuente un poco más pequeña para ahorrar espacio */
    color: #4e73df;           /* Color de texto azul (o el de tu marca) */
    font-weight: bold;        /* Para que resalte que es un filtro */
    box-shadow: none !important; /* Quita la sombra pesada si no la deseas */
    cursor: pointer;
}

#filtro-comensal-comanda:focus {
    border-color: #bac8f3;
    outline: 0;
    background-color: #fff;
    box-shadow: 0 0 0 0.2rem rgba(78, 115, 223, 0.25) !important;
}

input[type="email"]::placeholder,
input[type="password"]::placeholder,
input[type="text"]::placeholder,
input[type="number"]::placeholder,
textarea::placeholder {
    color: #999;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--color-base);
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.2);
}

/* Botones primarios */
button,
.btn-primary {
    background-color: var(--color-base);
    border: none;
    color: var(--color-texto-layout);
    padding: 10px 18px;
    border-radius: 6px;
    font-size: 15px;
    cursor: pointer;
    transition: background-color 0.5s ease-in-out;
}

button:hover,
.btn-primary:hover {
    opacity: 0.5;
}

img.rounded {
    border-radius: 8px;
    border: 1px solid #ccc;
    padding: 4px;
    background-color: #f9f9f9;
}

/* --- Estilos movidos desde mipaginaempresa.php --- */
.main-content {
    flex-grow: 1;
    padding: 20px;
    background-color: #f4f7f6;
}
.content-header {
    margin-bottom: 20px;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}
.form-container {
    background-color: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
fieldset {
    border: 1px solid #ddd;
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 5px;
}
legend {
    font-weight: bold;
    color: #333;
    padding: 0 10px;
    width: auto;
    border-bottom: none;
}
.form-group {
    margin-bottom: 15px;
}
.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: #555;
}
.form-group input[type="text"],
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
}
.form-group input[type="file"] {
    padding: 5px;
}
.current-image-preview {
    margin-top: 10px;
    border: 1px dashed #ccc;
    padding: 10px;
    border-radius: 5px;
    background-color: #f9f9f9;
}
.current-image-preview img {
    border: 1px solid #ddd;
    padding: 3px;
    background-color: #fff;
}
.alert {
    padding: 15px;
    margin-bottom: 20px;
    border: 1px solid transparent;
    border-radius: 4px;
}
.alert-success {
    color: #155724;
    background-color: #d4edda;
    border-color: #c3e6cb;
}
.alert-danger {
    color: #721c24;
    background-color: #f8d7da;
    border-color: #f5c6cb;
}
.table-responsive {
    overflow-y: visible !important; 
    overflow-x: auto;
}
.table-custom {
    border-collapse: separate;
    border-spacing: 0;
    width: 100%;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    background-color: #f0f0f0;
}

.table-custom thead {
    background-color: var(--color-base, #007bff);
    color: var(--color-texto-layout, #fff);
}

.table-custom thead th {
    padding: 12px 16px;
    font-weight: bold;
    text-align: left;
    border-bottom: 2px solid #eaeaea;
}

.table-custom tbody tr {
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.2s;
}

.table-custom tbody tr:hover {
    background-color: #f8f9fa;
}

.table-custom td {
    padding: 10px 16px;
    color: var(--color-texto-contenido, #333);
}

.table-custom td:last-child {
    white-space: nowrap;
}

/* Tarjetas de categorías */
.card-categoria {
    background-color: #fff;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    text-align: center;
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.card-categoria:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
}

.card-categoria h5 {
    font-size: 1.2rem;
    color: var(--color-base);
    margin-bottom: 10px;
}

.card-categoria .acciones {
    margin-top: auto;
    display: flex;
    justify-content: center;
    gap: 10px;
}

.card-categoria .btn {
    font-size: 0.9rem;
    padding: 6px 10px;
    border-radius: 6px;
}

/* Info de Producto */
.producto-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.producto-info img {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid #ccc;
    background-color: #f0f0f0;
}

.producto-meta {
    display: flex;
    flex-direction: column;
    font-size: 0.85rem;
}

.producto-meta .nombre {
    font-weight: bold;
    font-size: 0.95rem;
}

.producto-meta .codigo,
.producto-meta .estado {
    font-size: 0.8rem;
    color: #555;
}

.table-custom td,
.table-custom th {
    padding: 8px 10px;
    font-size: 0.85rem;
}

.btn-outline-primary {
    background-color: var(--color-sidebar);
    border-color: var(--color-base);
    color: white;
    padding: 1px 18px;
    border-radius: 18px;
}

.btn-outline-primary:hover {
    background-color: var(--color-base);
    color: white;
}

/* Modales */
.modal-header {
    padding: 10px 15px;
    background-color: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    text-align: right;
    z-index: 1001;
}

.modal-header .btn-danger {
    margin-left: auto;
    margin-right: 0;
    z-index: 1002;
    position: relative;
}

.modal-content {
    position: relative;
    max-height: 80%;
    overflow-y: auto;
    background-color: white;
    padding: 20px;
}

.modal-content .btn-danger {
    margin-top: 10px;
    font-size: 14px;
}

#ticket-content {
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 8px;
    box-shadow: 0px 4px 12px rgba(0, 0, 0, 0.1);
}

.modal-content button {
    margin-top: 0px;
    width: 100%;
    cursor: pointer;
    background-color: var(--color-base);
    color: var(--color-texto-layout);
    border: none;
    font-size: 16px;
}
/* Estilos específicos para el botón X de cerrar de Bootstrap */
.btn-close {
    width: 0.5em !important;
}

.btn-close:hover {
    opacity: 1;
    transform: scale(1.1); /* Efecto sutil al pasar el ratón */
}

.btn-close:focus {
    outline: none !important;
    box-shadow: none !important;
}

#ticket-modal .modal-dialog {
    position: relative;
    max-width: 90%;
    margin: 5% auto;
}


#sugerencias-clientes {
    top: calc(100% + 5px);
    left: 0;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    max-height: 200px;
    overflow-y: auto;
    background-color: #fff;
    border: 1px solid #dee2e6;
    border-top: none;
    border-radius: 0 0 .25rem .25rem;
}

/* ==========================================================================
   NUEVA SECCIÓN: RESPONSIVIDAD AJUSTADA (FULLSCREEN SIDEBAR)
   ========================================================================== */

@media (max-width: 992px) {
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: 100% !important; /* CAMBIO: Ahora es Fullscreen */
        height: 100% !important;
        z-index: 2000 !important;
        transform: translateX(-100%);
        box-shadow: none;
        overflow-y: auto; /* Permite scroll si el menú es largo */
    }

    .sidebar.active {
        transform: translateX(0);
    }

    /* Ocultar el botón de cierre en escritorio y estilizarlo en móvil */
    .sidebar-close {
        display: block !important;
        background: none;
        border: none;
        color: var(--color-texto-layout);
        font-size: 2rem;
        cursor: pointer;
    }

    .content {
        width: 100%;
        margin-left: 0 !important; /* CAMBIO: No empujamos el contenido */
        padding: 10px;
    }
    
    /* El botón de menú aparece */
    .menu-toggle {
        display: block;
        order: -1;
    }
    
    header, footer {
        padding: 10px;
    }

    .header-content h1 {
        display: none;
    }

    header img {
        height: 40px;
    }

    /* Main en columna */
    main {
        flex-direction: column;
    }

    /* Estilos específicos para la página de movimientos en móvil */
    .movimientos-page .col-md-3,
    .movimientos-page .col-md-4,
    .movimientos-page .col-md-2 {
        width: 100%;
        margin-bottom: 1rem;
    }

    .movimientos-page .table-custom thead {
        display: none;
    }

    .movimientos-page .table-custom {
        border-collapse: collapse;
        width: 100%;
    }

    .movimientos-page .table-custom tbody tr {
        display: block;
        margin-bottom: 1.5rem;
        border: 1px solid #dee2e6;
        border-radius: 0.5rem;
        background-color: var(--bg-color);
        box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.1);
    }

    .movimientos-page .table-custom tbody tr td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0.75rem 1rem;
        border-bottom: 1px solid #dee2e6;
    }

    .movimientos-page .table-custom tbody tr td:last-child {
        border-bottom: none;
    }

    .movimientos-page .table-custom tbody tr td:before {
        content: attr(data-label);
        font-weight: bold;
        text-transform: uppercase;
        color: var(--color-texto-layout);
    }
}