body {
    font-family: Arial, sans-serif;
    font-size: 1.2em;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    background-color: #f9f9f9;
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

header h1 {
    text-align: center;
    color: #333;
}

/* Dashboard Layout */
.dashboard-container {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.dashboard-header h2 {
    margin: 0;
    color: #333;
}

.add-meal-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    font-size: 1.1em;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.add-meal-btn:hover {
    background-color: #45a049;
}

.plus-icon {
    font-size: 1.4em;
    font-weight: bold;
}

/* Calendar Styles */
.calendar-container {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.calendar-header h3 {
    margin: 0;
    font-size: 1.4em;
    color: #333;
}

.nav-btn {
    background: #007BFF;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 1.2em;
    transition: background-color 0.3s;
}

.nav-btn:hover {
    background: #0056b3;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.view-select {
    padding: 8px 10px;
    border: 2px solid #e9ecef;
    border-radius: 6px;
    background: #fff;
    font-size: 1em;
}

.date-jump {
    padding: 8px 10px;
    border: 2px solid #e9ecef;
    border-radius: 6px;
    background: #fff;
    font-size: 1em;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
    background: #e9ecef;
    border-radius: 8px;
    padding: 2px;
}

.calendar-grid.week-view { grid-template-columns: repeat(7, 1fr); }
.calendar-grid.day-view { grid-template-columns: 1fr; }
.calendar-grid.agenda-view { display: block; }

.agenda-list { display: flex; flex-direction: column; gap: 12px; padding: 8px; }
.meal-day-group { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }

/* Hide month day-of-week headers in non-month views */
.calendar-grid.day-view .day-header,
.calendar-grid.agenda-view .day-header { display: none; }

.day-header {
    background: #6c757d;
    color: white;
    padding: 12px;
    text-align: center;
    font-weight: bold;
    font-size: 0.9em;
}

.calendar-day {
    background: white;
    padding: 12px;
    text-align: left;
    cursor: pointer;
    position: relative;
    min-height: 120px; /* larger day cells */
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    transition: background-color 0.2s;
}

.calendar-day:hover {
    background: #f8f9fa;
}

.calendar-day.empty {
    background: #f8f9fa;
    cursor: default;
}

.calendar-day.today {
    background: rgba(0, 123, 255, 0.15); /* lighter, semi-transparent tint */
    color: inherit;
    font-weight: 700;
    border: 2px solid rgba(0, 123, 255, 0.35);
}

.calendar-day.today:hover {
    background: rgba(0, 123, 255, 0.22);
}

.calendar-day.has-meals {
    background: #d4edda;
    border: 2px solid #28a745;
}

.calendar-day.has-meals:hover {
    background: #c3e6cb;
}

/* legacy small bullets (no longer used) */
.meal-bullets { display: none; }

.meal-bullet {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

.meal-bullet.breakfast {
    background-color: #ffc107;
    /* Yellow for breakfast */
}

.meal-bullet.lunch {
    background-color: #28a745;
    /* Green for lunch */
}

.meal-bullet.dinner {
    background-color: #dc3545;
    /* Red for dinner */
}

.meal-bullet.snack {
    background-color: #6f42c1;
    /* Purple for snack */
}

/* New layout: date top-left, large bullets centered */
.date-label {
    position: absolute;
    top: 6px;
    left: 6px;
    font-size: 0.8em;
    color: #6c757d;
}

.calendar-day.today .date-label { color: #0d6efd; }

.meal-bullets-large {
    display: none; /* replaced by .meal-buttons */
}

/* Full-width meal buttons inside day cells */
.meal-buttons {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 22px; /* space below date label */
}

.meal-btn {
    width: 100%;
    box-sizing: border-box; /* prevent overflow from padding */
    padding: 8px 10px;
    border-radius: 6px;
    font-size: 0.95em;
    font-weight: 700;
    text-align: center;
    color: white;
}

.meal-btn.dim {
    opacity: 0.35; /* dim buttons without entries */
}

.meal-btn.breakfast { background-color: #ffc107; color: #343a40; }
.meal-btn.lunch { background-color: #28a745; }
.meal-btn.dinner { background-color: #dc3545; }

/* Recent Meals Section */
.recent-meals {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.recent-meals h3 {
    margin-top: 0;
    color: #333;
    border-bottom: 2px solid #e9ecef;
    padding-bottom: 10px;
}

.meals-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.meal-item {
    background: #f8f9fa;
    border-left: 4px solid #007BFF;
    padding: 15px;
    border-radius: 8px;
    transition: transform 0.2s;
}

.meal-item:hover {
    transform: translateX(5px);
}

.meal-date {
    font-weight: bold;
    color: #495057;
    margin-bottom: 5px;
}

.meal-details {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 8px;
}

.meal-type {
    background: #007BFF;
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.9em;
    font-weight: bold;
}

.meal-time {
    color: #6c757d;
    font-size: 0.9em;
}

.meal-quantity {
    color: #28a745;
    font-size: 0.9em;
    font-weight: bold;
}

.meal-description {
    color: #333;
    margin-bottom: 5px;
}

.meal-notes {
    color: #6c757d;
    font-style: italic;
    font-size: 0.95em;
}

.no-meals {
    text-align: center;
    color: #6c757d;
    font-style: italic;
    padding: 20px;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s;
    overflow-y: auto; /* allow page to scroll if modal taller than viewport */
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 0;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.3s;
    max-height: 90vh; /* keep actions visible on small screens */
    overflow-y: auto;  /* scroll inside modal content if needed */
}

@keyframes slideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #e9ecef;
    background: #f8f9fa;
    border-radius: 12px 12px 0 0;
}

.modal-header h3 {
    margin: 0;
    color: #333;
}

.close {
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
}

.close:hover {
    color: #333;
}

/* Form Styles */
form {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

label {
    font-weight: bold;
    color: #333;
}

input,
select,
textarea {
    padding: 12px;
    font-size: 1em;
    border: 2px solid #e9ecef;
    border-radius: 6px;
    width: 100%;
    box-sizing: border-box;
    transition: border-color 0.3s;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: #007BFF;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.25);
}

/* Layout: keep footer at bottom */
html, body { height: 100%; }
main { flex: 1 0 auto; }
footer { margin-top: auto; }

textarea {
    resize: vertical;
    min-height: 60px;
}

.form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e9ecef;
    position: sticky; /* keep buttons in view when scrolling */
    bottom: 0;
    background: #fff;
}

.cancel-btn {
    padding: 12px 20px;
    font-size: 1em;
    background-color: #6c757d;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.cancel-btn:hover {
    background-color: #5a6268;
}

.save-btn {
    padding: 12px 20px;
    font-size: 1em;
    background-color: #28a745;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.save-btn:hover {
    background-color: #218838;
}

.save-btn:disabled {
    background-color: #6c757d;
    cursor: not-allowed;
}

.delete-btn {
    padding: 12px 20px;
    font-size: 1em;
    background-color: #dc3545;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.3s;
    margin-right: auto; /* push to the left */
}

.delete-btn:hover {
    background-color: #c82333;
}

/* Logout Section */
.logout-section {
    text-align: center;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #e9ecef;
}

.logout-section a {
    color: #dc3545;
    text-decoration: none;
    font-weight: bold;
    padding: 10px 20px;
    border: 2px solid #dc3545;
    border-radius: 6px;
    transition: all 0.3s;
}

.logout-section a:hover {
    background-color: #dc3545;
    color: white;
}

/* Error Styles */
.error {
    color: #dc3545;
    text-align: center;
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 6px;
    padding: 10px;
    margin: 10px 0;
}

/* Responsive Design */
@media (max-width: 768px) {
    body {
        padding: 10px;
        font-size: 1em;
    }

    .dashboard-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }

    .calendar-grid {
        font-size: 0.9em;
    }

    .calendar-day {
        padding: 10px;
        min-height: 90px;
    }

    .meal-buttons { gap: 6px; }
    .meal-btn { font-size: 0.9em; padding: 6px 8px; }

    .modal-content {
        width: 95%;
        margin: 10% auto;
        max-height: 92vh; /* slightly taller on small screens */
    }

    .form-actions {
        flex-direction: column;
    }

    .meal-details {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
}

/* High contrast and accessibility */
:focus {
    outline: 3px solid #007BFF;
    outline-offset: 2px;
}

button:focus,
input:focus,
select:focus,
textarea:focus {
    outline: 3px solid #007BFF;
    outline-offset: 2px;
}

/* Auth (Login) Styles */
.auth-container {
    display: flex;
    justify-content: center;
}

.auth-card {
    width: 30%;
    min-width: 320px;
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.06);
}

.auth-title { margin-top: 0; text-align: center; }

.auth-form { display: flex; flex-direction: column; gap: 12px; }

.login-btn {
    background: #007BFF;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 12px;
    font-size: 1.05em;
    cursor: pointer;
    margin-top: 6px;
}

.login-btn:hover { background: #0056b3; }

.auth-alt { text-align: center; margin-top: 12px; }

@media (max-width: 768px) {
    .auth-card { width: 100%; min-width: 0; padding: 16px; }
}
