/* ============================================
   Selective Touch - Modern Responsive Styles
   ============================================ */

/* ============================================
   Full Screen Popup - Flexbox Layout
   ============================================ */

/* Fullscreen popup - remove all margins and make it fill viewport */
.fullscreen-popup .dxbl-modal-dialog {
    margin: 0 !important;
    max-width: 100vw !important;
    max-height: 100vh !important;
    height: 100vh !important;
    width: 100vw !important;
    min-width: 100vw !important;
}

.fullscreen-popup .dxbl-modal-content {
    border-radius: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    height: 100% !important;
    max-height: 100vh !important;
    width: 100% !important;
}

/* Ensure the modal backdrop and container also fill the viewport */
.fullscreen-popup.dxbl-modal {
    padding: 0 !important;
}

.fullscreen-popup .dxbl-popup-cell {
    width: 100vw !important;
    justify-content: flex-start !important;
}

/* Target all possible DevExpress popup wrapper elements */
.fullscreen-popup,
.fullscreen-popup > *,
.fullscreen-popup .dxbl-popup-root,
.fullscreen-popup .dxbl-popup-wrapper,
.fullscreen-popup .dxbl-popup-content-wrapper {
    width: 100vw !important;
    max-width: 100vw !important;
    margin: 0 !important;
    padding: 0 !important;
    left: 0 !important;
}

/* Target the modal root specifically - use :has() to find modal root containing our popup */
.fullscreen-popup.dxbl-modal-root,
.dxbl-modal-root.fullscreen-popup,
.dxbl-modal-root:has(.my-popup-body) {
    width: 100vw !important;
    max-width: 100vw !important;
    min-width: 100vw !important;
    margin: 0 !important;
    padding: 0 !important;
    left: 0 !important;
    right: 0 !important;
    background: transparent !important;
}

/* Global fix for any dxbl-modal-root when fullscreen popup is open */
.dxbl-modal-root {
    display: flex !important;
    justify-content: flex-start !important;
    align-items: flex-start !important;
}

.dxbl-modal-root > .dxbl-modal {
    width: 100vw !important;
    max-width: 100vw !important;
    margin: 0 !important;
}

/* Force the modal dialog to not have max-width constraints at small sizes */
.fullscreen-popup > .dxbl-modal-dialog {
    max-width: none !important;
    width: 100vw !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}

/* Remove any centering on the fullscreen modal only */
.fullscreen-popup.dxbl-modal {
    display: flex !important;
    justify-content: flex-start !important;
    align-items: flex-start !important;
    padding: 0 !important;
}

/* Make the popup body fill the modal content */
.my-popup-body {
    flex: 1 1 0 !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    padding: 0 !important;
    min-height: 0 !important;
    height: 100% !important;
}

/* Loading panel needs to fill and be a flex container */
.my-popup-body .dxbl-loading-panel {
    flex: 1 1 0 !important;
    display: flex !important;
    flex-direction: column !important;
    min-height: 0 !important;
    height: 100% !important;
}

.my-popup-body .dxbl-loading-panel-target-content {
    flex: 1 1 0 !important;
    display: flex !important;
    flex-direction: column !important;
    min-height: 0 !important;
    height: 100% !important;
}

/* Page container fills remaining space */
.st-page-container {
    flex: 1 1 0 !important;
    display: flex !important;
    flex-direction: column !important;
    min-height: 0 !important;
    height: 100% !important;
}

/* Main content area expands to fill space, pushing footer to bottom */
.st-main-content {
    flex: 1 1 0 !important;
    display: flex !important;
    flex-direction: column !important;
    min-height: 0 !important;
    overflow: auto !important;
}

/* Resident list container needs to fill */
.st-resident-container {
    flex: 1 1 0 !important;
    display: flex !important;
    flex-direction: column !important;
    min-height: 0 !important;
}

/* Action bar and footer stay at their natural size */
.st-action-bar {
    flex: 0 0 auto !important;
}

.st-footer {
    flex: 0 0 auto !important;
    margin-top: auto !important;
}

/* TEMPORARILY COMMENTED OUT FOR TESTING - START
.dxbl-modal-content:has(.my-popup-body),
.dxbl-modal-dialog:has(.my-popup-body),
.dxbl-modal:has(.my-popup-body) {
    display: flex !important;
    flex-direction: column !important;
    height: 100vh !important;
    max-height: 100vh !important;
    overflow: hidden !important;
}

.dxbl-modal-dialog:has(.my-popup-body),
.dxbl-popup-adaptivity .dxbl-modal-dialog,
.dxbl-popup-fixed-width .dxbl-modal-dialog {
    margin: 0 !important;
    max-width: 100% !important;
    width: 100% !important;
    height: 100% !important;
    max-height: 100% !important;
}

.dxbl-popup-cell:has(.my-popup-body) {
    display: flex !important;
    flex-direction: column !important;
    height: 100vh !important;
}

.dxbl-modal-content:has(.my-popup-body) {
    flex: 1 !important;
    border-radius: 0 !important;
}

.my-popup-body > .dxbs-loading-panel,
.my-popup-body .dxbl-loading-panel {
    flex: 1 !important;
    height: 100% !important;
    max-height: 100% !important;
    min-height: 0 !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
}

.my-popup-body .dxbl-loading-panel-target-content {
    flex: 1 !important;
    display: flex !important;
    flex-direction: column !important;
    min-height: 0 !important;
    overflow: hidden !important;
    height: 100% !important;
}
TEMPORARILY COMMENTED OUT FOR TESTING - END */

/* ============================================
   Page Container - Pure Flexbox Layout
   ============================================ */
.st-page-container {
    display: flex;
    flex-direction: column;
    flex: 1;
    height: 100%;
    min-height: 0;
    overflow: hidden;
    background: #f4f5f7;
}

/* Info Header Row - Patient Info & Date Selector */
.st-info-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 16px;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    min-height: 0;
    flex-shrink: 0;
}

/* Hide info header when empty */
.st-info-header:empty,
.st-info-header.hidden {
    display: none;
}

