/* Modern CSS Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --background-color: #f5f5f5;
    --text-color: #333;
    --card-background: white;
    --primary-color: #2c3e50;
    --hover-color: #34495e;
    --border-color: #ddd;
    --menu-item-background: #f8f9fa;
    --menu-item-hover: #e9ecef;
    --calorie-background: #f0f0f0;
    --calorie-text: #666;
    --shadow-color: rgba(0,0,0,0.1);
}

@media (prefers-color-scheme: dark) {
    :root {
        --background-color: #1a1a1a;
        --text-color: #e0e0e0;
        --card-background: #2d2d2d;
        --primary-color: #3498db;
        --hover-color: #2980b9;
        --border-color: #404040;
        --menu-item-background: #363636;
        --menu-item-hover: #404040;
        --calorie-background: #363636;
        --calorie-text: #b0b0b0;
        --shadow-color: rgba(0,0,0,0.3);
    }
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", 
                 Helvetica, Arial, sans-serif;
    line-height: 1.6;
    padding: 20px;
    max-width: 800px;
    margin: 0 auto;
    background-color: var(--background-color);
    color: var(--text-color);
}

h1 {
    margin-bottom: 1.5rem;
    color: var(--primary-color);
    font-size: 2rem;
}

.controls {
    background: var(--card-background);
    padding: 1.5rem;
    border-radius: 10px;
    box-shadow: 0 2px 4px var(--shadow-color);
    margin-bottom: 1.5rem;
}

.meal-options {
    margin-bottom: 1.5rem;
    display: flex;
    gap: 0.5rem;
}

.meal-options label {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem;
    background: var(--menu-item-background);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    color: var(--text-color);
}

.meal-options input[type="radio"] {
    display: none;
}

.meal-options input[type="radio"]:checked + span {
    font-weight: 500;
}

.meal-options label:has(input[type="radio"]:checked) {
    background: var(--primary-color);
    color: white;
}

.date-selector {
    margin-bottom: 1rem;
}

.date-navigation {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.date-selector label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.date-selector input[type="date"] {
    -webkit-appearance: none;
    appearance: none;
    background: var(--menu-item-background);
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    font-size: 1rem;
    width: 100%;
    margin-bottom: 1rem;
    font-family: inherit;
    color: var(--text-color);
    flex: 1;
    margin-bottom: 0; /* Override existing margin */
    
    
}

/* Target internal parts of the date input */
.date-selector input[type="date"]::-webkit-datetime-edit {
    text-align: center;
    margin: 0 auto;
}

.date-selector input[type="date"]::-webkit-calendar-picker-indicator {
    position: absolute;
    right: 10px;
}

.nav-arrow {
    background: var(--menu-item-background);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.2rem;
    padding: 0;
    color: var(--text-color);
}

.nav-arrow:hover {
    background: var(--menu-item-hover);
}

.return-today-btn {
    background: var(--menu-item-background);
    color: var(--primary-color);
    font-weight: 500;
    border: 1px solid var(--border-color);
    margin-top: 10px;
    display: none; /* Hidden by default */
    width: 100%;
}

.return-today-btn:hover {
    background: var(--menu-item-hover);
    color: var(--primary-color);
}

button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.2s ease;
    width: 100%;
}

button:hover {
    background-color: var(--hover-color);
}

/* Hide the fetch button since we now auto-fetch on date and meal type change */
#fetch-btn {
    display: none;
}

#menu-display {
    background: var(--card-background);
    padding: 1.5rem;
    border-radius: 10px;
    box-shadow: 0 2px 4px var(--shadow-color);
}

.menu-card {
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 0; /* Remove padding as the outer container will handle this */
    margin: 0;  /* Remove margin as well */
}

/* Ensure headings are properly positioned without the inner card's padding */
.menu-card h3, .menu-card h4 {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
}

.menu-items {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.menu-item {
    padding: 0.75rem;
    background: var(--menu-item-background);
    border-radius: 6px;
    transition: background-color 0.2s ease;
    color: var(--text-color);
}

.menu-item:hover {
    background: var(--menu-item-hover);
}

.calorie-info {
    font-size: 0.9rem;
    color: var(--calorie-text);
    padding: 0.5rem;
    background: var(--calorie-background);
    border-radius: 6px;
    text-align: center;
    font-style: italic;
}

.error-message {
    color: #dc3545;
    padding: 1rem;
    background: #f8d7da;
    border-radius: 6px;
    text-align: center;
}

#todays-menu {
    margin: 20px auto;
    max-width: 800px;
    padding: 20px;
    background-color: #f5f5f5;
    border-radius: 8px;
}

#todays-menu h2 {
    color: #333;
    margin-bottom: 15px;
}

.footer {
    max-width: 800px;
    width: 100%;
    margin: 2rem auto 1rem;
    padding: 1rem 15px;
    text-align: center;
    font-size: 0.9rem;
    color: var(--text-secondary);
    border-top: 1px solid var(--border-color);
}

.footer p {
    text-align: center;
    width: 100%;
    margin: 0 auto;
}

/* Default emoji (light mode) - dark skin tone for better visibility */
.mode-emoji::after {
    content: "🫶🏿";
}

/* Dark mode emoji - light skin tone for better visibility */
@media (prefers-color-scheme: dark) {
    .mode-emoji::after {
        content: "🫶🏻";
    }
}

/* Tab styling */
.tabs-container {
    max-width: 800px;
    width: 100%;
    margin: 0 auto 1.5rem;
}

/* Improved tab styling */
.tabs {
    display: flex;
    margin-bottom: 20px;
    border-radius: 10px;
    overflow: hidden;
}

.tab-button {
    flex: 1;
    padding: 15px 20px;
    background: var(--background-color);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    font-size: 1rem;
}

.tab-button:first-child {
    border-radius: 10px 0 0 10px;
}

.tab-button:last-child {
    border-radius: 0 10px 10px 0;
}

.tab-button.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.tab-button:hover:not(.active) {
    background: var(--menu-item-hover);
}

.source-content {
    display: none;
}

.source-content.active {
    display: block;
}

/* DTCF specific styling */
.dtcf-menu-container {
    max-width: 800px;
    width: 100%;
    margin: 0 auto;
    background: var(--card-background);
    padding: 1.5rem;
    border-radius: 10px;
    box-shadow: 0 2px 4px var(--shadow-color);
}

.dtcf-image {
    width: 100%;
    height: auto;
    margin: 10px 0;
    border-radius: 5px;
}

.loading {
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
}

@media (max-width: 600px) {
    body {
        padding: 15px;
    }

    h1 {
        font-size: 1.5rem;
    }

    .controls {
        padding: 1rem;
    }

    .meal-options {
        flex-direction: column;
    }

    .meal-options label {
        padding: 1rem;
        font-size: 1.1rem;
    }

    .date-selector input[type="date"] {
        padding: 1rem;
        font-size: 1.1rem;
    }

    .menu-date {
        font-size: 1.25rem;
    }

    .footer {
        margin-top: 1.5rem;
        font-size: 0.8rem;
        padding: 0.75rem 10px;
        text-align: center; /* Explicitly set for mobile */
    }
    
    .footer p {
        text-align: center; /* Target paragraph specifically */
        width: 100%; /* Ensure full width */
        display: block; /* Block display */
        margin: 0 auto; /* Center with auto margins */
    }

    .tabs {
        margin-bottom: 1rem;
    }
    
    .tab-button {
        padding: 8px 15px;
        font-size: 0.9rem;
    }
    
    .dtcf-menu-container {
        padding: 1rem;
    }

    .nav-arrow {
        width: 36px;
        height: 36px;
    }
}