/* 
 * Shared Styles for Mess Hall Menu Modules
 * Restored to follow the original 28 Day layout exactly.
 */

.menu-container {
    max-width: 1000px;
    margin: auto;
    padding: 10px;
    position: relative;
}

.menu-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95em;
    margin-bottom: 25px;
}

.menu-table th,
.menu-table td {
    border-bottom: 1px solid #e0e0e0;
    padding: 8px 12px;
    text-align: left;
}

.menu-table th {
    background-color: #0f2d52;
    color: #fff;
    font-weight: 500;
    position: sticky;
    top: 0;
    z-index: 2;
}

.menu-table.mobile-only {
    display: none;
}

@media (max-width: 768px) {
    .menu-table.desktop-only {
        display: none;
    }

    .menu-table.mobile-only {
        display: table;
        border: none;
    }

    .menu-table.mobile-only tbody,
    .menu-table.mobile-only tr,
    .menu-table.mobile-only td {
        display: block;
        width: 100%;
        box-sizing: border-box;
    }

    .menu-table.mobile-only th {
        display: none;
    }

    .menu-table.mobile-only td {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: 10px 12px;
        border: 1px solid #e2e8f0;
        border-radius: 12px;
        margin-bottom: 16px;
        padding: 16px;
        background: #ffffff;
        box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
        transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
    }

    .menu-table.mobile-only td:active {
        transform: scale(0.98);
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
        border-color: #cbd5e1;
    }

    .recipe-name {
        grid-column: 1 / -1;
        font-weight: 600;
        font-size: 1.15em;
        color: #0f2d52;
        margin-bottom: 6px;
        border-bottom: 1.5px solid #edf2f7;
        padding-bottom: 8px;
        line-height: 1.3;
        cursor: pointer;
        position: relative;
        padding-right: 30px;
    }

    .recipe-name::after {
        content: '\24D8'; /* Native unicode info icon ⓘ */
        position: absolute;
        right: 0;
        top: 0;
        font-size: 1.2em;
        color: #1976d2;
        font-weight: normal;
    }

    .menu-table.mobile-only td.expanded .recipe-name::after {
        content: '\2715'; /* Native unicode X (close) icon ✕ */
        color: #718096;
    }

    .menu-table.mobile-only td p.label {
        display: none; /* Collapsed by default */
        flex-direction: column;
        margin: 0;
        font-size: 0.8em;
        color: #718096;
        line-height: 1.3;
        font-weight: 500;
        font-style: normal;
    }

    .menu-table.mobile-only td.expanded p.label {
        display: flex; /* Shown when expanded */
    }

    .menu-table.mobile-only td p.label .value {
        margin-left: 0;
        margin-top: 3px;
        color: #1a202c;
        font-weight: 600;
        font-size: 1.05em;
    }

    .section-title {
        position: sticky;
        top: 0;
        background-color: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(8px);
        -webkit-backdrop-filter: blur(8px);
        z-index: 5;
        padding: 10px 12px;
        border-bottom: 2px solid #0f2d52;
        border-radius: 4px;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
        margin-top: 20px;
        margin-bottom: 12px;
    }
}

.day-heading {
    position: relative;
    font-size: 1.4em;
    font-weight: 600;
    margin: 20px 0 15px;
    text-align: center;
    background: #f0f7ff;
    border-left: 4px solid #0f2d52;
    padding: 12px 40px;
    border-radius: 4px;
}

.nav-icon {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    font-size: 1.4em;
    color: #0f2d52;
}

.nav-icon.left {
    left: 10px;
}

.nav-icon.right {
    right: 10px;
}

.nav-icon:hover {
    opacity: 0.7;
}

.meal-title {
    font-weight: 600;
    margin-top: 25px;
    margin-bottom: 12px;
    font-size: 1.4em;
    color: #0f2d52;
}

/* Loader styling */
#loader {
    border: 6px solid #f3f3f3;
    border-top: 6px solid #0f2d52;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 50px auto;
    display: block;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Holiday menu specific styles */
.holiday-day {
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 25px;
    background: #fff;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.holiday-day ul {
    margin-top: 5px;
    margin-bottom: 15px;
    padding-left: 20px;
}

.holiday-day li {
    margin-bottom: 4px;
}

.status-line {
    margin: 10px 0;
}

.section-title {
    font-weight: 600;
    margin-top: 15px;
    margin-bottom: 5px;
    color: #0f2d52;
}

/* Scrollable container option with frozen/sticky header */
.scrollable-table-container {
    display: block;
    width: 100%;
    overflow-x: auto;
    overflow-y: auto;
    max-height: 500px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin-bottom: 25px;
    -webkit-overflow-scrolling: touch;
}

.scrollable-table-container .menu-table {
    margin-bottom: 0;
}

.scrollable-table-container .menu-table th {
    position: sticky;
    top: 0;
    z-index: 10;
    background-color: #0f2d52;
}

/* Native datepicker wrapper & input styling */
.datepicker-toggle {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* jQuery UI Datepicker hidden override */
#hiddenDatePicker {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
    font-size: 16px !important;
}

.datepicker-toggle #nativeDatePicker {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    padding: 0;
    margin: 0;
    border: none;
}

.datepicker-toggle .nav-icon {
    position: static;
    transform: none;
    display: block;
    line-height: 1;
}