:root {
    --bg: #050510;
    --surface: rgba(255, 255, 255, 0.04);
    --surface-hover: rgba(255, 255, 255, 0.08);
    --border: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(255, 255, 255, 0.15);
    --text: #e8e8f0;
    --text-dim: #6b6b8d;
    --accent: #7c3aed;
    --accent2: #06b6d4;
    --glow: rgba(124, 58, 237, 0.3);
}

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

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ═══ CODE RAIN CANVAS ═══ */
#codeRain {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    opacity: 0.45;
    pointer-events: none;
}

/* ═══ GRADIENT BLOBS ═══ */
.bg-blobs {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(120px);
    animation: blobFloat 20s ease-in-out infinite alternate;
}

.blob-1 {
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(124, 58, 237, 0.25), transparent 70%);
    top: -200px;
    left: -100px;
}

.blob-2 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(6, 182, 212, 0.2), transparent 70%);
    bottom: -200px;
    right: -100px;
    animation-delay: -10s;
}

@keyframes blobFloat {
    0% {
        transform: translate(0, 0) scale(1);
    }

    50% {
        transform: translate(80px, 40px) scale(1.15);
    }

    100% {
        transform: translate(-40px, 80px) scale(0.95);
    }
}

/* ═══ CONTAINER ═══ */
.container {
    position: relative;
    z-index: 1;
    max-width: 1280px;
    margin: 0 auto;
    padding: 1.5rem 2rem;
}

/* ═══ HEADER ═══ */
.header {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 1rem 0;
    margin-bottom: 2rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

.logo-icon {
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    box-shadow: 0 0 20px var(--glow);
}

.logo h1 {
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.1;
}

.logo h1 span {
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.15em;
}

/* ═══ HEADER SEARCH ═══ */
.header-search {
    flex: 1;
    position: relative;
    margin: 0 1rem;
    /* Added margin so it nicely spaces out */
    transition: all 0.3s ease;
}

.header-search .search-icon {
    position: absolute;
    left: 0.85rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-dim);
    z-index: 2;
}

.header-search input {
    width: 100%;
    padding: 0.65rem 1rem 0.65rem 2.5rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    transition: all 0.25s ease;
}

.header-search input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.15);
    background: rgba(255, 255, 255, 0.06);
}

.header-search input::placeholder {
    color: var(--text-dim);
}

