:root {
    /* Light Mode Variables */
    --bg-color: #f0f2f5;
    --text-color: #1f2937;
    --card-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.5);
    --primary-color: #0d9488;
    /* Teal 600 */
    --secondary-color: #1e3a8a;
    /* Blue 900 */
    --accent-color: #ef4444;
    /* Red 500 */
    --sidebar-bg: #ffffff;
    --input-bg: rgba(255, 255, 255, 0.9);
    --shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
}

[data-theme="dark"] {
    /* Dark Mode Variables */
    --bg-color: #0f172a;
    /* Slate 900 */
    --text-color: #f1f5f9;
    /* Slate 100 */
    --card-bg: rgba(30, 41, 59, 0.7);
    /* Slate 800 with opacity */
    --glass-border: rgba(255, 255, 255, 0.1);
    --primary-color: #14b8a6;
    /* Teal 500 */
    --secondary-color: #3b82f6;
    /* Blue 500 */
    --accent-color: #f87171;
    /* Red 400 */
    --sidebar-bg: #1e293b;
    --input-bg: rgba(51, 65, 85, 0.9);
    --shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Poppins', sans-serif;
    transition: background-color 0.3s, color 0.3s;
}

body {
    background: var(--bg-color);
    color: var(--text-color);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Glassmorphism Classes */
.glass-panel {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    box-shadow: var(--shadow);
}

/* Animated Background for Login */
.login-bg {
    background: linear-gradient(-45deg, #ee7752, #e73c7e, #23a6d5, #23d5ab);
    background-size: 400% 400%;
    animation: gradient 15s ease infinite;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

@keyframes gradient {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

/* Form Styles */
.form-control {
    width: 100%;
    padding: 12px 15px;
    margin: 8px 0;
    display: inline-block;
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    background: var(--input-bg);
    color: var(--text-color);
    outline: none;
    transition: 0.3s;
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.2);
}

.btn-primary {
    background: var(--primary-color);
    color: white;
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    width: 100%;
    font-size: 16px;
    font-weight: 600;
    transition: 0.3s;
}

.btn-primary:hover {
    filter: brightness(1.1);
    transform: translateY(-2px);
}

/* Sidebar & Layout */
.wrapper {
    display: flex;
    width: 100%;
}

.sidebar {
    width: 250px;
    height: 100vh;
    position: fixed;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--glass-border);
    padding: 20px;
    transition: 0.3s;
}

.main-content {
    margin-left: 250px;
    width: calc(100% - 250px);
    padding: 20px;
    transition: 0.3s;
}

/* Dark Mode Toggle */
.theme-switch-wrapper {
    display: flex;
    align-items: center;
    position: fixed;
    top: 20px;
    right: 30px;
    z-index: 1000;
}

.theme-switch {
    display: inline-block;
    height: 34px;
    position: relative;
    width: 60px;
}

.theme-switch input {
    display: none;
}

.slider {
    background-color: #ccc;
    bottom: 0;
    cursor: pointer;
    left: 0;
    position: absolute;
    right: 0;
    top: 0;
    transition: .4s;
}

.slider:before {
    background-color: #fff;
    bottom: 4px;
    content: "";
    height: 26px;
    left: 4px;
    position: absolute;
    transition: .4s;
    width: 26px;
}

input:checked+.slider {
    background-color: var(--primary-color);
}

input:checked+.slider:before {
    transform: translateX(26px);
}

.slider.round {
    border-radius: 34px;
}

.slider.round:before {
    border-radius: 50%;
}

/* --- Mobile Responsiveness --- */
@media (max-width: 768px) {

    /* Sidebar Mobile */
    .sidebar {
        position: fixed;
        left: -250px;
        /* Hide by default */
        top: 0;
        z-index: 1000;
        box-shadow: 5px 0 15px rgba(0, 0, 0, 0.1);
    }

    .sidebar.active {
        left: 0;
        /* Show when active */
    }

    /* Main Content Mobile */
    .main-content {
        margin-left: 0;
        width: 100%;
        padding: 15px;
    }

    /* Topbar adjustments */
    .glass-panel {
        padding: 15px !important;
        flex-direction: column;
        gap: 15px;
        align-items: flex-start !important;
    }

    .glass-panel>div {
        width: 100%;
        justify-content: space-between;
    }

    /* Hamburger Menu visible on mobile */
    .menu-toggle {
        display: block !important;
        background: none;
        border: none;
        font-size: 24px;
        color: var(--text-color);
        cursor: pointer;
        margin-right: 15px;
    }

    /* Tables */
    .table-responsive {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    table {
        min-width: 600px;
        /* Force table width so it scrolls */
    }

    /* Login Page */
    .login-container {
        width: 90% !important;
        margin: 20px;
    }
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
}

@media (max-width: 768px) {
    /* ... existing mobile styles ... */

    .dashboard-grid {
        grid-template-columns: 1fr;
        /* Stack on mobile */
    }
}

/* Helper for table wrapper */
.table-responsive {
    border-radius: 12px;
}