/* Compact mode - less padding when only date selector is shown */
.st-info-header.compact {
    padding: 4px 12px;
    background: linear-gradient(180deg, #f1f5f9 0%, #e2e8f0 100%);
    border-bottom: 1px solid #cbd5e1;
    min-height: 0;
    justify-content: flex-end;
}

/* Make date selector smaller in compact mode */
.st-info-header.compact .st-datemeal-main {
    min-width: 140px;
    min-height: 48px;
    padding: 6px 12px;
}

.st-info-header-left {
    display: flex;
    align-items: center;
    flex: 1;
}

/* Hide left section when empty to prevent whitespace */
.st-info-header-left:empty {
    display: none;
}

.st-info-header-right {
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

/* When only right content exists, center it or position it nicely */
.st-info-header-left:empty + .st-info-header-right {
    flex: 1;
    justify-content: flex-end;
}

.st-search-indicator {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: flex-start;
    padding: 10px;
    font-size: 18px;
    color: #333;
}

/* Main Content Area - Takes remaining space */
.st-main-content {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
    min-height: 0; /* Important for flexbox to allow shrinking */
}

/* ============================================
   SelectiveTouchMain - Flexbox Layout
   ============================================ */

/* Main wrapper fills the content area */
.st-main-wrapper {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

/* Content area - menu + selected panel */
.st-content-area {
    display: flex;
    flex: 1;
    overflow: hidden;
    min-height: 0;
    gap: 8px;
    padding: 8px;
}

/* Menu area - scrollable */
.st-menu-area {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    min-width: 0;
    background: #f4f5f7;
}

/* Menu grid using CSS grid */
.st-menu-grid {
    display: grid;
    grid-template-columns: repeat(var(--st-column-count, 3), 1fr);
    gap: 4px;
    padding: 4px;
}

/* Selected panel - fixed width on desktop, visible on large tablets when locked */
.st-selected-panel {
    width: 320px;
    min-width: 320px;
    max-width: 320px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: 100%; /* Ensure panel takes full height of parent */
    min-height: 0; /* Allow flex shrinking */
}

.st-selected-panel-header {
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    color: white;
    padding: 14px 16px;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.5px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0; /* Prevent header from shrinking */
}

.st-panel-lock-btn {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.st-panel-lock-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.st-selected-note {
    padding: 10px 16px;
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    color: #92400e;
    font-size: 13px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid #f59e0b;
    flex-shrink: 0; /* Prevent note from shrinking */
}

.st-selected-flags {
    padding: 10px 16px;
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    color: #065f46;
    font-size: 13px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid #10b981;
    flex-shrink: 0; /* Prevent flags from shrinking */
}

.st-selected-list {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
}

.st-selected-list .dxbs-grid {
    height: 100% !important;
}

/* Modern action buttons */
.st-selected-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 12px;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    flex-shrink: 0; /* Prevent actions from shrinking */
}

.st-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 48px;
    font-size: 13px;
    font-weight: 600;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    transition: all 0.15s ease;
}

.st-action-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.st-action-btn.primary {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
}

.st-action-btn.primary:hover:not(:disabled) {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    transform: translateY(-1px);
}

.st-action-btn.danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
}

.st-action-btn.danger:hover:not(:disabled) {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    transform: translateY(-1px);
}

.st-action-btn.danger-outline {
    background: white;
    color: #dc2626;
    border: 2px solid #fecaca;
}

.st-action-btn.danger-outline:hover:not(:disabled) {
    background: #fef2f2;
    border-color: #f87171;
}

.st-action-btn:active:not(:disabled) {
    transform: scale(0.97);
}

/* Responsive - hide panel on smaller screens unless locked */
@media (max-width: 1024px) {
    .st-selected-panel {
        display: none;
    }

    .st-selected-panel.locked {
        display: flex;
        width: 280px;
        min-width: 280px;
        max-width: 280px;
    }

    .st-drawer-fab {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .st-drawer-fab.hidden {
        display: none;
    }
}

@media (max-width: 768px) {
    .st-selected-panel {
        display: none !important;
    }

    .st-menu-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .st-menu-grid {
        grid-template-columns: 1fr;
    }
}

/* Resident list horizontal scroll container */
.horizontal-grid-wrapper {
    width: 100%;
    height: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    padding: 0.5rem;
    /* Hide scrollbar but keep functionality */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
}

.horizontal-grid-wrapper::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
}

/* Action bar styling - ensure it's always visible */
.st-action-bar {
    width: 100%;
    height: 56px;
    min-height: 56px;
    max-height: 56px;
    background-color: #4a6fa5;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 16px;
    gap: 12px;
    flex-shrink: 0;
    overflow-x: auto;
    overflow-y: hidden;
}

.st-action-bar-left,
.st-action-bar-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.st-action-bar-right {
    justify-content: flex-end;
}

/* Footer bar styling - ensure it's always visible */
.st-footer {
    width: 100%;
    height: 72px;
    min-height: 72px;
    max-height: 72px;
    background-color: #2d3748;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 16px;
    gap: 12px;
    flex-shrink: 0;
}

.st-footer-left {
    flex: 1;
    display: flex;
    justify-content: flex-start;
}

.st-footer-center {
    flex: 1;
    display: flex;
    justify-content: center;
    gap: 8px;
}

.st-footer-right {
    flex: 1;
    display: flex;
    justify-content: flex-end;
}

/* CSS Custom Properties (Variables) */
:root {
    /* Column count - set dynamically from facility setting via Blazor */
    --st-column-count: 3;

    /* Touch target sizes - minimum 48px for accessibility */
    --st-item-height: 48px;
    --st-button-height: 48px;
    --st-button-min-width: 100px;

    /* Spacing */
    --st-gap: 6px;
    --st-padding: 16px;
    --st-border-radius: 8px;

    /* Colors - Modern palette */
    --st-header-bg: #2d3748;
    --st-footer-bg: #2d3748;
    --st-accent-bg: #4a6fa5;
    --st-accent-hover: #3d5d8a;

    /* Category colors - softer versions */
    --st-category-header-bg: #e8eaed;
    --st-category-header-text: #1a73e8;

    /* Selected panel */
    --st-selected-panel-width: 300px;
    --st-selected-panel-bg: #ffffff;

    /* Card styling */
    --st-card-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --st-card-shadow-hover: 0 4px 16px rgba(0, 0, 0, 0.15);

    /* Transitions */
    --st-transition-fast: 150ms ease;
    --st-transition-normal: 250ms ease;
}

/* ============================================
   Main Container
   ============================================ */
.st-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

/* ============================================
   Header Toolbar
   ============================================ */
.st-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px var(--st-padding);
    background-color: var(--st-header-bg);
    color: white;
    min-height: 56px;
    gap: var(--st-gap);
}

.st-header-left,
.st-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.st-header-right {
    justify-content: flex-end;
}

/* ============================================
   Main Content Area
   ============================================ */
.st-main {
    display: flex;
    flex: 1;
    overflow: hidden;
    gap: var(--st-gap);
    padding: var(--st-gap);
}

/* Menu Grid Container */
.st-menu-area {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    background: #f4f5f7;
}