.search-results {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    width: 100%;
    background: rgba(15, 15, 30, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
    max-height: 300px;
    overflow-y: auto;
    z-index: 200;
    display: none;
}

.search-result-item {
    padding: 0.6rem 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    cursor: pointer;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    transition: background 0.15s;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover {
    background: rgba(124, 58, 237, 0.1);
}

.search-result-item .avatar {
    width: 28px;
    height: 28px;
    font-size: 0.65rem;
}

.header-actions {
    display: flex;
    gap: 0.6rem;
    flex-shrink: 0;
    margin-left: auto;
}

/* ═══ INFO BUTTONS ═══ */
.btn-info {
    height: auto;
    border-radius: 10px;
    background: rgba(124, 58, 237, 0.15);
    color: var(--accent);
    border: 1px solid rgba(124, 58, 237, 0.3);
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    padding: 0.55rem 0.75rem;
}

.btn-info:hover {
    background: rgba(124, 58, 237, 0.3);
    transform: scale(1.1);
}

.card-info-btn {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(124, 58, 237, 0.12);
    color: var(--text-dim);
    font-size: 0.65rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: auto;
    margin-right: 0.5rem;
    flex-shrink: 0;
    transition: all 0.2s ease;
    z-index: 5;
}

.card-info-btn:hover {
    background: rgba(124, 58, 237, 0.3);
    color: var(--accent);
    transform: scale(1.15);
}

.info-content {
    font-size: 0.85rem;
    line-height: 1.6;
    color: var(--text);
    padding: 0.5rem 0;
}

.info-content h4 {
    color: #c4b5fd;
    margin: 1rem 0 0.4rem;
}

.info-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 0.5rem 0;
}

.info-content table th,
.info-content table td {
    padding: 0.4rem 0.6rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-size: 0.8rem;
}

.info-content table th {
    color: var(--text-dim);
    font-weight: 600;
    font-family: 'JetBrains Mono', monospace;
    text-transform: uppercase;
    font-size: 0.65rem;
}

/* ═══ BUTTONS ═══ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    border-radius: 10px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    font-family: inherit;
    white-space: nowrap;
}

.btn-accent {
    background: linear-gradient(135deg, var(--accent), #9333ea);
    color: #fff;
    box-shadow: 0 4px 15px var(--glow);
}

.btn-accent:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px var(--glow);
}

.btn-ghost {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-ghost:hover {
    background: var(--surface-hover);
    border-color: var(--border-hover);
}

input[type="file"] {
    display: none;
}

/* ═══ EMPTY STATE (Terminal) ═══ */
.empty-state {
    text-align: center;
    padding: 0 2rem 12vh;
    max-width: 550px;
    margin: 0 auto;
    min-height: calc(100vh - 80px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.6s ease-out;
}

.empty-terminal {
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
    margin-bottom: 2rem;
    text-align: left;
    width: 100%;
    cursor: pointer;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.terminal-bar {
    display: flex;
    gap: 6px;
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid var(--border);
}

.terminal-bar span {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
}

.terminal-bar span:nth-child(1) {
    background: #ff5f57;
}

.terminal-bar span:nth-child(2) {
    background: #febc2e;
}

.terminal-bar span:nth-child(3) {
    background: #28c840;
}

.terminal-body {
    padding: 1.25rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    line-height: 1.8;
}

.t-green {
    color: #28c840;
}

.t-dim {
    color: var(--text-dim);
}

.cursor-blink {
    animation: blink 1s step-end infinite;
}

@keyframes blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0;
    }
}

.empty-state h2 {
    font-size: 1.4rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.empty-state p {
    color: var(--text-dim);
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}

/* ═══ HERO STATS ═══ */
.hero-stats {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3rem;
    padding: 2.5rem 2rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    backdrop-filter: blur(10px);
    position: relative;
    overflow: hidden;
}

.hero-stats::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--accent), var(--accent2), transparent);
}

.hero-item {
    text-align: center;
}

.hero-number {
    font-size: 3.5rem;
    font-weight: 700;
    letter-spacing: -0.04em;
    background: linear-gradient(135deg, #fff 30%, var(--accent2));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1;
}

.hero-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    margin-top: 0.5rem;
}

.hero-sep {
    width: 1px;
    height: 50px;
    background: linear-gradient(180deg, transparent, var(--border-hover), transparent);
}

/* ═══ DASHBOARD GRID ═══ */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.25rem;
    animation: fadeIn 0.5s ease-out;
}

/* ═══ CARDS ═══ */
.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    backdrop-filter: blur(10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at top right, rgba(124, 58, 237, 0.05), transparent 60%);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s;
}

.clickable-card {
    cursor: pointer;
}

.clickable-card:hover {
    transform: translateY(-6px);
    border-color: rgba(124, 58, 237, 0.3);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3), 0 0 30px rgba(124, 58, 237, 0.1);
}

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

.card-header {
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-dim);
}

.header-title {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.emoji-icon {
    font-size: 1rem;
}

.more-icon {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    color: var(--accent);
    opacity: 0;
    transition: all 0.25s;
    transform: translateX(-5px);
}

.clickable-card:hover .more-icon {
    opacity: 1;
    transform: translateX(0);
}

.chart-card {
    grid-column: 1 / -1;
}

.chart-wrapper {
    position: relative;
    height: 280px;
    width: 100%;
}

/* ═══ USER ROWS ═══ */
.user-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    opacity: 0;
    animation: slideIn 0.3s ease-out forwards;
    border-radius: 8px;
    transition: background 0.2s;
}

.user-row.user-clickable:hover {
    background: rgba(124, 58, 237, 0.1);
}

.user-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    min-width: 0;
    flex: 1;
}

.user-info-text {
    min-width: 0;
}

.user-rank {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--text-dim);
    min-width: 22px;
    text-align: right;
}

