/* --- Theme Variables --- */
:root {
    --bg-color: #f4f6f9;
    --text-color: #333333;
    --inverse-text-color: #ffffff;
    --card-bg: #ffffff;
    --border-color: #dddddd;
    --primary-color: #4a7ebb;
    --primary-hover: #366092;
    --secondary-color: #6c757d;
    --secondary-hover: #5a6268;
    --sidebar-bg: #2c3e50;
    --sidebar-text: #ecf0f1;
}

[data-theme="dark"] {
    --bg-color: #121212;
    --text-color: #e0e0e0;
    --inverse-text-color: #000000;
    --card-bg: #1e1e1e;
    --border-color: #333333;
    --primary-color: #4da6ff;
    --primary-hover: #80bfff;
    --secondary-color: #b0b0b0;
    --secondary-hover: #d0d0d0;
    --sidebar-bg: #1a1a1a;
    --sidebar-text: #cccccc;
}

/* --- Global Resets & Base Styles --- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: Arial, sans-serif;
    transition: background-color 0.3s ease, color 0.3s ease;
}

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

.main-wrapper {
    display: flex;
    min-height: 100vh;
}

.content-area {
    flex: 1;
}

.btn {
    margin: 2px;
    padding: 10px 15px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.btn-primary {
    background: var(--primary-color);
    color: var(--inverse-text-color);
    
}

.btn-secondary {
    background: var(--secondary-color);
    color: var(--inverse-text-color);
}

/* --- Topbar --- */
.content-area {
    flex: 1;
    display: flex;
    flex-direction: column;
}
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 19px 20px;
    background-color: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
}
.topbar-right {
    display: flex;
    align-items: center;
    gap: 15px;
}
.theme-toggle-btn {
    background: none;
    border: 1px solid var(--border-color);
    padding: 5px 10px;
    cursor: pointer;
    color: var(--text-color);
    border-radius: 4px;
}

/* --- Sidebar --- */
.sidebar {
    width: 250px;
    background-color: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
}
.sidebar-brand {
    padding: 20px;
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    /* Mobile ke liye flexbox ready rakhein */
    display: flex; 
    justify-content: space-between;
    align-items: center;
}

/* Default state (Hidden on Desktop) */
.mobile-nav-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--sidebar-text);
    font-size: 24px;
    cursor: pointer;
}
.sidebar-nav {
    list-style: none;
    padding: 0;
    margin: 20px 0;
}
.sidebar-nav li a {
    display: block;
    padding: 15px 20px;
    color: var(--sidebar-text);
    transition: background 0.2s;
}
.sidebar-nav li a:hover {
    background-color: rgba(255,255,255,0.1);
}

/* --- Dashboard Main & Cards --- */
.dashboard-main {
    padding: 20px;
}

.welcome-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.welcome-text {
    margin-bottom: 20px;
    color: var(--text-color);
}

.btn-lg {
    padding: 12px 20px;
    font-size: 16px;
    font-weight: bold;
}

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

.stat-card {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    text-align: center;
}

.stat-card h3 {
    font-size: 14px;
    color: #666; /* Light theme specific, can adjust with variables */
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-card .stat-value {
    font-size: 32px;
    font-weight: bold;
    color: var(--primary-color);
}

/* --- Footer --- */
.main-footer {
    text-align: center;
    padding: 15px;
    background-color: var(--card-bg);
    border-top: 1px solid var(--border-color);
    margin-top: auto; /* Pushes footer to the bottom */
}

/* --- Responsive Design (Mobile & Tablet) --- */
@media (max-width: 768px) {
    .main-wrapper {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        border-bottom: 1px solid var(--border-color);
        height: auto; 
    }
    
    .mobile-nav-toggle {
        display: block; /* Mobile par button show hoga */
    }
    
    .sidebar-nav {
        display: none; /* By default hidden */
        flex-direction: column; /* Vertical layout */
        margin: 0;
        max-height: 70vh; /* 70% screen height ki limit */
        overflow-y: auto; /* Agar items jyada hon to scroll aaye */
        background-color: var(--sidebar-bg); /* Toggle hone par background solid rahe */
    }
    
    .sidebar-nav.show-nav {
        display: flex; /* Button click par show hoga */
    }
    
    .sidebar-nav li a {
        padding: 15px 20px;
        text-align: left; /* Text left-aligned ho jayega */
        border-bottom: 1px solid rgba(255,255,255,0.05);
    }
    
    .topbar {
        padding: 12px 15px;
    }
}