/* Responsive Menu Grid */
.st-menu-grid {
    display: grid;
    grid-template-columns: repeat(var(--st-column-count), 1fr);
    grid-template-rows: repeat(var(--st-row-count), auto);
    gap: var(--st-gap);
    padding: 4px;
}

/* ============================================
   Menu Category Cards
   ============================================ */
.st-category-card {
    background: white;
    border-radius: var(--st-border-radius);
    box-shadow: var(--st-card-shadow);
    overflow: hidden;
    transition: box-shadow var(--st-transition-normal);
}

.st-category-card:hover {
    box-shadow: var(--st-card-shadow-hover);
}

.st-category-header {
    background-color: var(--st-category-header-bg);
    color: var(--st-category-header-text);
    padding: 12px var(--st-padding);
    font-size: 16px;
    font-weight: 600;
    text-align: center;
    position: sticky;
    top: 0;
    z-index: 1;
}

.st-category-items {
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* ============================================
   Menu Item Buttons
   ============================================ */
.st-item-button {
    min-height: var(--st-item-height);
    padding: 10px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 500;
    text-align: center;
    transition: transform var(--st-transition-fast),
                background-color var(--st-transition-fast),
                box-shadow var(--st-transition-fast);
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.st-item-button:hover {
    filter: brightness(0.95);
}

.st-item-button:active {
    transform: scale(0.97);
}

/* Ripple effect on tap */
.st-item-button::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle, rgba(255,255,255,0.3) 0%, transparent 70%);
    opacity: 0;
    transition: opacity var(--st-transition-fast);
}

.st-item-button:active::after {
    opacity: 1;
}

/* Chef's Special styling */
.st-chefs-special {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-weight: 600;
}

/* ============================================
   Selected Items Panel
   ============================================ */
.st-selected-panel {
    width: var(--st-selected-panel-width);
    background: var(--st-selected-panel-bg);
    border-radius: var(--st-border-radius);
    box-shadow: var(--st-card-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: transform var(--st-transition-normal);
}

.st-selected-header {
    background-color: var(--st-header-bg);
    color: white;
    padding: 12px var(--st-padding);
    font-size: 14px;
    font-weight: 600;
    text-align: center;
}

.st-selected-note {
    padding: 8px var(--st-padding);
    background: #fff3cd;
    color: #856404;
    font-size: 14px;
    text-align: center;
    border-bottom: 1px solid #ffc107;
}

.st-selected-flags {
    padding: 8px var(--st-padding);
    background: #d4edda;
    color: #155724;
    font-size: 14px;
    text-align: center;
    border-bottom: 1px solid #28a745;
}

.st-selected-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.st-selected-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    padding: 8px;
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
}

.st-action-button {
    min-height: var(--st-button-height);
    padding: 10px 8px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    background-color: #1a73e8;
    color: white;
    transition: background-color var(--st-transition-fast);
}

.st-action-button:hover {
    background-color: #1557b0;
}

.st-action-button:active {
    background-color: #0d47a1;
}

.st-action-button.danger {
    background-color: #dc3545;
}

.st-action-button.danger:hover {
    background-color: #c82333;
}

/* ============================================
   Footer Toolbar
   ============================================ */
.st-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px var(--st-padding);
    background-color: var(--st-footer-bg);
    min-height: 72px;
    gap: var(--st-gap);
    flex-shrink: 0;
}

.st-footer-left,
.st-footer-center,
.st-footer-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.st-footer-center {
    justify-content: center;
}

.st-footer-right {
    justify-content: flex-end;
}

/* ============================================
   Middle Action Bar
   ============================================ */
.st-action-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px var(--st-padding);
    background-color: var(--st-accent-bg);
    min-height: 56px;
    gap: var(--st-gap);
    flex-shrink: 0;
}

.st-action-bar-left,
.st-action-bar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ============================================
   Meal Type Tabs
   ============================================ */
.st-meal-tabs {
    display: flex;
    gap: 8px;
    padding: 8px var(--st-padding);
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.st-meal-tab {
    min-height: var(--st-button-height);
    min-width: 120px;
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 500;
    background-color: #e9ecef;
    color: #495057;
    transition: all var(--st-transition-fast);
    white-space: nowrap;
}

.st-meal-tab:hover {
    background-color: #dee2e6;
}

.st-meal-tab.active {
    background-color: #1a73e8;
    color: white;
}

/* ============================================
   Patient Info Header
   ============================================ */
.st-patient-info {
    display: flex;
    align-items: center;
    gap: var(--st-gap);
    padding: 8px var(--st-padding);
    background: white;
    border-radius: var(--st-border-radius);
    box-shadow: var(--st-card-shadow);
}

.st-patient-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #e9ecef;
}

.st-patient-details {
    flex: 1;
}

.st-patient-name {
    font-size: 18px;
    font-weight: 600;
    color: #212529;
    margin: 0;
}

.st-patient-room {
    font-size: 14px;
    color: #6c757d;
    margin: 4px 0 0 0;
}

.st-patient-diet {
    font-size: 13px;
    color: #6c757d;
    margin: 2px 0 0 0;
}

.st-patient-badges {
    display: flex;
    gap: 4px;
    margin-top: 6px;
}

.st-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 28px;
    padding: 0 8px;
    border-radius: 14px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}

.st-badge.allergy {
    background-color: #dc3545;
    color: white;
}

.st-badge.alert {
    background-color: #ffc107;
    color: #212529;
}

/* ============================================
   Date/Meal Selector
   ============================================ */
.st-date-meal-selector {
    display: flex;
    gap: 8px;
    align-items: center;
}

.st-date-meal-tile {
    min-width: 110px;
    min-height: 60px;
    padding: 8px 12px;
    border: 2px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    text-align: center;
    background: white;
    transition: all var(--st-transition-fast);
}

.st-date-meal-tile:hover {
    border-color: #1a73e8;
}

.st-date-meal-tile.active {
    background: #1a73e8;
    color: white;
}

.st-date-meal-tile .meal-name {
    font-size: 14px;
    font-weight: 600;
}

.st-date-meal-tile .meal-date {
    font-size: 12px;
    opacity: 0.8;
    margin-top: 2px;
}

/* ============================================
   Mobile Drawer for Selected Items
   ============================================ */

/* Floating Action Button (FAB) to toggle drawer */
.st-drawer-fab {
    display: none;
    position: fixed;
    bottom: 140px;
    right: 20px;
    width: 64px;
    height: 64px;
    border-radius: 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    box-shadow: 0 6px 24px rgba(102, 126, 234, 0.4);
    cursor: pointer;
    z-index: 100;
    font-size: 26px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.st-drawer-fab:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 28px rgba(102, 126, 234, 0.5);
}

