:root {
    --bg-color: #0F111A;
    --text-primary: #F1F5F9;
    --text-secondary: #94A3B8;
    --primary-color: #22D3EE; /* Cyan Neon */
    --accent-green: #34D399;  /* Emerald Neon */
    --accent-gradient: linear-gradient(135deg, #06B6D4 0%, #3B82F6 100%);
    --card-bg: #161B26;
    --card-border: 1px solid rgba(56, 66, 89, 0.4);
    --glass-bg: rgba(22, 27, 38, 0.7);
    --glass-border: 1px solid rgba(255, 255, 255, 0.08);
    --card-shadow: 0px 10px 30px rgba(0, 0, 0, 0.4);
    --neon-glow: 0 0 10px rgba(34, 211, 238, 0.2);
    --card-radius: 16px; /* Modular Feel */
    --font-main: 'Inter', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

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

body {
    background-color: var(--bg-color);
    background-image: 
        radial-gradient(circle at 15% 25%, rgba(6, 182, 212, 0.05) 0%, transparent 45%),
        radial-gradient(circle at 85% 75%, rgba(59, 130, 246, 0.05) 0%, transparent 45%);
    color: var(--text-primary);
    font-family: var(--font-main);
    overflow-x: hidden;
    line-height: 1.6;
}

#canvas-container {
    display: none;
}

/* Navigation - Dark Matte Glass */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem 2rem;
    background: rgba(15, 17, 26, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    position: fixed;
    width: 94%;
    left: 3%;
    top: 20px;
    z-index: 1000;
    border-radius: 12px;
    border: var(--glass-border);
    box-shadow: var(--card-shadow);
}

.logo {
    font-family: var(--font-main);
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--primary-color);
    letter-spacing: -0.5px;
    display: flex;
    align-items: center;
    gap: 8px;
    text-shadow: 0 0 15px rgba(34, 211, 238, 0.3);
}

.highlight {
    color: var(--text-primary);
    font-weight: 500;
    font-size: 1rem;
    opacity: 0.9;
}

.nav-links {
    background: transparent;
    padding: 0;
    display: flex;
    gap: 1rem;
}

.nav-links a {
    color: var(--text-secondary);
    text-decoration: none;
    padding: 6px 16px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
    border: 1px solid transparent;
}

.nav-links a:hover {
    color: var(--primary-color);
    background: rgba(34, 211, 238, 0.05);
}

.nav-links a.active {
    background: rgba(34, 211, 238, 0.1);
    color: var(--primary-color);
    border-color: rgba(34, 211, 238, 0.2);
    font-weight: 600;
    box-shadow: 0 0 15px rgba(34, 211, 238, 0.1);
}

/* Remove old active underline */
.nav-links a.active::after {
    display: none;
}

/* User Profile */
.user-actions {
    display: flex;
    align-items: center;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: 30px;
    transition: background 0.3s;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.user-profile:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.1);
}

.avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid var(--primary-color);
    box-shadow: 0 0 8px rgba(34, 211, 238, 0.3);
    overflow: hidden;
    z-index: 1001;
}

.username {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
}

.dropdown-menu {
    display: none; /* Hidden by default */
}

/* Layout */
.referral-page {
    padding: 120px 5% 4rem;
    max-width: 1200px;
    margin: 0 auto;
    min-height: 100vh;
}

/* Back Link */
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    margin-bottom: 2rem;
    transition: color 0.3s;
    font-size: 0.9rem;
    padding: 8px 16px;
    border-radius: 8px;
    background: var(--card-bg);
    border: var(--glass-border);
}

.back-link:hover {
    color: var(--primary-color);
    border-color: var(--primary-color);
    background: rgba(34, 211, 238, 0.05);
}

/* Modular Dark Cards */
.glass-panel {
    background: var(--card-bg);
    border: var(--card-border);
    border-radius: var(--card-radius);
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--card-shadow);
    position: relative;
    overflow: hidden;
}

/* Card Top Neon Accent */
.glass-panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(34, 211, 238, 0.5), transparent);
}

.section-header-sm, .section-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.section-header-sm h3, .section-header-row h3 {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.icon {
    width: 36px;
    height: 36px;
    background: rgba(34, 211, 238, 0.1);
    border-radius: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.1rem;
    color: var(--primary-color);
    border: 1px solid rgba(34, 211, 238, 0.2);
}

/* Invite Section */
.invite-tools {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.input-group label {
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 500;
    margin-bottom: 0.6rem;
    display: block;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.input-wrapper {
    display: flex;
    background: #11141D;
    border-radius: 8px;
    padding: 4px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    transition: all 0.3s;
}

.input-wrapper:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(34, 211, 238, 0.1);
}

.input-wrapper input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-primary);
    padding: 0.8rem 1.2rem;
    font-family: var(--font-mono);
    font-weight: 500;
    outline: none;
    font-size: 0.9rem;
}

