/* Base styles - always responsive */
body {
    font-family: Arial, sans-serif;
    margin: 0;
    background-color: #f4f4f4;
    display: flex;
    flex-direction: column; /* Cambiado a columna para móvil por defecto */
    padding: 20px;
    gap: 20px;
    box-sizing: border-box;
    min-height: 100vh;
}

/* Toggle button for sidebar (mobile) */
.sidebar-toggle-btn {
    display: none; /* Hidden by default, shown only on smaller screens via media query */
    background-color: #00405d;
    color: white;
    padding: 10px 15px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    margin-bottom: 20px; /* Space below the button */
    width: fit-content; /* Adjust width to content */
    align-self: flex-start; /* Align to the start of the flex container (body) */
}

/* Sidebar styles */
.sidebar {
    width: 100%; /* Full width on small screens */
    flex-shrink: 0;
    flex-basis: auto; /* Allow it to adjust height on small screens */
    background-color: #00405d;
    color: white;
    padding: 20px;
    box-sizing: border-box;
    /* min-height: 100vh; /* This might push content down, consider adjusting for mobile */
    min-height: auto; /* Adjusted for mobile */

    /* Hidden by default on small screens */
    display: none;
    position: fixed; /* Fixed position for overlay effect on mobile */
    top: 0;
    left: 0;
    height: 100%; /* Full height overlay */
    z-index: 1000; /* Ensure it's on top of other content */
    overflow-y: auto; /* Enable scrolling if menu items exceed screen height */
    -webkit-overflow-scrolling: touch; /* For smoother scrolling on iOS */
}

/* Class to show the sidebar */
.sidebar.show {
    display: block;
}

.sidebar h2 {
    margin-top: 30px;
    text-align: center;
    margin-bottom: 30px;
}

.sidebar ul {
    list-style: none;
    padding: 0;
}

.sidebar ul li {
    margin-bottom: 10px;
}

.sidebar ul li a {
    color: white;
    text-decoration: none;
    display: block;
    padding: 10px 15px;
    border-radius: 5px;
}

.sidebar ul li a:hover {
    background-color: #575757;
}

/* Main content styles */
.main-content {
    flex-grow: 1;
    padding: 20px;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    min-width: 0;
    overflow: hidden;
}

/* Banner section specific styles - ensure responsiveness */
.main-banner-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    background-color: #469fff;
    border-bottom: 1px solid #ccc;
    height: auto; /* Let content dictate height */
    min-height: 80px; /* Minimum height for better appearance */
    overflow-x: auto; /* Allow horizontal scroll if images are too wide */
    white-space: nowrap; /* Prevent images from wrapping */
}

.main-banner-icon {
    max-height: 80px;
    width: auto;
    object-fit: contain;
    flex-shrink: 0;
    margin: 0 5px; /* Add some spacing between icons */
}

/* Adjustments for specific banner images if needed (keep original sizes) */
.main-banner-section img:first-child,
.main-banner-section img:last-child {
    max-height: 80px;
}

.main-banner-section img:nth-child(2) {
    max-height: 80px;
}

/* Table container for horizontal scroll on small screens */
.pedidos-table-container {
    overflow-x: auto;
    width: 100%;
}

/* DataTables specific override for width if needed, or let DataTables handle it */
#pedidosTable {
    width: 100% !important; /* Force DataTables to respect 100% width of its container */
    min-width: 700px; /* Ensure table doesn't get too squished, allowing scroll */
}


/* All other existing styles from your original CSS */

h1 {
    text-align: center;
    color: #333;
    margin-bottom: 30px;
}

h2 {
    color: #0056b3;
    border-bottom: 2px solid #0056b3;
    padding-bottom: 10px;
    margin-top: 40px;
    margin-bottom: 20px;
}

h3 {
    color: #007bff;
    margin-top: 30px;
    margin-bottom: 15px;
}

form div {
    margin-bottom: 15px;
}

label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: #555;
}

input[type="text"],
input[type="date"],
textarea, /* Added textarea here */
select {
    width: calc(100% - 22px);
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
    font-size: 16px;
}

/* Added textarea specific width as it was missing */
textarea {
    width: calc(100% - 22px); /* Matches input width */
}

button {
    background-color: #007bff;
    color: white;
    padding: 10px 15px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    margin-right: 10px;
    transition: background-color 0.3s ease;
}

button:hover {
    background-color: #0056b3;
}

button:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
}

.quick-add-button {
    background-color: #28a745;
}

.quick-add-button:hover {
    background-color: #218838;
}

.small-text {
    font-size: 0.85em;
    color: #777;
    margin-top: 5px;
}

