/* Import Font (Optional) */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600&display=swap');

:root {
    --primary-color: #4CAF50; /* Green */
    --secondary-color: #ff9800; /* Orange */
    --light-gray: #f4f4f4;
    --dark-gray: #333;
    --danger-color: #f44336; /* Red */
    --admin-primary: #673ab7; /* Deep purple for admin */
    --admin-secondary: #0097a7; /* Teal for admin sections */
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Poppins', sans-serif;
    line-height: 1.6;
    background-color: #e8f5e9; /* Default light green background */
    color: var(--dark-gray);
    padding: 20px; /* Add padding to body */
    min-height: 100vh; /* Ensure body takes full height */
}

/* Specific background for login pages */
body.login-page {
    background-color: #e8f5e9;
    display: flex;
    justify-content: center;
    align-items: center;
}
body.admin-login-page {
    background-color: #f3e5f5; /* Light purple background */
    display: flex;
    justify-content: center;
    align-items: center;
}
body.admin-register-page {
    background-color: #ede7f6; /* Lighter purple background */
    display: flex;
    justify-content: center;
    align-items: center;
}
body.admin-dashboard-page {
     background-color: #e0f7fa; /* Light cyan background */
}


/* --- General Container Styles --- */
.container, .login-container, .admin-login-container, .admin-register-container, .admin-container {
    max-width: 800px; /* Default max-width */
    margin: 30px auto;
    background-color: #fff;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    width: 90%; /* Use percentage for better responsiveness */
}

/* Specific widths for smaller containers */
.login-container, .admin-login-container, .admin-register-container {
    max-width: 450px;
}
.admin-container { /* Wider for dashboard */
     max-width: 960px;
}


/* --- Headers --- */
header {
    text-align: center;
    margin-bottom: 30px;
    color: var(--primary-color);
    border-bottom: 2px solid var(--light-gray);
    padding-bottom: 15px;
}
/* Admin header */
.admin-container h1 {
    color: var(--admin-secondary); /* Dark cyan */
    text-align: center;
    margin-bottom: 20px;
    border-bottom: 2px solid #b2ebf2; /* Light cyan border */
    padding-bottom: 10px;
}
.admin-header-container {
     display: flex;
     justify-content: space-between;
     align-items: center;
     margin-bottom: 20px;
     flex-wrap: wrap; /* Responsive wrap */
}


h1 {
    font-weight: 600;
    font-size: 1.8rem; /* Adjust size */
}
h2 {
    color: var(--primary-color);
    margin-bottom: 15px;
    border-bottom: 1px solid var(--light-gray);
    padding-bottom: 5px;
    font-weight: 600;
    font-size: 1.4rem; /* Adjust size */
}
h2 i { /* FontAwesome icons */
    margin-right: 8px;
    color: var(--secondary-color);
}
h3 {
    margin-top: 20px;
    margin-bottom: 10px;
    color: #555;
    font-weight: 400;
    font-size: 1.1rem;
}

/* --- Sections --- */
section {
    margin-bottom: 30px;
    padding: 20px;
    background-color: #fff;
    border-radius: 8px;
}
.admin-section {
    background-color: #f5f5f5; /* Light gray section background for admin */
}
.admin-section h2 {
     color: var(--admin-secondary); /* Teal */
     border-bottom: 1px solid #e0f2f7; /* Very light cyan border */
}

hr {
    border: 0;
    height: 1px;
    background: #eee;
    margin: 30px 0;
}

/* --- Forms --- */
.form-group {
    margin-bottom: 15px;
}
.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 400;
    color: #666;
}
/* Bolder labels in login/register forms */
.login-container .form-group label,
.admin-login-container .form-group label,
.admin-register-container .form-group label {
    font-weight: 600;
}

.form-group input[type="text"],
.form-group input[type="number"],
.form-group input[type="date"],
.form-group input[type="password"],
.form-group input[type="email"] { /* Added email */
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-family: inherit;
    font-size: 1rem;
    transition: border-color 0.3s ease, box-shadow 0.3s ease; /* Smooth transition */
}
.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 5px rgba(76, 175, 80, 0.3);
}
.form-group small { /* Hint text like 'Minimal 8 karakter' */
    font-size: 0.8rem;
    color: #777;
    display: block;
    margin-top: 3px;
}

/* Gender radio buttons */
.gender-group label {
     margin-right: 15px; /* Spacing between radio options */
     font-weight: 400; /* Normal weight for options */
     display: inline-block; /* Keep them inline */
}
.gender-group input[type="radio"] {
    margin-right: 5px;
    vertical-align: middle; /* Align radio with text */
}

