:root {
    --primary-color: #3498db;
    --secondary-color: #2c3e50;
    --accent-color: #4CAF50;
    --danger-color: #e74c3c;
    --background-light: #f4f4f4;
    --background-white: #ffffff;
    --border-color: #ddd;
    --font-color: #333;

    /* Admin Dashboard Specific */
    --admin-bg: #f0f2f5;
    --admin-sidebar-bg: #222b45;
    --admin-content-bg: #ffffff;
    --admin-text: #667085;
    --admin-heading: #101828;
    --admin-card-border: #eaecf0;
}

body {
    font-family: 'Segoe UI', Arial, sans-serif;
    margin: 0;
    background-color: var(--background-light);
    color: var(--font-color);
    line-height: 1.6;
}

/* Universal styles for user-facing pages */
body.user-page {
    background-color: var(--background-light);
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

.container {
    width: 95%;
    max-width: 1000px;
    margin: auto;
    background: var(--background-white);
    padding: 2rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    border-radius: 12px;
    position: relative;
}

h1, h2, h3, h4 {
    color: var(--secondary-color);
    margin-top: 0;
}

h1 {
    text-align: center;
    margin-bottom: 0.5rem;
}

.subtitle {
    text-align: center;
    margin-bottom: 2rem;
    color: #777;
}

/* Top Navigation Bar */
.top-nav {
    background-color: var(--secondary-color);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--background-white);
    margin-bottom: 2rem;
    border-radius: 8px;
}

.top-nav-links a {
    color: var(--background-white);
    text-decoration: none;
    margin-left: 1.5rem;
    font-weight: bold;
    transition: color 0.3s ease;
}

.top-nav-links a:hover {
    color: var(--primary-color);
}

.logout-btn {
    padding: 0.5rem 1rem;
    background-color: var(--danger-color);
    color: var(--background-white);
    border: none;
    border-radius: 5px;
    text-decoration: none;
    font-weight: bold;
    transition: background-color 0.3s ease;
}

.logout-btn:hover {
    background-color: #c0392b;
}

.card {
    background-color: #fafafa;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.form-group {
    margin-bottom: 1rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: bold;
}

input[type="number"], input[type="text"], input[type="date"], input[type="tel"], input[type="email"], input[type="password"], select, textarea {
    width: 100%;
    padding: 0.75rem;
    box-sizing: border-box;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 1rem;
}

.btn {
    display: block;
    width: 100%;
    padding: 0.75rem;
    margin-top: 1.5rem;
    background-color: var(--primary-color);
    color: var(--background-white);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: bold;
    transition: background-color 0.3s ease;
}

.btn:hover {
    background-color: #2980b9;
}

.btn-complete {
    background-color: var(--accent-color);
    color: var(--background-white);
    font-weight: bold;
    padding: 0.75rem 1.5rem;
    margin-top: 1rem;
    cursor: pointer;
}

.btn-complete:hover {
    background-color: #449d44;
}

.progress-container {
    text-align: center;
    margin-bottom: 2rem;
}

.progress-bar-container {
    width: 100%;
    background-color: var(--border-color);
    border-radius: 5px;
    overflow: hidden;
    height: 25px;
    margin-top: 0.5rem;
}

.progress-bar {
    height: 100%;
    background-color: var(--primary-color);
    transition: width 0.5s ease-in-out;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--background-white);
    font-weight: bold;
    font-size: 0.9rem;
}

.week-day-nav {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: center;
    margin-bottom: 2rem;
}

.week-day-nav form {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.week-day-nav select {
    width: 100%;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

th, td {
    padding: 12px;
    border: 1px solid var(--border-color);
    text-align: left;
}

th {
    background-color: var(--secondary-color);
    color: var(--background-white);
}

tbody tr:nth-child(even) {
    background-color: #f9f9f9;
}

.log-form {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: flex-start;
}

.log-form input[type="number"] {
    width: 120px;
}

.log-form .btn {
    width: auto;
    padding: 0.5rem 1rem;
}

.chart-container {
    background-color: var(--background-white);
    padding: 2rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    margin-bottom: 2rem;
}

.text-center {
    text-align: center;
}

.text-center a {
    color: var(--primary-color);
    text-decoration: none;
}

/* Admin Dashboard Specific Layout */
body.admin-page {
    background-color: var(--admin-bg);
    color: var(--admin-text);
    display: flex;
}

.sidebar {
    width: 250px;
    background-color: var(--admin-sidebar-bg);
    color: #fff;
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    overflow-y: auto;
}

.sidebar-logo {
    font-size: 1.5rem;
    font-weight: bold;
    text-align: center;
    margin-bottom: 2rem;
    color: #fff;
}

.sidebar-nav {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-nav a {
    color: #b0b4c0;
    text-decoration: none;
    display: block;
    padding: 0.75rem 1rem;
    border-radius: 6px;
    transition: background-color 0.3s ease;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.sidebar-nav a:hover {
    background-color: #313a57;
    color: #fff;
}

.main-content {
    margin-left: 250px;
    flex-grow: 1;
    padding: 2rem;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.stat-card {
    text-align: center;
}

.stat-card-title {
    font-size: 1rem;
    color: var(--admin-text);
    margin-bottom: 0.5rem;
}

.stat-card-value {
    font-size: 2.5rem;
    font-weight: bold;
    color: var(--admin-heading);
    margin: 0;
}

.chart-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

.popular-list {
    list-style-type: none;
    padding: 0;
    margin-top: 1rem;
}

.popular-list li {
    background-color: #f9fafb;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    border-radius: 4px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid var(--admin-card-border);
}

.list-unstyled {
    list-style: none;
    padding-left: 0;
}

.list-unstyled li {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--admin-card-border);
}

.list-unstyled li:last-child {
    border-bottom: none;
}

.responsive-table {
    width: 100%;
    border-collapse: collapse;
}

.responsive-table th, .responsive-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid var(--admin-card-border);
}

.responsive-table th {
    background-color: var(--admin-sidebar-bg);
    color: #fff;
}

.dashboard-main {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

@media (min-width: 900px) {
    .dashboard-main {
        grid-template-columns: 1fr 1fr;
    }
}

.chart-container {
    height: 300px;
}

/* Mobile-specific styles */
@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
        padding-bottom: 0;
    }
    .main-content {
        margin-left: 0;
    }
    .sidebar-logo {
        margin-bottom: 1rem;
    }
    .sidebar-nav {
        display: flex;
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    .sidebar-nav a {
        padding: 0.5rem;
        justify-content: center;
        flex-grow: 1;
        font-size: 0.85rem;
    }
    .admin-header {
        flex-direction: column;
        align-items: flex-start;
    }
    .responsive-table thead {
        display: none;
    }
    .responsive-table tr {
        display: block;
        margin-bottom: 1rem;
        border: 1px solid var(--admin-card-border);
        border-radius: 8px;
    }
    .responsive-table td {
        display: flex;
        justify-content: space-between;
        text-align: right;
        padding-left: 50%;
        position: relative;
    }
    .responsive-table td::before {
        content: attr(data-label);
        position: absolute;
        left: 15px;
        font-weight: bold;
        text-align: left;
    }
}