:root {
    /* Default to Dark (Slate/Indigo) as requested by aesthetic */
    --bg-color: #020617;
    /* Slate 950 */
    --text-color: #f8fafc;
    /* Slate 50 */
    --glass-bg: rgba(15, 23, 42, 0.7);
    /* Slate 900, 70% */
    --glass-border: rgba(255, 255, 255, 0.05);
    --primary: #6366f1;
    /* Indigo 500 */
    --secondary: #3b82f6;
    /* Blue 500 */
    --accent: #f43f5e;
    /* Rose 500 */
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Outfit', sans-serif;
}

/* Light Mode (Optional - kept for switch compatibility but restyled to be cohesive) */
/* Light Mode (Fresh "Blue and White" as requested) */
[data-theme="light"] {
    --bg-color: #f0f4f8;
    /* Soft Haze Blue */
    --text-color: #1e293b;
    /* Slate 800 */
    --glass-bg: rgba(255, 255, 255, 0.85);
    --glass-border: rgba(59, 130, 246, 0.1);
    /* Subtle blue tint */
    --primary: #2563eb;
    /* Blue 600 */
    --secondary: #3b82f6;
    /* Blue 500 */
    --accent: #ef4444;
    /* Red 500 */
    --shadow: 0 4px 6px -1px rgba(59, 130, 246, 0.1), 0 2px 4px -1px rgba(59, 130, 246, 0.06);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-body);
    background-color: var(--bg-color);
    /* Subtle ambient background */
    background-image:
        radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.15) 0px, transparent 50%),
        radial-gradient(at 100% 0%, rgba(59, 130, 246, 0.15) 0px, transparent 50%);
    background-attachment: fixed;
    color: var(--text-color);
    min-height: 100vh;
    transition: background-color 0.3s, color 0.3s;
    line-height: 1.6;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-heading);
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--text-color);
}

h1 {
    font-size: 2.5rem;
    letter-spacing: -0.025em;
}

h2 {
    font-size: 1.8rem;
    letter-spacing: -0.025em;
}

h3 {
    font-size: 1.5rem;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Glassmorphism Card */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow);
    padding: 24px;
    margin-bottom: 24px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.glass-panel:hover {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.2);
}

/* Navbar */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    margin-bottom: 2rem;
    position: sticky;
    top: 20px;
    z-index: 1000;

    /* PC Floating Effect */
    width: 95%;
    max-width: 1400px;
    margin: 20px auto 2rem auto;
    /* Top/Bottom margins, auto left/right */
    border-radius: 16px;
}

.nav-links {
    display: flex;
    gap: 24px;
    align-items: center;
}

.nav-item {
    text-decoration: none;
    color: var(--text-color);
    font-weight: 500;
    transition: color 0.2s;
    opacity: 0.8;
}

.nav-item:hover {
    color: var(--primary);
    opacity: 1;
}

/* Auth Profile */
.user-menu {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.05);
    padding: 6px 12px;
    border-radius: 50px;
    border: 1px solid var(--glass-border);
    transition: background 0.2s;
}

.user-menu:hover {
    background: rgba(255, 255, 255, 0.1);
}

.avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--primary);
}

.dropdown-menu {
    position: absolute;
    top: 120%;
    right: 0;
    background: #0f172a;
    /* Slate 900 Solid for readability */
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 8px;
    display: none;
    flex-direction: column;
    min-width: 180px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
    z-index: 100;
}

.dropdown-menu .nav-item {
    padding: 10px 16px;
    border-radius: 6px;
    display: block;
    width: 100%;
}

.dropdown-menu .nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.user-menu:hover .dropdown-menu {
    display: flex;
}

/* Buttons */
.btn {
    padding: 10px 24px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
}

.btn-primary {
    background-color: var(--primary);
    color: white;
    box-shadow: 0 4px 6px -1px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
    background-color: #4f46e5;
    /* Indigo 600 */
    transform: translateY(-1px);
    box-shadow: 0 6px 8px -1px rgba(99, 102, 241, 0.4);
}

.btn:active {
    transform: translateY(0);
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
}

/* Tables */
.table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-top: 16px;
}

.table th,
.table td {
    padding: 16px;
    text-align: left;
    border-bottom: 1px solid var(--glass-border);
}

.table th {
    font-weight: 600;
    color: var(--text-color);
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.05em;
    opacity: 0.7;
}

.table tr:last-child td {
    border-bottom: none;
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    border-radius: 8px;
    border: 1px solid var(--glass-border);
    background: rgba(15, 23, 42, 0.4);
    /* Darker input bg */
    color: var(--text-color);
    font-size: 1rem;
    transition: border-color 0.2s, ring 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

/* Stats */
.stat-card {
    text-align: center;
    padding: 2.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.stat-number {
    font-size: 3.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-top: 10px;
    line-height: 1;
}

/* Status Tags */
.status-tag {
    padding: 4px 10px;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.status-tag.in_progress {
    background: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.status-tag.completed {
    background: rgba(34, 197, 94, 0.2);
    color: #4ade80;
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.status-tag.created {
    background: rgba(148, 163, 184, 0.2);
    color: #94a3b8;
    border: 1px solid rgba(148, 163, 184, 0.3);
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--glass-border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Rank Badge */
.rank-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    font-weight: bold;
    font-size: 0.9rem;
}


[data-theme="dark"] {
    --bg-color: #1a1a1a;
    --text-color: #e0e0e0;
    --glass-bg: rgba(40, 40, 40, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
    --primary: #8f94fb;
    --secondary: #4e54c8;
    --shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background: var(--bg-color);
    color: var(--text-color);
    background-image: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    background-attachment: fixed;
    min-height: 100vh;
    transition: background 0.3s, color 0.3s;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Glassmorphism Card */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 16px;
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow);
    padding: 20px;
    margin-bottom: 20px;
}

/* Navbar */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    margin-bottom: 2rem;
}

.nav-links {
    display: flex;
    gap: 20px;
    align-items: center;
}

.nav-item {
    text-decoration: none;
    color: var(--text-color);
    font-weight: 600;
    transition: color 0.2s;
}

.nav-item:hover {
    color: var(--primary);
}

/* Auth Profile */
.user-menu {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--primary);
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--glass-bg);
    backdrop-filter: blur(15px);
    border-radius: 12px;
    padding: 10px;
    display: none;
    flex-direction: column;
    min-width: 150px;
    box-shadow: var(--shadow);
    z-index: 100;
}

.user-menu:hover .dropdown-menu {
    display: flex;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    transition: transform 0.1s, opacity 0.2s;
    text-decoration: none;
    display: inline-block;
}

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

.btn:active {
    transform: scale(0.98);
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

/* Tables */
.table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

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

.table th {
    font-weight: 700;
    color: var(--primary);
}

/* Forms */
.form-group {
    margin-bottom: 15px;
}

.form-control {
    width: 100%;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.5);
    color: var(--text-color);
    font-size: 1rem;
}

/* Stats */
.stat-card {
    text-align: center;
    padding: 2rem;
}

.stat-number {
    font-size: 3rem;
    font-weight: bold;
    color: var(--primary);
}

/* Admin Dashboard Styles */
.admin-dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.admin-card {
    background: var(--glass-bg);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    text-align: center;
    transition: transform 0.2s;
    border: 1px solid var(--glass-border);
    text-decoration: none;
    color: inherit;
    display: block;
}

.admin-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    color: var(--primary);
    background: rgba(255, 255, 255, 0.1);
}

.admin-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: var(--primary);
}

.admin-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.admin-desc {
    color: var(--text-color);
    font-size: 0.9rem;
    opacity: 0.8;
}