/* --- Buttons --- */
button[type="submit"],
.button, /* General button class */
.delete-btn,
#complete-challenge-btn,
#logout-btn,
#admin-logout-btn,
#back-to-user-list {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-family: inherit;
    font-size: 1rem;
    transition: background-color 0.3s ease, transform 0.1s ease; /* Added transform */
    margin-top: 10px;
    display: inline-block; /* Ensure buttons behave predictably */
    text-align: center;
}
button:hover, .button:hover {
    background-color: #388E3C; /* Darker green */
    transform: translateY(-1px); /* Slight lift effect */
}
button:active, .button:active {
    transform: translateY(0px); /* Press down effect */
}

/* Specific button styles */
.login-container button[type="submit"],
.admin-login-container button[type="submit"],
.admin-register-container button[type="submit"] {
    width: 100%;
    padding: 12px;
    font-size: 1.1rem;
    margin-top: 20px;
}
.admin-login-container button[type="submit"] {
    background-color: var(--admin-primary);
}
.admin-login-container button[type="submit"]:hover {
    background-color: #512da8; /* Darker purple */
}
.admin-register-container button[type="submit"] {
    background-color: #5e35b1; /* Lighter purple */
}
.admin-register-container button[type="submit"]:hover {
    background-color: #4527a0; /* Darker */
}

.delete-btn {
    background-color: var(--danger-color);
    padding: 5px 10px;
    font-size: 0.8rem;
    margin-left: 10px;
    margin-top: 0; /* Override default margin */
    flex-shrink: 0; /* Prevent button from shrinking in flex layouts */
}
.delete-btn:hover {
    background-color: #c62828; /* Darker red */
}

#logout-btn, #admin-logout-btn {
    background-color: var(--danger-color);
    padding: 8px 15px;
    font-size: 0.9rem;
    margin-top: 0; /* Reset margin */
}
#logout-btn:hover, #admin-logout-btn:hover {
    background-color: #c62828; /* Darker red */
}

/* Status toggle button */
.status-toggle-btn {
    margin-left: 15px;
    padding: 5px 10px;
    font-size: 0.9rem;
}

/* --- Lists (Food/Activity/Users) --- */
ul {
    list-style: none;
    padding: 0;
    margin-top: 15px;
}
ul li {
    background-color: var(--light-gray);
    padding: 12px 15px;
    margin-bottom: 10px;
    border-radius: 5px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-left: 5px solid var(--primary-color); /* Accent border */
    flex-wrap: wrap; /* Allow wrapping on small screens */
}
#activity-list li {
     border-left-color: var(--secondary-color); /* Different accent for activity */
}
/* Style for placeholder/loading/empty items */
ul li p {
    font-style: italic;
    color: #777;
    width: 100%;
    text-align: center;
    padding: 10px 0; /* Add some padding */
}
ul li span {
    font-weight: 400;
    word-break: break-word; /* Allow text wrapping */
    margin-right: 10px; /* Space between text and button */
    flex-grow: 1; /* Allow text to take available space */
}

/* --- Admin Table --- */
.admin-table {
    width: 100%;
    border-collapse: collapse; /* Remove space between borders */
    margin-top: 15px;
    font-size: 0.9rem; /* Slightly smaller font for table */
    overflow-x: auto; /* Add horizontal scroll on small screens */
    display: block; /* Needed for overflow-x */
}
.admin-table th, .admin-table td {
    border: 1px solid #ddd; /* Light gray border */
    padding: 10px 8px; /* Adjust padding */
    text-align: left;
    white-space: nowrap; /* Prevent text wrapping in cells initially */
}
.admin-table th {
    background-color: #b2ebf2; /* Light cyan header background */
    color: #004d40; /* Dark teal header text */
    font-weight: 600; /* Bolder header */
    position: sticky; /* Make header sticky if table scrolls */
    top: 0;
    z-index: 1;
}
.admin-table tbody tr:nth-child(even) {
    background-color: #f9f9f9; /* Lighter alternating row color */
}
.admin-table tbody tr:hover {
    background-color: #e0f2f7; /* Highlight row on hover */
}
.admin-table td button {
     padding: 5px 10px;
     margin-right: 5px;
     font-size: 0.8rem; /* Smaller buttons */
     margin-top: 0;
     white-space: nowrap; /* Prevent button text wrapping */
}
/* Allow specific columns to wrap if needed */
.admin-table td:nth-child(2), /* Name column */
.admin-table td:last-child { /* Action column */
    white-space: normal;
}