.st-drawer-fab:active {
    transform: scale(0.95);
}

.st-drawer-fab.hidden {
    display: none !important;
}

.st-drawer-fab i {
    font-size: 26px;
}

/* Badge showing count of selected items */
.st-drawer-fab .st-fab-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    min-width: 28px;
    height: 28px;
    padding: 0 8px;
    border-radius: 14px;
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    font-size: 14px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 3px 8px rgba(220, 53, 69, 0.4);
    animation: st-badge-pulse 2s ease-in-out infinite;
    border: 3px solid white;
}

@keyframes st-badge-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.st-drawer-fab .st-fab-badge.empty {
    display: none;
}

/* Drawer overlay */
.st-drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 200;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
}

.st-drawer-overlay.visible {
    opacity: 1;
    visibility: visible;
}

/* Selected panel as drawer */
.st-selected-panel-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 85%;
    max-width: 360px;
    z-index: 300;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: white;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
    display: none;
    flex-direction: column;
}

.st-selected-panel-drawer.open {
    transform: translateX(0);
}

/* Locked drawer stays in position without overlay */
.st-selected-panel-drawer.locked {
    position: relative;
    transform: none;
    box-shadow: none;
    border-left: 1px solid #e2e8f0;
    max-width: 320px;
    width: 320px;
    min-width: 320px;
}

/* Drawer header */
.st-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    color: white;
    min-height: 60px;
}