.copy-btn {
    background: rgba(34, 211, 238, 0.1);
    border: 1px solid rgba(34, 211, 238, 0.2);
    color: var(--primary-color);
    padding: 0 1.5rem;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.copy-btn:hover {
    background: var(--primary-color);
    color: #0F111A;
    box-shadow: 0 0 15px rgba(34, 211, 238, 0.4);
}

/* Level System */
.current-status {
    background: linear-gradient(145deg, #1A202C 0%, #161B26 100%);
    padding: 2rem;
    border-radius: 12px;
    margin-bottom: 0;
    display: flex;
    align-items: center;
    gap: 3rem;
    color: var(--text-primary);
    border: 1px solid rgba(56, 66, 89, 0.6);
    position: relative;
}

/* Status Card Accent Line */
.current-status::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--accent-gradient);
    border-radius: 12px 0 0 12px;
}

.level-badge {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--primary-color);
    background: rgba(34, 211, 238, 0.05);
    border: 1px solid rgba(34, 211, 238, 0.2);
    padding: 0.8rem 2rem;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 0 20px rgba(34, 211, 238, 0.1);
}

.salary-tag {
    background: rgba(52, 211, 153, 0.1);
    color: var(--accent-green);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    text-align: center;
    margin-top: 1rem;
    border: 1px solid rgba(52, 211, 153, 0.2);
}

.status-info {
    flex: 1;
}

.progress-label {
    display: flex;
    justify-content: space-between;
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-bottom: 0.8rem;
}

.level-progress-bar {
    background: #11141D;
    height: 8px;
    border-radius: 4px;
    margin-bottom: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
    overflow: hidden;
}

.level-progress-fill {
    background: var(--accent-gradient);
    box-shadow: 0 0 15px rgba(6, 182, 212, 0.4);
    height: 100%;
    border-radius: 4px;
}

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

.next-goal-text {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.view-details-link {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s;
}

.view-details-link:hover {
    text-shadow: 0 0 8px rgba(34, 211, 238, 0.5);
    gap: 8px;
}

/* Stats Grid - Modular Layout */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
}

.stat-card {
    background: #131720;
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary-color);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
}

.stat-value {
    font-size: 1.8rem;
    color: var(--text-primary);
    font-weight: 700;
    font-family: var(--font-mono);
    margin-bottom: 0.4rem;
}

.stat-label {
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.highlight-text .stat-value {
    color: var(--primary-color);
    text-shadow: 0 0 10px rgba(34, 211, 238, 0.2);
}

.money-text .stat-value {
    color: var(--accent-green); /* Emerald */
    text-shadow: 0 0 10px rgba(52, 211, 153, 0.2);
}

/* Buttons */
.outline-btn-sm {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text-secondary);
    padding: 0.5rem 1.2rem;
    border-radius: 6px;
    font-weight: 500;
    font-size: 0.85rem;
    transition: all 0.3s;
    cursor: pointer;
}

.outline-btn-sm:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background: rgba(34, 211, 238, 0.05);
}

.cta-button {
    background: var(--primary-color);
    color: #0F111A;
    border: none;
    padding: 0.6rem 1.5rem;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 0 15px rgba(34, 211, 238, 0.2);
}

.cta-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 25px rgba(34, 211, 238, 0.4);
    filter: brightness(1.1);
}

/* Tags */
.tag {
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    border: 1px solid transparent;
}

