@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

:root {
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --card-hover-bg: #fcfdfe;
    --card-border: #e2e8f0;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --primary-color: #3b82f6;
    --primary-light: #eff6ff;
    --success-color: #10b981;
    --success-light: #ecfdf5;
    
    /* Top 3 Accent Colors */
    --gold: #f59e0b;
    --silver: #9ca3af;
    --bronze: #d97706;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Outfit', 'Plus Jakarta Sans', sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    padding: 2rem 3rem;
    min-height: 100vh;
    position: relative;
    display: flex;
    justify-content: center;
}

.container {
    max-width: 100%;
    width: 100%;
    position: relative;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    padding: 1.5rem 2rem;
    border-radius: 16px;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.05), 0 1px 2px -1px rgba(0, 0, 0, 0.05);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.btn-login-nav {
    background: var(--primary-light);
    color: var(--primary-color);
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.9rem;
    text-decoration: none;
    transition: all 0.2s ease;
    border: 1px solid rgba(59, 130, 246, 0.1);
}

.btn-login-nav:hover {
    background: var(--primary-color);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
}

.title-group h1 {
    font-size: 1.75rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: var(--text-main);
    margin-bottom: 0.25rem;
}

.title-group p {
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
}

.status {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.live-indicator {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--success-color);
    background: var(--success-light);
    padding: 0.35rem 0.75rem;
    border-radius: 9999px;
    border: 1px solid rgba(16, 185, 129, 0.15);
}

.live-indicator .dot {
    width: 7px;
    height: 7px;
    background-color: var(--success-color);
    border-radius: 50%;
    animation: pulse 1.6s infinite;
}

.status-text {
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 500;
    margin-top: 6px;
}

@keyframes pulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.5); }
    70% { transform: scale(1.1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* Tabs */
.tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    background: #e2e8f0;
    padding: 0.3rem;
    border-radius: 12px;
}

.tab {
    flex: 1;
    padding: 0.75rem;
    border-radius: 9px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
    text-decoration: none;
    color: var(--text-muted);
}

.tab.active {
    background: var(--card-bg);
    color: var(--text-main);
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
}

.tab:not(.active):hover {
    color: var(--text-main);
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.05), 0 1px 2px -1px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s ease;
}

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

.stat-value {
    color: var(--text-main);
    font-size: 1.85rem;
    font-weight: 800;
    margin-bottom: 0.25rem;
}

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

/* Search Bar */
.search-bar {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 0.85rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 2rem;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.05), 0 1px 2px -1px rgba(0, 0, 0, 0.05);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.search-bar:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.search-bar span {
    font-size: 1.1rem;
    color: var(--text-muted);
}

.search-bar input {
    background: transparent;
    border: none;
    outline: none;
    width: 100%;
    font-size: 0.95rem;
    color: var(--text-main);
    font-weight: 500;
}

.search-bar input::placeholder {
    color: var(--text-muted);
}

/* Leaderboard Column Header Row */
.leaderboard-header-row {
    display: grid;
    grid-template-columns: 2.2fr 1.2fr 1.2fr 1fr 1fr;
    gap: 1rem;
    padding: 0.75rem 1.5rem;
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
}

/* Leaderboard List */
.leaderboard-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.leaderboard-item {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 1.1rem 1.5rem;
    display: grid;
    grid-template-columns: 2.2fr 1.2fr 1.2fr 1fr 1fr;
    gap: 1rem;
    align-items: center;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.05), 0 1px 2px -1px rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
}

.leaderboard-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
    background: var(--card-hover-bg);
}

/* Special styling for top 3 left borders */
.leaderboard-item.rank-1 {
    border-left: 4px solid var(--gold);
}
.leaderboard-item.rank-2 {
    border-left: 4px solid var(--silver);
}
.leaderboard-item.rank-3 {
    border-left: 4px solid var(--bronze);
}

.affiliate-info-col {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.affiliate-name {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-main);
}

/* Badges and Medals */
.rank-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    font-size: 1.1rem;
}

.normal-rank {
    color: var(--text-muted);
    font-weight: 700;
    font-size: 0.9rem;
    width: 28px;
    text-align: center;
}

.hero-badge {
    background: #fef3c7;
    color: #b45309;
    border: 1px solid #fde68a;
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 0.5px;
}

.score-col {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-main);
}

.points-col {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--primary-color);
    text-align: right;
}

.hero-col {
    font-size: 0.85rem;
    font-weight: 700;
}

.action-col {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

/* Empty State */
.empty-state {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.95rem;
    padding: 4rem 2rem;
    background: var(--card-bg);
    border: 1px dashed var(--card-border);
    border-radius: 12px;
    margin-top: 1rem;
}

/* Admin Card Styles */
.admin-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 2.25rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    margin-top: 1rem;
}

.admin-card h2 {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--text-main);
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-control {
    width: 100%;
    padding: 0.85rem;
    background: #ffffff;
    border: 1px solid var(--card-border);
    border-radius: 8px;
    font-size: 0.95rem;
    color: var(--text-main);
    outline: none;
    transition: all 0.2s ease;
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

/* Checkbox Style */
.checkbox-container {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    cursor: pointer;
    user-select: none;
}

.checkbox-container input {
    width: 18px;
    height: 18px;
    accent-color: var(--primary-color);
    cursor: pointer;
}

.btn {
    padding: 0.85rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
    background: var(--primary-color);
    color: white;
    width: 100%;
    font-size: 0.95rem;
    transition: all 0.2s ease;
}

.btn:hover {
    background: #1d4ed8;
}

.btn-danger {
    background: #ef4444 !important;
}

.btn-danger:hover {
    background: #dc2626 !important;
}

/* Utilities */
.mt-4 { margin-top: 1.5rem; }
.mb-4 { margin-bottom: 1.5rem; }

@media (max-width: 768px) {
    .leaderboard-header-row {
        display: none;
    }
    
    .leaderboard-item {
        grid-template-columns: 1fr;
        gap: 0.5rem;
        padding: 1.25rem;
    }
    
    .affiliate-info-col {
        border-bottom: 1px solid var(--card-border);
        padding-bottom: 0.5rem;
        margin-bottom: 0.25rem;
    }
    
    .score-col {
        display: flex;
        justify-content: space-between;
        font-size: 0.85rem;
    }
    
    .score-col::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--text-muted);
    }
    
    .points-col {
        text-align: left;
        margin-top: 0.25rem;
        font-size: 1.25rem;
        border-top: 1px dashed var(--card-border);
        padding-top: 0.5rem;
        display: flex;
        justify-content: space-between;
    }
    
    .points-col::before {
        content: 'Total Poin';
        font-weight: 700;
        color: var(--text-muted);
        font-size: 0.95rem;
    }
}
