:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #13131a;
    --bg-tertiary: #1a1a24;
    --bg-glass: rgba(26, 26, 36, 0.7);
    --bg-glass-hover: rgba(26, 26, 36, 0.85);
    --border-color: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(255, 255, 255, 0.15);
    --text-primary: #ffffff;
    --text-secondary: #a0a0ab;
    --text-tertiary: #6b6b76;
    --accent-primary: #6366f1;
    --accent-secondary: #4f46e5;
    --accent-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.12);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.16);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.24);
    --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.32);
    --glow: 0 0 20px rgba(99, 102, 241, 0.3);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

body::before {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 50% 50%, rgba(99, 102, 241, 0.08) 0%, transparent 50%);
    animation: rotate 60s linear infinite;
    pointer-events: none;
    z-index: 0;
}

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 24px;
    position: relative;
    z-index: 1;
}

/* Header */
header {
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(20px) saturate(180%);
    background: rgba(10, 10, 15, 0.8);
    border-bottom: 1px solid var(--border-color);
    padding: 16px 0;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.logo:hover {
    transform: translateY(-2px);
}

.logo-icon {
    width: 36px;
    height: 36px;
    background: var(--accent-gradient);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    box-shadow: var(--glow);
    animation: pulse 3s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 20px rgba(99, 102, 241, 0.3); }
    50% { box-shadow: 0 0 30px rgba(99, 102, 241, 0.5); }
}

nav {
    display: flex;
    gap: 12px;
    align-items: center;
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 8px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 14px;
    font-weight: 500;
}

.nav-link:hover {
    color: var(--text-primary);
    background: var(--bg-glass);
    transform: translateY(-1px);
}

.btn {
    padding: 10px 20px;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
    display: inline-block;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:hover::before {
    width: 300px;
    height: 300px;
}

.btn-primary {
    background: var(--accent-gradient);
    color: white;
    box-shadow: var(--shadow-md);
}

.btn-primary:hover {
    box-shadow: var(--glow), var(--shadow-lg);
    transform: translateY(-2px);
}

.btn-secondary {
    background: var(--bg-glass);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    backdrop-filter: blur(10px);
}

.btn-secondary:hover {
    background: var(--bg-glass-hover);
    border-color: var(--border-hover);
    transform: translateY(-2px);
}

/* Hero Section */
.hero {
    text-align: center;
    padding: 120px 0 80px;
    position: relative;
}

.hero h1 {
    font-size: 56px;
    font-weight: 800;
    margin-bottom: 20px;
    background: linear-gradient(135deg, #ffffff 0%, #a0a0ab 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: fadeInUp 0.8s ease-out;
    letter-spacing: -0.02em;
}

.hero p {
    font-size: 20px;
    color: var(--text-secondary);
    margin-bottom: 40px;
    animation: fadeInUp 0.8s ease-out 0.2s both;
}

.hero-buttons {
    display: flex;
    gap: 16px;
    justify-content: center;
    animation: fadeInUp 0.8s ease-out 0.4s both;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Glass Cards */
.glass-card {
    background: var(--bg-glass);
    backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.glass-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
}

.glass-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
}

/* Auth Forms */
.auth-container {
    min-height: calc(100vh - 80px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 0;
}

.auth-box {
    background: var(--bg-glass);
    backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-xl);
    animation: fadeInUp 0.6s ease-out;
}

.auth-box h2 {
    font-size: 28px;
    margin-bottom: 32px;
    text-align: center;
    font-weight: 700;
}

.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 15px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: inherit;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
    background: rgba(255, 255, 255, 0.05);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.form-submit {
    width: 100%;
    padding: 14px;
    margin-top: 8px;
    font-size: 15px;
}

.auth-footer {
    text-align: center;
    margin-top: 24px;
    color: var(--text-secondary);
    font-size: 14px;
}

.auth-footer a {
    color: var(--accent-primary);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s;
}

.auth-footer a:hover {
    color: var(--accent-secondary);
}

.error-message {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
    padding: 14px 16px;
    border-radius: 10px;
    margin-bottom: 20px;
    font-size: 14px;
    animation: shake 0.5s;
}

.success-message {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: #6ee7b7;
    padding: 14px 16px;
    border-radius: 10px;
    margin-bottom: 20px;
    font-size: 14px;
    animation: fadeInUp 0.5s;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

/* Dashboard */
.dashboard {
    padding: 40px 0;
}

.dashboard-header {
    margin-bottom: 40px;
    animation: fadeInUp 0.6s ease-out;
}

.dashboard-header h1 {
    font-size: 36px;
    margin-bottom: 8px;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.dashboard-subtitle {
    color: var(--text-secondary);
    font-size: 16px;
}

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

.stat-card {
    background: var(--bg-glass);
    backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 28px;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    animation: fadeInUp 0.6s ease-out both;
}

.stat-card:nth-child(1) { animation-delay: 0.1s; }
.stat-card:nth-child(2) { animation-delay: 0.2s; }
.stat-card:nth-child(3) { animation-delay: 0.3s; }
.stat-card:nth-child(4) { animation-delay: 0.4s; }

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--accent-gradient);
    opacity: 0;
    transition: opacity 0.3s;
}

.stat-card:hover::before {
    opacity: 1;
}

.stat-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-6px) scale(1.02);
    box-shadow: var(--shadow-xl);
}