.st-drawer-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.st-drawer-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.st-drawer-lock {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.st-drawer-lock:hover {
    background: rgba(255, 255, 255, 0.2);
}

.st-drawer-lock.active {
    background: #10b981;
}

.st-drawer-close {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease;
}

.st-drawer-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Drawer content */
.st-drawer-content {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    display: flex;
    flex-direction: column;
}

.st-drawer-note {
    padding: 12px 16px;
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    color: #92400e;
    font-size: 13px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.st-drawer-flags {
    padding: 12px 16px;
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    color: #065f46;
    font-size: 13px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.st-empty-hint {
    font-size: 12px;
    opacity: 0.7;
}

/* Drawer footer actions */
.st-drawer-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 12px;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    flex-shrink: 0;
}

/* Show drawer on tablet and below */
@media (max-width: 1024px) {
    .st-selected-panel-drawer {
        display: flex;
    }

    .st-selected-panel-drawer.locked {
        display: flex;
    }

    /* When drawer is locked, adjust content area */
    .st-content-area:has(.st-selected-panel-drawer.locked) {
        padding-right: 0;
    }
}

@media (max-width: 768px) {
    .st-selected-panel-drawer {
        max-width: 100%;
        width: 100%;
    }

    .st-selected-panel-drawer.locked {
        position: fixed;
        width: 85%;
        max-width: 340px;
        border-left: none;
        box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
    }
}

/* Legacy toggle button (deprecated, use FAB) */
.st-drawer-toggle {
    display: none;
    position: fixed;
    bottom: 100px;
    right: 16px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #1a73e8;
    color: white;
    border: none;
    box-shadow: 0 4px 12px rgba(26, 115, 232, 0.4);
    cursor: pointer;
    z-index: 100;
    font-size: 24px;
    transition: transform var(--st-transition-fast);
}

.st-drawer-toggle:active {
    transform: scale(0.95);
}

.st-drawer-toggle .badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 24px;
    height: 24px;
    border-radius: 12px;
    background: #dc3545;
    color: white;
    font-size: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ============================================
   Responsive Breakpoints
   ============================================ */

/* Large tablets and small desktops (1024px - 1366px) */
@media (max-width: 1366px) {
    :root {
        --st-selected-panel-width: 280px;
    }
}

/* Tablets landscape (768px - 1024px) */
@media (max-width: 1024px) {
    .st-menu-grid {
        /* Limit to max 2 columns on tablet landscape */
        grid-template-columns: repeat(min(var(--st-column-count), 2), 1fr);
    }

    :root {
        --st-selected-panel-width: 260px;
    }
}

/* Tablets portrait (600px - 768px) */
@media (max-width: 768px) {
    .st-menu-grid {
        /* Single column on tablet portrait */
        grid-template-columns: 1fr;
    }

    /* Hide the desktop selected panel column */
    .st-selected-panel-container {
        display: none !important;
    }

    /* Show the floating action button */
    .st-drawer-fab {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Adjust main area to use full width */
    .st-main {
        padding: 8px;
    }

    .st-menu-area {
        width: 100%;
    }

    /* Stack header items */
    .st-header {
        flex-wrap: wrap;
        min-height: auto;
        padding: 8px;
    }

    /* Larger touch targets on mobile */
    :root {
        --st-item-height: 52px;
        --st-button-height: 52px;
    }

    /* Footer adjustments */
    .st-footer {
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px;
    }

    .st-footer-left,
    .st-footer-center,
    .st-footer-right {
        flex: 1;
        min-width: 100px;
    }

    /* Adjust action bar for mobile */
    .st-action-bar {
        flex-wrap: wrap;
        min-height: auto;
    }

    .st-action-bar-left,
    .st-action-bar-right {
        flex-wrap: wrap;
    }
}

/* Small phones (< 480px) */
@media (max-width: 480px) {
    :root {
        --st-padding: 12px;
        --st-gap: 8px;
        --st-item-height: 56px;
        --st-button-height: 56px;
    }

    .st-category-header {
        font-size: 14px;
        padding: 10px 12px;
    }

    .st-item-button {
        font-size: 14px;
        padding: 12px;
    }

    .st-meal-tab {
        min-width: 100px;
        padding: 10px 16px;
        font-size: 14px;
    }

    .st-patient-name {
        font-size: 16px;
    }

    .st-patient-avatar {
        width: 48px;
        height: 48px;
    }
}

/* ============================================
   Utility Classes
   ============================================ */
.st-hidden {
    display: none !important;
}

.st-visible-mobile {
    display: none;
}

.st-visible-desktop {
    display: block;
}

@media (max-width: 768px) {
    .st-visible-mobile {
        display: block;
    }

    .st-visible-desktop {
        display: none;
    }
}

/* Smooth scrolling */
.st-scroll {
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

/* Focus styles for accessibility */
.st-item-button:focus-visible,
.st-action-button:focus-visible,
.st-meal-tab:focus-visible {
    outline: 3px solid #1a73e8;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .st-item-button,
    .st-action-button {
        border: 2px solid currentColor;
    }

    .st-category-card {
        border: 2px solid #000;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ============================================
   Patient Info Card - Modernized (Phase 3)
   ============================================ */
/* Modern Patient Info Card - Clean white design */
.st-patient-info-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    background: white;
    border-radius: 14px;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.2s ease;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    min-height: 70px;
    max-width: 380px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08), 0 1px 3px rgba(0, 0, 0, 0.06);
    border: 1px solid rgba(0, 0, 0, 0.06);
}

.st-patient-info-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12), 0 2px 6px rgba(0, 0, 0, 0.08);
}

.st-patient-info-card:active {
    transform: scale(0.99);
}

.st-patient-info-card:focus-visible {
    outline: 3px solid #1a73e8;
    outline-offset: 2px;
}

/* Avatar Section */
.st-patient-avatar-section {
    position: relative;
    flex-shrink: 0;
}

.st-patient-avatar {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    object-fit: cover;
    border: none;
    background: #e8eef4;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.st-patient-avatar-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #e8eef4 0%, #d0dae5 100%);
    color: #5a7184;
    font-size: 22px;
}

/* Badge Indicators - positioned at bottom right of avatar */
.st-patient-info-card .st-patient-badges {
    position: absolute;
    bottom: -6px;
    right: -6px;
    display: flex;
    gap: 2px;
}

.st-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 5px;
    border-radius: 11px;
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    border: 2px solid white;
}

.st-badge-allergy {
    background: #ef4444;
    color: white;
}

.st-badge-allergen {
    background: #22c55e;
    color: white;
}

.st-badge-special {
    background: #f59e0b;
    color: white;
}

.st-badge-notes {
    background: #6366f1;
    color: white;
}

/* Patient Details Section */
.st-patient-info-card .st-patient-details {
    flex: 1;
    min-width: 0;
}

.st-patient-info-card .st-patient-name {
    font-size: 16px;
    font-weight: 600;
    color: #1e293b;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.st-patient-info-card .st-patient-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 3px;
    font-size: 13px;
    color: #64748b;
}

.st-patient-info-card .st-patient-room {
    display: flex;
    align-items: center;
    gap: 4px;
    font-weight: 500;
}

.st-patient-info-card .st-patient-room i {
    font-size: 12px;
    color: #94a3b8;
}

.st-patient-info-card .st-patient-unit {
    padding: 2px 8px;
    background: #1a73e8;
    color: white;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
}

.st-patient-info-card .st-patient-diet {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 3px;
    font-size: 12px;
    color: #94a3b8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.st-patient-info-card .st-patient-diet i {
    font-size: 11px;
    color: #94a3b8;
}

/* Tap Hint Chevron */
.st-patient-tap-hint {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #cbd5e1;
    font-size: 16px;
    transition: color 0.15s ease, transform 0.15s ease;
}

.st-patient-info-card:hover .st-patient-tap-hint {
    color: #1a73e8;
    transform: translateX(2px);
}

/* Responsive adjustments for patient card */
@media (max-width: 768px) {
    .st-patient-info-card {
        max-width: 100%;
        padding: 10px 12px;
    }

    .st-patient-avatar {
        width: 46px;
        height: 46px;
        border-radius: 12px;
    }

    .st-patient-info-card .st-patient-name {
        font-size: 15px;
    }

    .st-patient-info-card .st-patient-meta {
        font-size: 12px;
    }

    .st-badge {
        min-width: 20px;
        height: 20px;
        font-size: 8px;
        padding: 0 4px;
    }
}

@media (max-width: 480px) {
    .st-patient-tap-hint {
        display: none;
    }

    .st-patient-info-card {
        min-height: 60px;
    }
}

/* ============================================
   Date/Meal Selector - Modernized (Phase 4)
   ============================================ */

/* Main date/meal display button */
.st-datemeal-main {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    min-width: 160px;
    min-height: 60px;
    background: linear-gradient(135deg, #1a73e8 0%, #0d47a1 100%);
    border-radius: 10px;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.2s ease;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    box-shadow: 0 2px 8px rgba(26, 115, 232, 0.3);
    color: white;
}

.st-datemeal-main:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(26, 115, 232, 0.4);
}

.st-datemeal-main:active {
    transform: scale(0.98);
}

.st-datemeal-main:focus-visible {
    outline: 3px solid #fff;
    outline-offset: 2px;
}

.st-datemeal-main.disabled {
    background: linear-gradient(135deg, #94a3b8 0%, #64748b 100%);
    cursor: not-allowed;
    opacity: 0.6;
    box-shadow: none;
}

.st-datemeal-main.disabled:hover {
    transform: none;
    box-shadow: none;
}

.st-datemeal-main.disabled:active {
    transform: none;
}

.st-datemeal-icon {
    font-size: 20px;
    opacity: 0.9;
}

.st-datemeal-content {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.st-datemeal-date {
    font-size: 15px;
    font-weight: 600;
    line-height: 1.3;
}

.st-datemeal-meal {
    font-size: 13px;
    opacity: 0.9;
    line-height: 1.3;
}

.st-datemeal-chevron {
    font-size: 14px;
    opacity: 0.8;
    transition: transform 0.2s ease;
}

.st-datemeal-main:hover .st-datemeal-chevron {
    transform: translateY(2px);
}

/* Popup container */
.st-datemeal-popup {
    border-radius: 12px !important;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2) !important;
}

.st-datemeal-popup-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: #f8f9fa;
}

.st-datemeal-popup-header {
    padding: 14px 20px;
    background: #2d3748;
    color: white;
    font-size: 16px;
    font-weight: 600;
    text-align: center;
}

/* Grid wrapper */
.st-datemeal-grid-wrapper {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.st-datemeal-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 12px;
}

/* Individual date/meal tiles */
.st-datemeal-tile {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 16px 12px;
    min-height: 80px;
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.st-datemeal-tile:hover {
    border-color: #1a73e8;
    background: #f0f7ff;
}

.st-datemeal-tile:active {
    transform: scale(0.97);
}

.st-datemeal-tile.selected {
    background: linear-gradient(135deg, #1a73e8 0%, #0d47a1 100%);
    border-color: transparent;
    color: white;
    box-shadow: 0 4px 12px rgba(26, 115, 232, 0.3);
}

.st-datemeal-tile.viewed {
    border-color: #28a745;
}

.st-datemeal-tile.modified {
    border-color: #ffc107;
}

.st-datemeal-tile-date {
    font-size: 15px;
    font-weight: 600;
    line-height: 1.3;
}

.st-datemeal-tile-meal {
    font-size: 14px;
    opacity: 0.8;
    line-height: 1.3;
    margin-top: 4px;
}

.st-datemeal-tile-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    font-size: 12px;
    color: #28a745;
}

.st-datemeal-tile.selected .st-datemeal-tile-badge {
    color: rgba(255, 255, 255, 0.9);
}

.st-datemeal-tile-modified {
    position: absolute;
    bottom: 4px;
    right: 4px;
    font-size: 10px;
    color: #ffc107;
}

.st-datemeal-tile.selected .st-datemeal-tile-modified {
    color: rgba(255, 255, 255, 0.9);
}

/* Add Other Section */
.st-datemeal-add-section {
    padding: 12px;
    background: #e2e8f0;
    border-top: 1px solid #cbd5e0;
}

.st-datemeal-other-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px 16px;
    min-height: 48px;
    background: white;
    border: 2px dashed #a0aec0;
    border-radius: 8px;
    color: #4a5568;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

.st-datemeal-other-btn:hover {
    border-color: #1a73e8;
    color: #1a73e8;
    background: #f0f7ff;
}

.st-datemeal-other-btn i {
    font-size: 18px;
}

/* Add Form */
.st-datemeal-add-form {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.st-datemeal-datepicker {
    min-width: 140px;
}

.st-datemeal-meal-buttons {
    display: flex;
    gap: 4px;
}

.st-datemeal-meal-btn {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    color: #4a5568;
    cursor: pointer;
    transition: all 0.15s ease;
}

.st-datemeal-meal-btn:hover {
    border-color: #1a73e8;
    color: #1a73e8;
}

.st-datemeal-meal-btn.selected {
    background: #1a73e8;
    border-color: #1a73e8;
    color: white;
}

.st-datemeal-action-btn {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 8px;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.st-datemeal-action-btn.success {
    background: #28a745;
    color: white;
}

.st-datemeal-action-btn.success:hover {
    background: #218838;
}

.st-datemeal-action-btn.cancel {
    background: #dc3545;
    color: white;
}

.st-datemeal-action-btn.cancel:hover {
    background: #c82333;
}

/* Responsive adjustments for date/meal selector */
@media (max-width: 768px) {
    .st-datemeal-main {
        min-width: 140px;
        padding: 8px 12px;
    }

    .st-datemeal-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 480px) {
    .st-datemeal-main {
        min-width: 120px;
    }

    .st-datemeal-icon {
        display: none;
    }

    .st-datemeal-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .st-datemeal-add-form {
        flex-direction: column;
        align-items: stretch;
    }

    .st-datemeal-meal-buttons {
        justify-content: center;
    }
}

/* ============================================
   Drawer Improvements - Phase 5
   ============================================ */

/* Drawer note styling */
.st-drawer-note {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: linear-gradient(135deg, #fff3cd 0%, #ffeeba 100%);
    color: #856404;
    font-size: 14px;
    font-weight: 500;
    border-bottom: 1px solid #ffc107;
}

.st-drawer-note i {
    font-size: 16px;
    flex-shrink: 0;
}

/* Drawer flags styling */
.st-drawer-flags {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    color: #155724;
    font-size: 14px;
    font-weight: 500;
    border-bottom: 1px solid #28a745;
}

.st-drawer-flags i {
    font-size: 16px;
    flex-shrink: 0;
}

/* Drawer items list container */
.st-drawer-items-list {
    height: calc(100vh - 280px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* Drawer empty state */
.st-drawer-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: #a0aec0;
    text-align: center;
}

.st-drawer-empty i {
    font-size: 48px;
    margin-bottom: 12px;
    opacity: 0.5;
}

.st-drawer-empty span {
    font-size: 15px;
    font-weight: 500;
}

/* ============================================
   Loading Skeleton/Shimmer Effects
   ============================================ */

/* Skeleton base */
.st-skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: st-skeleton-shimmer 1.5s ease-in-out infinite;
    border-radius: 4px;
}

@keyframes st-skeleton-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Skeleton variants */
.st-skeleton-text {
    height: 16px;
    width: 100%;
    margin-bottom: 8px;
}

.st-skeleton-text.short {
    width: 60%;
}

.st-skeleton-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
}

.st-skeleton-button {
    height: 48px;
    width: 100%;
    border-radius: 6px;
}

.st-skeleton-card {
    height: 120px;
    width: 100%;
    border-radius: 8px;
    margin-bottom: 12px;
}

/* Loading overlay */
.st-loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 50;
    backdrop-filter: blur(2px);
}

.st-loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e9ecef;
    border-top-color: #1a73e8;
    border-radius: 50%;
    animation: st-spin 0.8s linear infinite;
}

@keyframes st-spin {
    to { transform: rotate(360deg); }
}

.st-loading-text {
    margin-top: 12px;
    font-size: 14px;
    color: #6c757d;
    font-weight: 500;
}

/* ============================================
   Toast/Notification Styles
   ============================================ */

.st-toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 24px;
    background: #2d3748;
    color: white;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 500;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.25);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.3s ease,
                visibility 0.3s ease;
    max-width: 90%;
}

