* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #0f0f23;
    color: #e2e8f0;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Dark theme scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #1a1a2e;
}

::-webkit-scrollbar-thumb {
    background: #4a5568;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #667eea;
}

/* Header with day selector */
.header {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border-bottom: 1px solid #2d3748;
    padding: 20px;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 20px;
}

.header h1 {
    color: #e2e8f0;
    font-size: 1.5rem;
    font-weight: 700;
}

.selectors-container {
    display: flex;
    gap: 30px;
    align-items: center;
    flex-wrap: wrap;
}

.week-selector {
    display: flex;
    gap: 8px;
    align-items: center;
}

.week-selector-label {
    color: #a0aec0;
    font-size: 0.9rem;
    margin-right: 10px;
}

.week-tab {
    padding: 8px 15px;
    background: #2d3748;
    border: 2px solid #4a5568;
    border-radius: 8px;
    color: #e2e8f0;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9rem;
    font-weight: 600;
    text-align: center;
}

.week-tab:hover {
    border-color: #48bb78;
    background: #374151;
}

.week-tab.selected {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
    border-color: #48bb78;
    color: white;
}

.day-selector {
    display: flex;
    gap: 8px;
    align-items: center;
}

.day-selector-label {
    color: #a0aec0;
    font-size: 0.9rem;
    margin-right: 10px;
}

.day-tab {
    padding: 8px 12px;
    background: #2d3748;
    border: 2px solid #4a5568;
    border-radius: 8px;
    color: #e2e8f0;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9rem;
    font-weight: 600;
    min-width: 50px;
    text-align: center;
}

.day-tab:hover {
    border-color: #667eea;
    background: #374151;
}

.day-tab.selected {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: #667eea;
    color: white;
}

/* Main container */
.user-container {
    display: flex;
    min-height: calc(100vh - 100px);
}

.sidebar {
    width: 380px;
    background: #1a202c;
    border-right: 1px solid #2d3748;
    padding: 20px;
    overflow-y: auto;
    transition: margin-left 0.3s ease, opacity 0.3s ease;
    position: relative;
}

.sidebar.collapsed {
    margin-left: -380px;
    opacity: 0;
    pointer-events: none;
}

.sidebar-toggle {
    position: fixed;
    left: 20px;
    top: 140px;
    z-index: 150;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 10px 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin: 20px 0;
}

.sidebar-toggle:hover {
    background: linear-gradient(135deg, #5a67d8 0%, #6b46c1 100%);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.sidebar-toggle.sidebar-visible {
    left: 400px;
}

.main-content {
    flex: 1;
    background: #0f0f23;
    padding: 20px;
    overflow-y: auto;
}

/* Status section - hidden for regular users */
.status-section {
    display: none; /* Hide connection status from regular users */
    background: #2d3748;
    border: 1px solid #4a5568;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
}

.status-section h3 {
    color: #e2e8f0;
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.status-item {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    font-size: 14px;
    color: #cbd5e0;
}

.status-item:last-child {
    margin-bottom: 0;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #e53e3e;
    flex-shrink: 0;
}

.status-dot.success {
    background: #48bb78;
    box-shadow: 0 0 10px rgba(72, 187, 120, 0.5);
}

.status-dot.loading {
    background: #ed8936;
    animation: pulse 1.5s infinite;
}

.status-dot.error {
    background: #e53e3e;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Restaurant section */
.restaurant-section {
    background: #2d3748;
    border: 1px solid #4a5568;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    max-height: 60vh; /* Limit height to 60% of viewport */
}

.restaurant-section h3 {
    color: #e2e8f0;
    margin-bottom: 15px;
    font-size: 1.1rem;
    flex-shrink: 0; /* Don't shrink the header */
}

.search-input {
    width: 100%;
    padding: 12px;
    background: #1a202c;
    border: 2px solid #4a5568;
    border-radius: 8px;
    margin-bottom: 15px;
    font-size: 14px;
    color: #e2e8f0;
    transition: border-color 0.2s ease;
    flex-shrink: 0; /* Don't shrink the search input */
}

.search-input::placeholder {
    color: #718096;
}

.search-input:focus {
    outline: none;
    border-color: #667eea;
}

/* Restaurant list container with scroll */
#restaurantList {
    overflow-y: auto;
    flex: 1; /* Take up remaining space */
    margin-bottom: 15px;
    /* Custom scrollbar for restaurant list */
}

#restaurantList::-webkit-scrollbar {
    width: 6px;
}

#restaurantList::-webkit-scrollbar-track {
    background: #1a202c;
    border-radius: 3px;
}

#restaurantList::-webkit-scrollbar-thumb {
    background: #4a5568;
    border-radius: 3px;
}

#restaurantList::-webkit-scrollbar-thumb:hover {
    background: #667eea;
}

