@import url('https://fonts.googleapis.com/css2?family=Sarabun:wght@300;400;700&display=swap');

:root {
    --primary-color: #4CAF50; /* Green */
    --secondary-color: #2196F3; /* Blue */
    --accent-color: #FFC107; /* Amber */
    --background-color: #f4f7f6;
    --card-background: #ffffff;
    --text-color: #333;
    --light-text-color: #666;
    --border-color: #e0e0e0;
}

body {
    font-family: 'Sarabun', sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
}

.dashboard-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Header */
.dashboard-header {
    background-color: var(--primary-color);
    color: white;
    padding: 20px 30px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.dashboard-header h1 {
    margin: 0;
    font-size: 2.2em;
}

.dashboard-header p {
    margin: 5px 0 0;
    font-size: 0.9em;
    opacity: 0.9;
}

/* Navigation */
.dashboard-nav {
    background-color: var(--card-background);
    padding: 10px 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    border-bottom: 1px solid var(--border-color);
}

.dashboard-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
}

.dashboard-nav li {
    margin: 0 15px;
}

.dashboard-nav a {
    text-decoration: none;
    color: var(--secondary-color);
    font-weight: 700;
    padding: 8px 15px;
    border-radius: 5px;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.dashboard-nav a:hover,
.dashboard-nav a.active-nav {
    background-color: var(--secondary-color);
    color: white;
}

/* Main Content */
.dashboard-main {
    flex-grow: 1;
    padding: 20px;
    max-width: 1200px;
    margin: 20px auto;
    background-color: var(--card-background);
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
}

.dashboard-section {
    display: none; /* Hidden by default */
    padding: 20px;
    margin-bottom: 20px;
}

.dashboard-section.active {
    display: block; /* Show active section */
}

.dashboard-section h2 {
    color: var(--primary-color);
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 10px;
    margin-top: 0;
    margin-bottom: 20px;
}

/* Cards */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.card {
    background-color: var(--card-background);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s ease-in-out;
}

.card:hover {
    transform: translateY(-5px);
}

.card h3 {
    margin-top: 0;
    color: var(--light-text-color);
    font-size: 1.1em;
}

.card p {
    font-size: 2.5em;
    font-weight: 700;
    color: var(--primary-color);
    margin: 10px 0 0;
}

.card ul {
    list-style: none;
    padding: 0;
    margin: 0;
    text-align: left;
}

.card ul li {
    padding: 5px 0;
    border-bottom: 1px dashed var(--border-color);
}

.card ul li:last-child {
    border-bottom: none;
}

/* Charts */
.chart-container {
    background-color: var(--card-background);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    margin-bottom: 20px;
}

.chart-container h3 {
    text-align: center;
    color: var(--light-text-color);
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 1.1em;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .dashboard-header h1 {
        font-size: 1.8em;
    }

    .dashboard-nav ul {
        flex-direction: column;
        align-items: center;
    }

    .dashboard-nav li {
        margin: 5px 0;
    }

    .dashboard-main {
        padding: 10px;
        margin: 10px auto;
    }

    .dashboard-section {
        padding: 15px;
    }

    .card-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .dashboard-header {
        padding: 15px 10px;
    }

    .dashboard-header h1 {
        font-size: 1.5em;
    }

    .card p {
        font-size: 2em;
    }
}

/* Login Modal Styles */
.modal {
    display: none; /* Hidden by default */
    position: fixed; /* Stay in place */
    z-index: 1000; /* Sit on top */
    left: 0;
    top: 0;
    width: 100%; /* Full width */
    height: 100%; /* Full height */
    overflow: auto; /* Enable scroll if needed */
    background-color: rgba(0,0,0,0.6); /* Black w/ opacity */
    display: flex; /* Use flexbox for centering */
    justify-content: center; /* Center horizontally */
    align-items: center; /* Center vertically */
}

.modal-content {
    background-color: var(--card-background);
    margin: auto;
    padding: 30px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    text-align: center;
}

.modal-content h2 {
    color: var(--primary-color);
    margin-top: 0;
    margin-bottom: 20px;
}

.modal-content p {
    margin-bottom: 15px;
    color: var(--light-text-color);
}

.modal-content input[type="password"] {
    width: calc(100% - 20px);
    padding: 10px;
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    font-size: 1em;
}

.modal-content button {
    background-color: var(--primary-color);
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1.1em;
    font-weight: 700;
    transition: background-color 0.3s ease;
}

.modal-content button:hover {
    background-color: #45a049; /* Darker green */
}

.error-message {
    color: #d32f2f; /* Red for error */
    margin-top: 10px;
    font-size: 0.9em;
    display: none; /* Hidden by default */
}