.st-toast i {
    font-size: 18px;
    flex-shrink: 0;
}

.st-toast.visible {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.st-toast.success {
    background: linear-gradient(135deg, #28a745 0%, #20853a 100%);
}

.st-toast.error {
    background: linear-gradient(135deg, #dc3545 0%, #b52d3a 100%);
}

.st-toast.warning {
    background: linear-gradient(135deg, #ffc107 0%, #e6ac00 100%);
    color: #212529;
}

/* Mobile adjustments for toast */
@media (max-width: 768px) {
    .st-toast {
        bottom: 140px;
        font-size: 14px;
        padding: 12px 20px;
    }
}

/* ============================================
   Improved Focus States
   ============================================ */

/* Custom focus ring for all interactive elements */
.st-focus-ring:focus-visible,
.st-touch-button:focus-visible,
.st-datemeal-main:focus-visible,
.st-datemeal-tile:focus-visible,
.st-patient-info-card:focus-visible,
.st-drawer-fab:focus-visible,
.st-drawer-close:focus-visible {
    outline: 3px solid #1a73e8;
    outline-offset: 2px;
}

/* Skip link for accessibility */
.st-skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    padding: 8px 16px;
    background: #1a73e8;
    color: white;
    font-weight: 500;
    z-index: 1000;
    transition: top 0.2s ease;
}

.st-skip-link:focus {
    top: 0;
}

/* Screen reader only text */
.st-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ============================================
   Error States
   ============================================ */

/* Error container */
.st-error-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
    color: #6c757d;
}

.st-error-icon {
    font-size: 64px;
    color: #dc3545;
    margin-bottom: 16px;
    opacity: 0.8;
}

.st-error-title {
    font-size: 20px;
    font-weight: 600;
    color: #212529;
    margin-bottom: 8px;
}

.st-error-message {
    font-size: 15px;
    color: #6c757d;
    margin-bottom: 20px;
    max-width: 400px;
}

.st-error-action {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: #1a73e8;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s ease;
}

.st-error-action:hover {
    background: #1557b0;
}

/* Input error state */
.st-input-error {
    border-color: #dc3545 !important;
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.15) !important;
}

.st-input-error-message {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 0;
    color: #dc3545;
    font-size: 13px;
    font-weight: 500;
}

.st-input-error-message i {
    font-size: 14px;
}

/* ============================================
   Connection Status Indicator
   ============================================ */

.st-connection-status {
    position: fixed;
    top: 10px;
    right: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: #2d3748;
    color: white;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    z-index: 500;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
}

.st-connection-status.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.st-connection-status.offline {
    background: #dc3545;
}

.st-connection-status.reconnecting {
    background: #ffc107;
    color: #212529;
}

.st-connection-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
    animation: st-pulse 1.5s ease-in-out infinite;
}