.restaurant-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px;
    border: 2px solid #4a5568;
    border-radius: 8px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #374151;
}

.restaurant-item:hover {
    border-color: #667eea;
    background: #2d3748;
}

.restaurant-item.selected {
    border-color: #48bb78;
    background: #1a2e1a;
}

.restaurant-checkbox {
    width: 20px;
    height: 20px;
    border: 2px solid #718096;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #1a202c;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.restaurant-checkbox.checked {
    background: #48bb78;
    border-color: #48bb78;
    color: white;
}

.restaurant-info {
    flex: 1;
}

.restaurant-name {
    font-weight: 600;
    color: #e2e8f0;
    margin-bottom: 4px;
}

.restaurant-location {
    font-size: 12px;
    color: #a0aec0;
}

.selection-summary {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
    color: white;
    padding: 15px;
    border-radius: 8px;
    text-align: center;
    font-weight: 600;
    margin-top: 15px;
    flex-shrink: 0; /* Don't shrink the summary */
}

/* Menu grid */
.menu-grid {
    display: grid;
    gap: 24px;
    grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
}

.restaurant-menu {
    background: #1a202c;
    border: 1px solid #2d3748;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.restaurant-header {
    background: linear-gradient(135deg, #2d3748 0%, #1a202c 100%);
    color: #e2e8f0;
    padding: 20px;
    text-align: center;
    border-bottom: 1px solid #4a5568;
}

.restaurant-header h3 {
    margin: 0 0 5px 0;
    font-size: 1.2rem;
}

.restaurant-header .location {
    font-size: 0.9rem;
    color: #a0aec0;
}

.menu-loading {
    padding: 40px;
    text-align: center;
    color: #a0aec0;
}

.menu-error {
    padding: 20px;
    text-align: center;
    color: #fc8181;
    background: #2d1b1b;
    margin: 15px;
    border-radius: 8px;
    border: 1px solid #742a2a;
}

.menu-section {
    border-bottom: 1px solid #2d3748;
    background: #1e2530;
}

.menu-section:last-child {
    border-bottom: none;
}

.menu-name {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 12px 20px;
    font-weight: 600;
    font-size: 0.9rem;
    border-bottom: 1px solid #4a5568;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.day-menu {
    padding: 0;
}

.category-section {
    padding: 15px 20px;
    border-bottom: 1px solid #2d3748;
}

.category-section:last-child {
    border-bottom: none;
}

.category-title {
    font-weight: 600;
    color: #e2e8f0;
    margin-bottom: 12px;
    font-size: 0.9rem;
}

.product-item {
    padding: 10px 0;
    border-bottom: 1px solid #2d3748;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}

.product-item:last-child {
    border-bottom: none;
}

.product-item.sold-out {
    opacity: 0.5;
}

.product-main {
    flex: 1;
}

.product-name {
    font-weight: 600;
    color: #e2e8f0;
    font-size: 0.85rem;
    line-height: 1.3;
    margin-bottom: 4px;
}

.product-description {
    font-size: 0.75rem;
    color: #a0aec0;
    line-height: 1.4;
    margin-bottom: 4px;
}

.product-icons {
    display: flex;
    gap: 4px;
    margin-top: 4px;
}

.dietary-icon {
    width: 16px;
    height: 16px;
    border-radius: 3px;
}

.product-price {
    font-weight: 700;
    color: #48bb78;
    font-size: 0.9rem;
    white-space: nowrap;
    background: rgba(72, 187, 120, 0.1);
    padding: 4px 8px;
    border-radius: 6px;
    border: 1px solid rgba(72, 187, 120, 0.3);
}

.sold-out-label {
    color: #fc8181;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    margin-top: 4px;
}

.empty-state {
    text-align: center;
    padding: 80px 20px;
    color: #a0aec0;
    background: #1a202c;
    border-radius: 12px;
    border: 1px solid #2d3748;
}

.empty-state h3 {
    margin-bottom: 15px;
    color: #e2e8f0;
    font-size: 1.3rem;
}

.empty-state p {
    font-size: 1rem;
    line-height: 1.6;
}

.empty-state .instructions {
    margin-top: 25px;
    font-size: 0.9rem;
    color: #718096;
}

@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }

    .selectors-container {
        flex-direction: column;
        gap: 15px;
    }

    .day-selector, .week-selector {
        flex-wrap: wrap;
        justify-content: center;
    }

    .user-container {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        max-height: 50vh;
    }

    .sidebar-toggle {
        display: none; /* Hide sidebar toggle on mobile */
    }
    
    .day-tab, .week-tab {
        padding: 6px 8px;
        font-size: 0.8rem;
        min-width: 40px;
    }
    
    .menu-grid {
        grid-template-columns: 1fr;
    }
}

/* Loading animation */
.loading-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #4a5568;
    border-radius: 50%;
    border-top-color: #667eea;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}