.stat-label {
    color: var(--text-secondary);
    font-size: 13px;
    margin-bottom: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-value {
    font-size: 36px;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.stat-icon {
    font-size: 28px;
    margin-bottom: 16px;
    opacity: 0.8;
}

/* Activity Section */
.activity-section {
    background: var(--bg-glass);
    backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 32px;
    margin-bottom: 40px;
    animation: fadeInUp 0.6s ease-out 0.5s both;
}

.activity-section h2 {
    font-size: 22px;
    margin-bottom: 24px;
    font-weight: 700;
}

/* Activity Heatmap */
.activity-heatmap {
    overflow-x: auto;
    padding: 20px 0;
}

.heatmap-grid {
    display: grid;
    grid-template-rows: repeat(7, 14px);
    grid-auto-flow: column;
    gap: 4px;
    min-width: fit-content;
}

.heatmap-cell {
    width: 14px;
    height: 14px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 3px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    border: 1px solid transparent;
}

.heatmap-cell:hover {
    transform: scale(1.3);
    border-color: var(--accent-primary);
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.5);
}

.heatmap-cell[data-level="0"] {
    background: rgba(255, 255, 255, 0.03);
}

.heatmap-cell[data-level="1"] {
    background: rgba(99, 102, 241, 0.2);
}

.heatmap-cell[data-level="2"] {
    background: rgba(99, 102, 241, 0.4);
}

.heatmap-cell[data-level="3"] {
    background: rgba(99, 102, 241, 0.6);
}

.heatmap-cell[data-level="4"] {
    background: rgba(99, 102, 241, 0.8);
}

.heatmap-cell[data-level="5"] {
    background: var(--accent-primary);
    box-shadow: 0 0 8px rgba(99, 102, 241, 0.4);
}

.heatmap-legend {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 20px;
    font-size: 12px;
    color: var(--text-secondary);
}

/* Recent Activity */
.recent-activity {
    background: var(--bg-glass);
    backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 32px;
    animation: fadeInUp 0.6s ease-out 0.6s both;
}

.recent-activity h2 {
    font-size: 22px;
    margin-bottom: 24px;
    font-weight: 700;
}

.activity-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.activity-item {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.activity-item:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: var(--border-hover);
    transform: translateX(4px);
}

.activity-info {
    flex: 1;
}

.activity-type {
    font-weight: 600;
    margin-bottom: 6px;
    font-size: 15px;
}

.activity-description {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.activity-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 14px;
}

.activity-points {
    color: var(--success);
    font-weight: 700;
    font-size: 16px;
}

.activity-time {
    color: var(--text-tertiary);
    font-size: 13px;
}

/* Leaderboard */
.leaderboard {
    background: var(--bg-glass);
    backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 32px;
    margin-top: 40px;
    animation: fadeInUp 0.6s ease-out 0.7s both;
}

.leaderboard h2 {
    font-size: 22px;
    margin-bottom: 24px;
    font-weight: 700;
}

.leaderboard-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.leaderboard-item {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 20px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.leaderboard-item:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: var(--border-hover);
    transform: translateX(4px);
}

.leaderboard-rank {
    font-size: 22px;
    font-weight: 800;
    min-width: 50px;
    text-align: center;
}

.leaderboard-rank.top-1 {
    color: #fbbf24;
    text-shadow: 0 0 10px rgba(251, 191, 36, 0.5);
}

.leaderboard-rank.top-2 {
    color: #d1d5db;
    text-shadow: 0 0 10px rgba(209, 213, 219, 0.5);
}

.leaderboard-rank.top-3 {
    color: #f97316;
    text-shadow: 0 0 10px rgba(249, 115, 22, 0.5);
}

.leaderboard-user {
    flex: 1;
}

.leaderboard-username {
    font-weight: 600;
    margin-bottom: 4px;
    font-size: 15px;
}

.leaderboard-role {
    font-size: 12px;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.leaderboard-points {
    font-size: 20px;
    font-weight: 800;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Loading */
.loading {
    text-align: center;
    padding: 60px 40px;
    color: var(--text-secondary);
}

.spinner {
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top: 3px solid var(--accent-primary);
    border-radius: 50%;
    width: 48px;
    height: 48px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Tabs */
.tab-btn {
    padding: 12px 24px;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.tab-btn::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--accent-gradient);
    transform: scaleX(0);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.tab-btn:hover {
    color: var(--text-primary);
}

.tab-btn.active {
    color: var(--accent-primary);
}

.tab-btn.active::after {
    transform: scaleX(1);
}

.tab-content {
    display: none;
    animation: fadeInUp 0.4s ease-out;
}

.tab-content.active {
    display: block;
}

/* Table */
table {
    font-size: 14px;
    width: 100%;
}

table th {
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.1em;
    padding: 16px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

table td {
    padding: 16px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

table tr {
    transition: background 0.2s;
}

table tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

/* Responsive */
@media (max-width: 768px) {
    .hero h1 {
        font-size: 36px;
    }

    .hero p {
        font-size: 16px;
    }

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

    .heatmap-grid {
        grid-template-rows: repeat(7, 11px);
        gap: 3px;
    }

    .heatmap-cell {
        width: 11px;
        height: 11px;
    }

    .activity-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .auth-box {
        padding: 32px 24px;
    }
}

/* Smooth scroll */
html {
    scroll-behavior: smooth;
}

/* Selection */
::selection {
    background: rgba(99, 102, 241, 0.3);
    color: white;
}
