/* --- Variables & Global Reset --- */
:root {
    --dark-bg: #1e1f29;       /* Main background */
    --sidebar-bg: #272834;    /* Sidebar/Card background */
    --text-color: #f0f0f0;    /* Light text */
    --accent-color: #7957d5;  /* Purple/Melonly accent */
    --card-hover: #353644;    /* Subtle hover color */
    --border-color: #3b3c4d;  /* Light separator */
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
}

body {
    background-color: var(--dark-bg);
    color: var(--text-color);
}

/* --- Layout Structure --- */
.dashboard {
    display: flex;
    min-height: 100vh;
}

/* --- Sidebar Styling --- */
.sidebar {
    width: 250px;
    background-color: var(--sidebar-bg);
    padding: 20px 0;
    display: flex;
    flex-direction: column;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.2);
}

.logo {
    font-size: 1.5em;
    font-weight: bold;
    text-align: center;
    color: var(--accent-color);
    margin-bottom: 30px;
}

.nav-menu {
    display: flex;
    flex-direction: column;
    flex-grow: 1; /* Allows settings to push to the bottom */
}

.nav-item {
    padding: 15px 20px;
    text-decoration: none;
    color: var(--text-color);
    font-size: 0.95em;
    transition: background-color 0.2s, color 0.2s;
}

.nav-item:hover {
    background-color: var(--card-hover);
}

.nav-item.active {
    background-color: var(--accent-color);
    color: white;
    border-left: 5px solid white;
    padding-left: 15px; /* Adjust padding due to border */
}

.nav-item i {
    margin-right: 10px;
    width: 20px;
    text-align: center;
}

/* --- Main Content Area --- */
.main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

/* --- Top Bar --- */
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 30px;
    background-color: var(--sidebar-bg);
    border-bottom: 1px solid var(--border-color);
}

.search-bar {
    position: relative;
    width: 400px;
}

.search-bar input {
    width: 100%;
    padding: 10px 15px 10px 40px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background-color: var(--dark-bg);
    color: var(--text-color);
    outline: none;
    transition: border-color 0.2s;
}

.search-bar input:focus {
    border-color: var(--accent-color);
}

.search-bar i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #888;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.avatar {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    background-color: var(--accent-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.8em;
}

/* --- Content Body --- */
.content-body {
    padding: 30px;
}

.content-body h2 {
    margin-bottom: 25px;
    color: var(--text-color);
    font-weight: 300;
}

/* --- Cards and Stats --- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.card {
    background-color: var(--sidebar-bg);
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.stat-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.stat-card i {
    font-size: 2em;
    color: var(--accent-color);
    margin-bottom: 10px;
}

.stat-card h3 {
    font-size: 0.9em;
    color: #aaa;
    margin-bottom: 5px;
}

.stat-number {
    font-size: 2.2em;
    font-weight: bold;
    color: var(--text-color);
}

/* --- Table Styling --- */
.recent-table h3 {
    margin-bottom: 20px;
    color: var(--text-color);
}

.recent-table table {
    width: 100%;
    border-collapse: collapse;
}

.recent-table th, .recent-table td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.recent-table th {
    color: #aaa;
    font-weight: 400;
    text-transform: uppercase;
    font-size: 0.8em;
}

.recent-table tbody tr:hover {
    background-color: var(--card-hover);
}