table {
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
    margin-top: 20px;
    background-color: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

th, td {
    border: 1px solid #ddd;
    padding: 12px;
    text-align: left;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

th {
    background-color: #f2f2f2;
    color: #333;
    font-weight: bold;
}

tr:nth-child(even) {
    background-color: #f9f9f9;
}

tr:hover {
    background-color: #e9e9e9;
}

td a {
    color: #007bff;
    text-decoration: none;
}

td a:hover {
    text-decoration: underline;
}

hr {
    border: 0;
    height: 1px;
    background: #ccc;
    margin: 40px 0;
}

.success-message {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
    padding: 10px;
    margin-bottom: 20px;
    border-radius: 5px;
    text-align: center;
}

.error-message {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    padding: 10px;
    margin-bottom: 20px;
    border-radius: 5px;
    text-align: center;
}

/* Modal styles */
.modal {
    display: none; /* Por defecto, el modal está oculto */
    position: fixed;
    z-index: 1001; /* Asegúrate de que esté por encima de la barra lateral */
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.4);
    align-items: center;    /* Centrado vertical (solo cuando display: flex) */
    justify-content: center; /* Centrado horizontal (solo cuando display: flex) */
}

.modal.show-modal { /* Nueva clase para mostrar el modal con flexbox */
    display: flex;
}

/* El resto de tu CSS para .modal-content, etc., se mantiene igual */
.modal-content {
    background-color: #fefefe;
    margin: auto;
    padding: 20px;
    border: 1px solid #888;
    width: 80%;
    max-width: 800px;
    box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2), 0 6px 20px 0 rgba(0,0,0,0.19);
    animation-name: animatetop;
    animation-duration: 0.4s;
    border-radius: 8px;
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
}

.close-button {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    position: absolute;
    top: 10px;
    right: 20px;
}

.close-button:hover,
.close-button:focus {
    color: black;
    text-decoration: none;
    cursor: pointer;
}

.employee-modal-list {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid #ddd;
    padding: 10px;
    border-radius: 4px;
    background-color: #f9f9f9;
}

.employee-modal-list label {
    display: block;
    padding: 8px 0;
    border-bottom: 1px dashed #eee;
    cursor: pointer;
}

.employee-modal-list label:last-child {
    border-bottom: none;
}

.employee-modal-list label:hover {
    background-color: #e6e6e6;
}

.employee-tags-container {
    border: 1px solid #ccc;
    padding: 8px;
    min-height: 40px;
    max-height: 120px;
    overflow-y: auto;
    border-radius: 4px;
    background-color: #fff;
    margin-top: 10px;
}

.employee-tag {
    display: inline-block;
    background-color: #e1cb53;
    color: black;
    padding: 5px 10px;
    border-radius: 15px;
    margin: 3px;
    font-size: 0.9em;
}

.employee-tag .remove-tag {
    margin-left: 8px;
    color: black;
    text-decoration: none;
    font-weight: bold;
    cursor: pointer;
}