.avatar {
    width: 34px;
    height: 34px;
    flex-shrink: 0;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.7rem;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.user-name {
    font-weight: 500;
    font-size: 0.88rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-sub {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.65rem;
    color: var(--text-dim);
    margin-top: 0.1rem;
}

.user-score {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 500;
    font-size: 0.8rem;
    text-align: right;
    white-space: nowrap;
    flex-shrink: 0;
    margin-left: 0.75rem;
    color: var(--text-dim);
}

.score-badge {
    background: rgba(124, 58, 237, 0.1);
    border: 1px solid rgba(124, 58, 237, 0.2);
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
    font-size: 0.75rem;
    color: #c4b5fd;
}

/* ═══ MODALS ═══ */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(5, 5, 16, 0.7);
    backdrop-filter: blur(8px);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.modal-overlay.active {
    display: flex;
    opacity: 1;
}

.modal-container {
    background: rgba(15, 15, 30, 0.95);
    border: 1px solid var(--border);
    border-radius: 20px;
    width: 100%;
    max-width: 480px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    transform: scale(0.95) translateY(10px);
    transition: transform 0.25s ease;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.6), 0 0 40px rgba(124, 58, 237, 0.08);
    backdrop-filter: blur(20px);
}

.modal-overlay.active .modal-container {
    transform: scale(1) translateY(0);
}

.modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-weight: 600;
    font-size: 1rem;
}

.modal-close {
    background: transparent;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    transition: color 0.2s, transform 0.2s;
    display: flex;
}

.modal-close:hover {
    color: var(--text);
    transform: rotate(90deg);
}

.modal-body {
    padding: 0.75rem 1.5rem 1rem;
    overflow-y: auto;
}

/* ═══ USER PROFILE ═══ */
.user-profile-header {
    text-align: center;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1.25rem;
}

.user-profile-header .avatar {
    width: 72px;
    height: 72px;
    font-size: 1.6rem;
    border-radius: 18px;
    margin: 0 auto 0.75rem auto;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.user-profile-header h2 {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.user-profile-header p {
    color: var(--text-dim);
    font-size: 0.8rem;
    font-family: 'JetBrains Mono', monospace;
}

.profile-stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
}

.profile-stat-item {
    background: var(--surface);
    padding: 1rem;
    border-radius: 14px;
    border: 1px solid var(--border);
    text-align: center;
    transition: border-color 0.2s;
}

.profile-stat-item:hover {
    border-color: rgba(124, 58, 237, 0.3);
}

.profile-stat-value {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.15rem;
}

.profile-stat-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.65rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ═══ SCROLLBAR ═══ */
::-webkit-scrollbar {
    width: 5px;
}

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

::-webkit-scrollbar-thumb {
    background: rgba(124, 58, 237, 0.3);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(124, 58, 237, 0.5);
}

/* ═══ LOADER ═══ */
.loader-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s infinite linear;
}

/* ═══ KEYFRAMES ═══ */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(15px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-8px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

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

/* ═══ RESPONSIVE ═══ */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }

    .header {
        flex-wrap: wrap;
        gap: 0.75rem;
        justify-content: space-between;
        margin-bottom: 0.5rem;
    }

    .header-search {
        order: 2;
        max-width: 100%;
        flex-basis: 100%;
        margin: 0;
    }

    .header-actions {
        order: 3;
        margin-left: 0;
        flex-basis: 100%;
        width: 100%;
        flex-wrap: wrap;
        gap: 0.5rem;
        display: flex;
    }

    .header-actions .btn,
    .header-actions label {
        flex: 1;
        min-width: 0;
        justify-content: center;
        font-size: 0.75rem;
        padding: 0.5rem 0.4rem;
    }

    .hero-stats {
        flex-direction: column;
        gap: 1.5rem;
        padding: 2rem 1.5rem;
    }

    .hero-sep {
        width: 50px;
        height: 1px;
    }

    .hero-number {
        font-size: 2.5rem;
    }

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

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

    .blob-1 {
        width: 300px;
        height: 300px;
    }

    .blob-2 {
        width: 250px;
        height: 250px;
    }

    .modal-container {
        width: 95%;
        max-height: 85vh;
        margin: 1rem;
    }

    .modal-header {
        padding: 0.75rem 1rem;
    }

    .modal-header h3 {
        font-size: 0.85rem;
        line-height: 1.3;
    }

    .modal-body {
        padding: 0.5rem 1rem 0.75rem;
    }
}