@keyframes st-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* ============================================
   Confirmation Dialog Overlay
   ============================================ */

.st-confirm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 400;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
}

.st-confirm-overlay.visible {
    opacity: 1;
    visibility: visible;
}

.st-confirm-dialog {
    background: white;
    border-radius: 16px;
    padding: 24px;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
    transform: scale(0.9);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.st-confirm-overlay.visible .st-confirm-dialog {
    transform: scale(1);
}

.st-confirm-title {
    font-size: 18px;
    font-weight: 600;
    color: #212529;
    margin-bottom: 12px;
}

.st-confirm-message {
    font-size: 15px;
    color: #6c757d;
    margin-bottom: 24px;
    line-height: 1.5;
}

.st-confirm-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.st-confirm-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    min-width: 100px;
}

.st-confirm-btn.primary {
    background: #1a73e8;
    color: white;
}

.st-confirm-btn.primary:hover {
    background: #1557b0;
}

.st-confirm-btn.danger {
    background: #dc3545;
    color: white;
}

.st-confirm-btn.danger:hover {
    background: #c82333;
}

.st-confirm-btn.secondary {
    background: #e9ecef;
    color: #495057;
}

.st-confirm-btn.secondary:hover {
    background: #dee2e6;
}

/* ============================================
   Swipe Hint Animation (for mobile drawer)
   ============================================ */

.st-swipe-hint {
    position: fixed;
    bottom: 180px;
    right: 16px;
    display: none;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: rgba(45, 55, 72, 0.9);
    color: white;
    border-radius: 20px;
    font-size: 13px;
    z-index: 90;
    animation: st-swipe-hint-fade 4s ease forwards;
}

.st-swipe-hint i {
    animation: st-swipe-bounce 1s ease-in-out infinite;
}

@keyframes st-swipe-hint-fade {
    0%, 70% { opacity: 1; }
    100% { opacity: 0; visibility: hidden; }
}

@keyframes st-swipe-bounce {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(-5px); }
}

@media (max-width: 768px) {
    .st-swipe-hint.show-once {
        display: flex;
    }
}

/* ============================================
   Page/Sub-Page Tabs - Phase 7
   ============================================ */

.st-page-tabs {
    display: flex;
    gap: 8px;
    padding: 4px 16px;
    background: #f4f5f7;
    border-top: 1px solid #dee2e6;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.st-page-tabs::-webkit-scrollbar {
    display: none;
}

.st-page-tab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 48px;
    min-width: 110px;
    padding: 10px 20px;
    border: 2px solid transparent;
    border-radius: 10px;
    background: white;
    color: #495057;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.st-page-tab i {
    font-size: 16px;
    opacity: 0.8;
}

.st-page-tab:hover {
    border-color: #1a73e8;
    background: #f0f7ff;
    color: #1a73e8;
    box-shadow: 0 4px 8px rgba(26, 115, 232, 0.15);
}

.st-page-tab:active {
    transform: scale(0.97);
}

.st-page-tab:focus-visible {
    outline: 3px solid #1a73e8;
    outline-offset: 2px;
}