.filter-options {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.filter-options > div {
    flex: 1 1 auto; /* Allow items to grow and shrink, with basis auto */
    min-width: 150px; /* Adjusted min-width for filters */
}

.filter-form {
    margin-bottom: 20px;
    padding: 15px;
    border: 1px solid #eee;
    background-color: #fdfdfd;
    border-radius: 5px;
    display: flex;
    flex-wrap: wrap; /* Allow wrapping on smaller screens */
    align-items: center;
    gap: 10px;
}

.filter-form label {
    margin-bottom: 0;
    flex-shrink: 0;
}

.filter-form input[type="date"],
.filter-form select {
    flex-grow: 1;
    max-width: 100%; /* Allow full width within its flex item */
}

.filter-form button {
    padding: 8px 12px;
    font-size: 14px;
}

.summary-count {
    font-weight: bold;
    color: #007bff;
}

#saved_orders_summary div { /* Changed from li to div based on your HTML summary */
    background-color: #eaf6ff;
    border: 1px solid #b3e0ff;
    padding: 8px 12px;
    margin-bottom: 5px;
    border-radius: 4px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.remove-saved-order {
    background: none;
    border: none;
    color: #dc3545;
    font-size: 1.2em;
    cursor: pointer;
    padding: 0 5px;
}

.remove-saved-order:hover {
    color: #c82333;
    background-color: transparent;
}

.welcome-section {
    padding: 20px;
    background-color: #e9f7ef;
    border: 1px solid #cce5d5;
    border-radius: 8px;
    margin-top: 30px;
    color: #1a5225;
}

.welcome-section p {
    font-size: 1.1em;
    line-height: 1.6;
}

.welcome-section ul {
    list-style-type: disc;
    margin-left: 20px;
    padding-left: 0;
}

.welcome-section li {
    margin-bottom: 8px;
}

.profile-photo-container {
    text-align: center;
    margin-bottom: 20px;
}

.profile-photo {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #fefefe;
    box-shadow: 0 0 8px rgba(0, 0, 0, 0.3);
    text-align: center;
    background-color: #3b5998;
    color: white;
    border-bottom: 1px solid #4a67a5;
}

.disabled-select-display {
    display: inline-block;
    padding: 8px 12px;
    border: 1px solid #ccc;
    background-color: #e9e9e9;
    color: #333;
    border-radius: 4px;
    margin-left: 10px;
    min-width: 200px;
}

.profile-avatar {
    max-width: 100%;
    height: auto;
    border-radius: 50%;
    display: block;
    margin: 0 auto;
}

.logout-button {
    display: inline-block;
    padding: 10px 15px;
    background-color: #dc3545;
    color: white;
    text-decoration: none;
    border-radius: 5px;
    transition: background-color 0.3s ease;
    margin-left: 13px;
}

.logout-button:hover {
    background-color: #c82333;
}

.logout-button:visited {
    color: #cccccc;
}

.acciones-btns {
    display: flex;
    flex-direction: column;
    gap: 8px;
    justify-content: stretch;
    align-items: stretch;
    min-width: 120px;
    padding: 0 !important;
}

.acciones-btns button {
    width: 100%;      /* <-- Haz que ocupen todo el ancho de la celda */
    min-width: 0;
    white-space: nowrap;
    padding: 7px 0;
    font-size: 15px;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    transition: background 0.2s;
    box-sizing: border-box;
    margin-top: 5px;
}

.generate-employee-list-btn {
    background-color: #28a745;
    color: white;
}

.generate-employee-list-btn:hover {
    background-color: #218838;
}

.delete-pedido-btn, .delete-racion-extra-btn {
    background-color: #dc3545;
    color: white;
}

.delete-pedido-btn:hover, .delete-racion-extra-btn:hover {
    background-color: #b52a37;
}


/* Media Queries for responsiveness */

/* Large screens (e.g., desktops, tablets in landscape) */
@media (min-width: 769px) {
    body {
        flex-direction: row; /* Sidebar and main content side-by-side */
    }

    .sidebar {
        width: 350px;
        flex-shrink: 0;
        flex-basis: 350px;
        min-height: 100vh; /* Restore full height for desktop */
        position: static; /* Remove fixed positioning */
        display: block !important; /* Always visible on desktop */
    }

    .sidebar-toggle-btn {
        display: none; /* Hide toggle button on desktop */
    }

    .main-content {
        /* No specific changes needed here from original desktop styles */
    }

    .modal-content {
        margin: 5% auto; /* Restore original margin for desktop modal */
        width: 80%; /* Restore original width for desktop modal */
    }
}

/* Medium screens (e.g., tablets in portrait, large phones) */
@media (min-width: 481px) and (max-width: 768px) {
    body {
        padding: 15px;
        gap: 15px;
    }
    .main-content {
        padding: 15px;
    }
    .modal-content {
        width: 95%; /* Make modal a bit wider */
        margin: 3% auto;
    }
    .filter-options > div {
        min-width: 120px; /* Adjust min-width for filters on medium screens */
    }
}

/* Small screens (e.g., mobile phones) */
@media (max-width: 480px) {
    body {
        padding: 10px;
        gap: 10px;
    }
    .main-content {
        padding: 10px;
    }
    .sidebar {
        padding: 15px;
        /* min-height: auto; already set */
    }
    .sidebar h2, .sidebar ul li a {
        font-size: 0.95em;
    }
    .modal-content {
        width: 95%; /* Wider modal for small screens */
        margin: 2% auto; /* Closer to top */
        padding: 20px;
    }
    .filter-options {
        flex-direction: column; /* Stack filters vertically */
        gap: 10px;
    }
    .filter-options > div {
        min-width: unset; /* Remove min-width when stacked */
        width: 100%; /* Take full width */
    }
    .sidebar-toggle-btn {
        display: block; /* Show toggle button on mobile */
    }

    input[type="text"],
    input[type="date"],
    textarea,
    select {
        width: 100%; /* Ensure full width on very small screens */
        padding: 8px;
        font-size: 14px;
    }

    button {
        padding: 8px 12px;
        font-size: 14px;
        margin-right: 5px;
    }

    .filter-form {
        flex-direction: column;
        align-items: flex-start;
    }
    .filter-form input, .filter-form select, .filter-form button {
        width: 100%;
        max-width: 100%;
    }

    .save-meal-buttons button,
    #submit_batch_pedido,
    #toggleExtraRationForm {
        width: 100%; /* Make action buttons full width */
        margin-bottom: 10px; /* Add space between stacked buttons */
        margin-right: 0;
    }
}