/* --- Summary & Totals --- */
.total {
    margin-top: 20px;
    font-size: 1.1rem;
    text-align: right;
    color: var(--dark-gray);
    font-weight: 600; /* Make totals bold */
}
.total strong, .total span {
    color: var(--primary-color); /* Highlight total calories */
}
#summary p, #calorie-goals p {
    font-size: 1.1rem; /* Adjust size */
    margin-bottom: 8px;
    line-height: 1.4;
}
#summary strong, #calorie-goals strong {
    font-weight: 600;
    color: var(--secondary-color);
}
#summary .info, #calorie-goals .info, #motivation .info, .info { /* General info class */
    font-size: 0.9rem;
    color: #777;
    margin-top: 5px;
    font-style: italic;
}
#calories-remaining {
    font-weight: bold; /* Make remaining calories stand out */
}

/* --- User Profile Section in Tracker --- */
#user-summary {
     margin-bottom: 30px;
     padding: 20px;
     background-color: #e0f7fa; /* Light cyan */
     border-radius: 8px;
     box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}
#user-summary h2 {
     color: #00796b; /* Dark teal */
     border-bottom: 1px solid #b2ebf2; /* Light cyan border */
}
#user-summary h3 {
     color: #004d40; /* Even darker teal */
}

/* --- Education Section --- */
#education article {
    background-color: #f9f9f9;
    padding: 15px;
    border-radius: 5px;
    margin-top: 10px;
}
#education h3 {
    color: var(--secondary-color);
    margin-top: 0;
    margin-bottom: 10px;
}
#education ul {
    margin-left: 20px;
    list-style: disc;
}
#education li {
    background-color: transparent;
    padding: 5px 0;
    margin-bottom: 5px;
    display: list-item; /* Restore default list item display */
    border-left: none;
    border-radius: 0;
    align-items: initial; /* Reset alignment */
    justify-content: initial; /* Reset justification */
}

/* --- Motivation Section --- */
#motivation #challenge {
    background-color: #fff9c4; /* Light yellow */
    padding: 15px;
    border-radius: 5px;
    border: 1px dashed var(--secondary-color);
    margin-bottom: 15px;
    text-align: center;
}
#motivation #daily-challenge{
    font-style: italic;
    color: #555;
    margin: 5px 0 10px 0;
    font-weight: 600; /* Make challenge text slightly bolder */
}
#challenge-feedback {
    color: var(--primary-color); /* Green feedback */
    font-weight: bold;
    margin-top: 10px;
}

/* --- Message Areas (Error/Success) --- */
.message-area {
    padding: 10px 15px;
    border-radius: 5px;
    margin-top: 15px;
    text-align: center;
    display: none; /* Hide by default */
    font-size: 0.95rem;
}
.error-message { /* Used in login/register */
    color: var(--danger-color);
    background-color: #fddede;
    border: 1px solid var(--danger-color);
    display: none; /* Also hide by default */
}
.success-message {
    color: #1b5e20; /* Dark green */
    background-color: #c8e6c9; /* Light green */
    border: 1px solid #388e3c; /* Medium green */
}

/* --- Footer --- */
footer {
    text-align: center;
    margin-top: 40px;
    padding-top: 20px; /* Add space above footer */
    border-top: 1px solid #eee; /* Separator line */
    color: #777;
    font-size: 0.9rem;
}

/* --- Links --- */
a {
    color: var(--primary-color);
    text-decoration: none;
}
a:hover {
    text-decoration: underline;
}
.register-link, .back-link { /* Links in login/register pages */
    display: block;
    text-align: center;
    margin-top: 20px;
    font-size: 0.9rem;
}
.back-link a {
     color: var(--secondary-color);
}

/* --- Responsiveness --- */
@media (max-width: 768px) {
    .container, .admin-container {
        padding: 20px;
    }
    h1 { font-size: 1.6rem; }
    h2 { font-size: 1.2rem; }

    /* Adjust admin header layout */
    .admin-header-container {
         flex-direction: column;
         align-items: flex-start;
    }
    #admin-logout-btn {
        margin-top: 10px;
        align-self: flex-end; /* Button on the right */
    }
}

@media (max-width: 600px) {
    body {
        padding: 10px; /* Reduce body padding */
    }
    .container, .login-container, .admin-login-container, .admin-register-container, .admin-container {
        padding: 15px; /* Reduce container padding */
        width: 95%; /* Slightly wider */
        margin: 15px auto;
    }
    h1 { font-size: 1.5rem; }
    h2 { font-size: 1.1rem; }

    /* Stack list items vertically */
    ul li {
         flex-direction: column;
         align-items: flex-start;
    }
    ul li span {
        margin-bottom: 8px; /* Space below text */
        margin-right: 0;
    }
    .delete-btn {
        margin-left: auto; /* Push delete button to right */
        margin-top: 5px;
    }
    .total {
        text-align: left; /* Align total to left */
        font-size: 1rem;
    }
    /* Ensure form buttons remain full width */
    .login-container button[type="submit"],
    .admin-login-container button[type="submit"],
    .admin-register-container button[type="submit"] {
        font-size: 1rem;
    }
}