/* Active tab state */
.st-page-tab.active {
    background: linear-gradient(135deg, #1a73e8 0%, #0d47a1 100%);
    color: white;
    border-color: transparent;
    box-shadow: 0 4px 12px rgba(26, 115, 232, 0.35);
}

.st-page-tab.active i {
    opacity: 1;
}

.st-page-tab.active:hover {
    background: linear-gradient(135deg, #1557b0 0%, #0a3d8f 100%);
    color: white;
}

/* Sub-page tabs with custom colors */
.st-page-tab[style*="--tab-bg"] {
    background: var(--tab-bg, white);
    color: var(--tab-fg, #495057);
}

.st-page-tab[style*="--tab-bg"]:hover {
    filter: brightness(0.9);
    border-color: rgba(255, 255, 255, 0.3);
}

.st-page-tab[style*="--tab-bg"].active {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    border-color: rgba(255, 255, 255, 0.4);
}

/* Scroll indicators (gradient fade at edges) */
.st-page-tabs::before,
.st-page-tabs::after {
    content: '';
    position: sticky;
    min-width: 24px;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.st-page-tabs::before {
    left: 0;
    background: linear-gradient(90deg, #f4f5f7 0%, transparent 100%);
}

.st-page-tabs::after {
    right: 0;
    background: linear-gradient(-90deg, #f4f5f7 0%, transparent 100%);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .st-page-tabs {
        padding: 8px 12px;
    }

    .st-page-tab {
        min-width: 100px;
        min-height: 52px;
        padding: 10px 16px;
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .st-page-tab {
        min-width: 90px;
        min-height: 56px;
        padding: 12px 14px;
        border-radius: 8px;
    }

    .st-page-tab i {
        display: none;
    }
}

/* ============================================
   Note Popup - Centered Modal Styles
   ============================================ */

/* Target the note popup specifically */
.st-note-popup-body {
    padding: 0 !important;
    margin: 0 !important;
    background: transparent !important;
    border: none !important;
}

/* Force centering for DevExpress modal containing note popup */
.dxbl-modal-root:has(.st-note-popup-body) {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.dxbl-modal-root:has(.st-note-popup-body) .dxbl-modal-dialog {
    margin: 0 !important;
    padding: 0 !important;
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
}

.dxbl-modal-root:has(.st-note-popup-body) .dxbl-modal-content {
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
}

.dxbl-modal-root:has(.st-note-popup-body) .dxbl-popup-content,
.dxbl-modal-root:has(.st-note-popup-body) .dxbl-popup-wrapper,
.dxbl-modal-root:has(.st-note-popup-body) .dxbl-popup {
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
    box-shadow: none !important;
}

/* ============================================
   Flag Popup - Centered Modal Styles
   ============================================ */

/* Target the flag popup specifically */
.st-popup-body {
    padding: 0 !important;
    margin: 0 !important;
    background: transparent !important;
    border: none !important;
}

/* Force centering for DevExpress modal containing flag popup */
.dxbl-modal-root:has(.st-popup-body) {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.dxbl-modal-root:has(.st-popup-body) .dxbl-modal-dialog {
    margin: 0 !important;
    padding: 0 !important;
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
}

.dxbl-modal-root:has(.st-popup-body) .dxbl-modal-content {
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
}

.dxbl-modal-root:has(.st-popup-body) .dxbl-popup-content,
.dxbl-modal-root:has(.st-popup-body) .dxbl-popup-wrapper,
.dxbl-modal-root:has(.st-popup-body) .dxbl-popup {
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
    box-shadow: none !important;
}

/* ============================================
   Time Picker Popup - Centered Modal Styles
   ============================================ */

/* Target the time picker popup specifically */
.st-time-picker-popup-body {
    padding: 0 !important;
    margin: 0 !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    border-radius: 0 !important;
}

/* Force centering for DevExpress modal containing time picker popup */
.dxbl-modal-root:has(.st-time-picker-popup-body) {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.dxbl-modal-root:has(.st-time-picker-popup-body) .dxbl-modal-dialog {
    margin: 0 !important;
    padding: 0 !important;
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    max-width: none !important;
}

.dxbl-modal-root:has(.st-time-picker-popup-body) .dxbl-modal-content {
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
    box-shadow: none !important;
    border-radius: 0 !important;
}

.dxbl-modal-root:has(.st-time-picker-popup-body) .dxbl-popup-content,
.dxbl-modal-root:has(.st-time-picker-popup-body) .dxbl-popup-content-wrapper,
.dxbl-modal-root:has(.st-time-picker-popup-body) .dxbl-popup-body-content,
.dxbl-modal-root:has(.st-time-picker-popup-body) .dxbl-popup-wrapper,
.dxbl-modal-root:has(.st-time-picker-popup-body) .dxbl-popup {
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
    box-shadow: none !important;
    border-radius: 0 !important;
}

/* Remove any card/panel styling from DevExpress elements */
.dxbl-modal-root:has(.st-time-picker-popup-body) .card,
.dxbl-modal-root:has(.st-time-picker-popup-body) .dxbl-popup-body,
.dxbl-modal-root:has(.st-time-picker-popup-body) .dxbl-popup-header,
.dxbl-modal-root:has(.st-time-picker-popup-body) .dxbl-popup-footer {
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
    box-shadow: none !important;
    border-radius: 0 !important;
}

/* Additional fixes for DevExpress modal card wrapper */
.dxbl-modal-root:has(.st-time-picker-popup-body) .card-body,
.dxbl-modal-root:has(.st-time-picker-popup-body) .dxbl-modal-body,
.dxbl-modal-root:has(.st-time-picker-popup-body) > div,
.dxbl-modal-root:has(.st-time-picker-popup-body) .dxbl-modal-dialog > div {
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
    box-shadow: none !important;
    border-radius: 0 !important;
}

/* Override Bootstrap card defaults within the modal */
.dxbl-modal-root:has(.st-time-picker-popup-body) .card {
    --bs-card-bg: transparent !important;
    --bs-card-border-color: transparent !important;
    --bs-card-border-width: 0 !important;
    --bs-card-border-radius: 0 !important;
}

/* Ensure the modal content wrapper is transparent */
.dxbl-modal-dialog:has(.st-time-picker-popup-body) {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    border-radius: 0 !important;
}

.dxbl-modal-dialog:has(.st-time-picker-popup-body) > .card {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    border-radius: 0 !important;
}

/* ============================================
   Confirmation Popup - Centered Modal Styles
   ============================================ */

/* Target the confirmation popup specifically */
.st-confirm-popup-body {
    padding: 0 !important;
    margin: 0 !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    border-radius: 0 !important;
}

/* Force centering for DevExpress modal containing confirmation popup */
.dxbl-modal-root:has(.st-confirm-popup-body) {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.dxbl-modal-root:has(.st-confirm-popup-body) .dxbl-modal-dialog {
    margin: 0 !important;
    padding: 0 !important;
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    max-width: none !important;
}

.dxbl-modal-root:has(.st-confirm-popup-body) .dxbl-modal-content {
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
    box-shadow: none !important;
    border-radius: 0 !important;
}

.dxbl-modal-root:has(.st-confirm-popup-body) .dxbl-popup-content,
.dxbl-modal-root:has(.st-confirm-popup-body) .dxbl-popup-content-wrapper,
.dxbl-modal-root:has(.st-confirm-popup-body) .dxbl-popup-body-content,
.dxbl-modal-root:has(.st-confirm-popup-body) .dxbl-popup-wrapper,
.dxbl-modal-root:has(.st-confirm-popup-body) .dxbl-popup {
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
    box-shadow: none !important;
    border-radius: 0 !important;
}

/* Remove any card/panel styling from DevExpress elements */
.dxbl-modal-root:has(.st-confirm-popup-body) .card,
.dxbl-modal-root:has(.st-confirm-popup-body) .dxbl-popup-body,
.dxbl-modal-root:has(.st-confirm-popup-body) .dxbl-popup-header,
.dxbl-modal-root:has(.st-confirm-popup-body) .dxbl-popup-footer {
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
    box-shadow: none !important;
    border-radius: 0 !important;
}

/* Additional fixes for DevExpress modal card wrapper */
.dxbl-modal-root:has(.st-confirm-popup-body) .card-body,
.dxbl-modal-root:has(.st-confirm-popup-body) .dxbl-modal-body,
.dxbl-modal-root:has(.st-confirm-popup-body) > div,
.dxbl-modal-root:has(.st-confirm-popup-body) .dxbl-modal-dialog > div {
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
    box-shadow: none !important;
    border-radius: 0 !important;
}

/* Override Bootstrap card defaults within the modal */
.dxbl-modal-root:has(.st-confirm-popup-body) .card {
    --bs-card-bg: transparent !important;
    --bs-card-border-color: transparent !important;
    --bs-card-border-width: 0 !important;
    --bs-card-border-radius: 0 !important;
}

/* Ensure the modal content wrapper is transparent */
.dxbl-modal-dialog:has(.st-confirm-popup-body) {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    border-radius: 0 !important;
}

.dxbl-modal-dialog:has(.st-confirm-popup-body) > .card {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    border-radius: 0 !important;
}