/* Updated Tag Colors for Dark Theme - High Contrast */
.tag.l1 { background: rgba(2, 136, 209, 0.15); color: #38BDF8; border-color: rgba(56, 189, 248, 0.3); }
.tag.l2 { background: rgba(234, 179, 8, 0.15); color: #FACC15; border-color: rgba(250, 204, 21, 0.3); }
.tag.l3 { background: rgba(249, 115, 22, 0.15); color: #FB923C; border-color: rgba(251, 146, 60, 0.3); }
.tag.l4 { background: rgba(239, 68, 68, 0.15); color: #F87171; border-color: rgba(248, 113, 113, 0.3); }
.tag.l5 { background: rgba(168, 162, 158, 0.15); color: #D6D3D1; border-color: rgba(214, 211, 209, 0.3); }
.tag.l6 { background: rgba(168, 85, 247, 0.15); color: #C084FC; border-color: rgba(192, 132, 252, 0.3); }

/* Tables */
.level-table-container {
    overflow-x: auto;
}

.level-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.level-table th {
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding: 1.2rem 1rem;
    text-align: left;
}

.level-table td {
    padding: 1.2rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-weight: 500;
    color: var(--text-primary);
}

.level-table tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}
.level-table tr.active-row {
    background: rgba(34, 211, 238, 0.05);
    border-left: 2px solid var(--primary-color);
}

/* Team Management Tabs */
.tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding-bottom: 0.5rem;
}

.tab-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 0.8rem 1.2rem;
    cursor: pointer;
    font-size: 0.9rem;
    position: relative;
    border-radius: 6px;
    transition: all 0.2s;
}

.tab-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.03);
}

.tab-btn.active {
    color: var(--primary-color);
    background: rgba(34, 211, 238, 0.05);
    font-weight: 600;
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -9px; /* Adjust to overlap border-bottom */
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--primary-color);
    box-shadow: 0 0 10px var(--primary-color);
}

.tab-content {
    display: none;
}

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

/* Member List */
.member-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.member-item {
    background: rgba(255, 255, 255, 0.02);
    padding: 1.2rem;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid transparent;
    transition: all 0.2s;
}

.member-item:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.1);
}

.member-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.member-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #2A303C;
}

.member-details h4 {
    color: var(--text-primary);
    font-size: 0.95rem;
    margin-bottom: 0.2rem;
}

.member-details p {
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.action-btn {
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.8rem;
    margin-left: 0.5rem;
    transition: all 0.2s;
}

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

.action-btn.danger:hover {
    color: #F87171;
    border-color: #F87171;
    background: rgba(239, 68, 68, 0.1);
}

.action-btn.primary {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.action-btn.primary:hover {
    background: var(--primary-color);
    color: #0F111A;
}

/* Logs */
.log-list {
    font-family: var(--font-mono);
    font-size: 0.85rem;
}

.log-item {
    padding: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    gap: 1rem;
}

.log-time {
    color: var(--text-secondary);
    min-width: 140px;
    opacity: 0.7;
}

.log-action {
    color: var(--primary-color);
}

/* Profit Section Styles */
.profit-ratios {
    display: flex;
    gap: 0.8rem;
}

.profit-info {
    text-align: right;
}

.profit-info .money-text {
    color: var(--accent-green);
    font-weight: 700;
    font-family: var(--font-mono);
    font-size: 1.1rem;
    text-shadow: 0 0 10px rgba(52, 211, 153, 0.2);
}

/* List Header */
.list-header {
    display: flex;
    justify-content: space-between;
    padding: 0.8rem 1.2rem;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    margin-bottom: 0.5rem;
}

/* Incentive System Section */
.incentive-section {
    color: var(--text-primary);
    line-height: 1.8;
}

.incentive-block {
    margin-bottom: 2.5rem;
    padding-bottom: 2.5rem;
    border-bottom: 1px dashed rgba(255, 255, 255, 0.1);
}

.incentive-block:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.incentive-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.incentive-subtitle {
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
    margin: 1.2rem 0 0.8rem;
    padding-left: 1rem;
    border-left: 3px solid var(--primary-color);
}

.incentive-text {
    color: var(--text-secondary);
    margin-bottom: 1rem;
    font-size: 0.95rem;
}

.highlight-box {
    background: rgba(34, 211, 238, 0.05);
    border: 1px solid rgba(34, 211, 238, 0.1);
    padding: 1rem;
    border-radius: 8px;
    margin: 1rem 0;
}

.highlight-box p {
    margin: 0;
    color: var(--text-primary);
    font-weight: 500;
}

.salary-table-container {
    margin-top: 1rem;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.salary-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.salary-table th {
    background: rgba(255, 255, 255, 0.03);
    text-align: left;
    padding: 1rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.salary-table td {
    padding: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

footer {
    padding: 3rem 5%;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.85rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    margin-top: 4rem;
}

@media (max-width: 768px) {
    .navbar {
        width: 94%;
        left: 3%;
        padding: 0.8rem 1rem;
    }
    .referral-page {
        padding-top: 110px;
    }
    .nav-links {
        display: none;
    }
    .invite-tools, .stats-grid {
        grid-template-columns: 1fr;
    }
    .current-status {
        flex-direction: column;
        align-items: flex-start;
        gap: 2rem;
    }
    .back-link {
        position: relative;
        top: 0;
        left: 0;
        margin-bottom: 1rem;
        display: inline-flex;
    }
}
