/* ============================================
   livecounts.nl - TikTok Realtime Counter
   Modern, Clean Design (Roblox-inspired)
   ============================================ */

:root {
    --tiktok-aqua: #00f2ea;
    --tiktok-pink: #ff0050;
    --tiktok-black: #010101;
    --tiktok-gradient: linear-gradient(135deg, #00f2ea 0%, #ff0050 100%);
    --bg-primary: #f4f5f7;
    --bg-card: #ffffff;
    --text-primary: #1a1a1a;
    --text-secondary: #606770;
    --text-muted: #8e8e8e;
    --border-color: #e4e6eb;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --transition: 0.2s ease;
}

* {
    box-sizing: border-box;
}

/* Utility class for screen reader only content */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

body {
    background-color: var(--bg-primary);
    font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: var(--text-primary);
    margin: 0;
    padding: 0;
    line-height: 1.5;
}

/* ============================================
   Header / Navigation Bar
   ============================================ */
.site-header {
    background: linear-gradient(135deg, var(--tiktok-black) 0%, #1a1a2e 100%);
    padding: 16px 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-md);
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.menu-toggle {
    background: rgba(255,255,255,0.1);
    border: none;
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    color: #fff;
    cursor: pointer;
    transition: var(--transition);
}

.menu-toggle:hover {
    background: rgba(255,255,255,0.2);
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #fff;
    text-decoration: none;
}

.header-brand img {
    width: 36px;
    height: 36px;
    border-radius: 8px;
}

.header-title {
    font-size: 20px;
    font-weight: 600;
    color: #fff !important;
    margin: 0;
    background: var(--tiktok-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-nav {
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: rgba(255,255,255,0.1);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: var(--transition);
}

.nav-btn:hover {
    background: rgba(255,255,255,0.2);
    color: #fff;
    text-decoration: none;
}

.nav-btn i {
    font-size: 14px;
}

.search-trigger {
    background: linear-gradient(135deg, rgba(0,242,234,0.2), rgba(255,0,80,0.2));
    border: 1px solid rgba(255,255,255,0.1);
}

.search-shortcut {
    background: rgba(255,255,255,0.15);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
    margin-left: 4px;
}

/* ============================================
   Sidebar
   ============================================ */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 280px;
    height: 100vh;
    background: var(--bg-card);
    box-shadow: var(--shadow-lg);
    z-index: 200;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.sidebar.open {
    transform: translateX(0);
}

.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 199;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 600;
}

.sidebar-brand img {
    width: 32px;
    height: 32px;
    border-radius: 8px;
}

.sidebar-close {
    background: none;
    border: none;
    font-size: 20px;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 0;
}

.sidebar-section {
    padding: 0 16px;
    margin-bottom: 24px;
}

.sidebar-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
    padding: 0 8px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    color: var(--text-primary);
    text-decoration: none;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.sidebar-link:hover {
    background: var(--bg-primary);
    color: var(--tiktok-pink);
    text-decoration: none;
}

.sidebar-link.active {
    background: linear-gradient(135deg, rgba(0,242,234,0.1), rgba(255,0,80,0.1));
    color: var(--tiktok-pink);
}

.sidebar-link i {
    width: 20px;
    text-align: center;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 12px;
    text-align: center;
}

/* ============================================
   Main Container
   ============================================ */
.main-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px 20px;
}

@media (max-width: 1024px) {
    .main-container {
        max-width: 900px;
    }
}

/* ============================================
   Profile Card - Main Counter
   ============================================ */
.profile-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 40px 24px;
    text-align: center;
    margin-bottom: 20px;
    position: relative;
    overflow: hidden;
}

.profile-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--tiktok-gradient);
}

.profile-pic-wrapper {
    position: relative;
    display: inline-block;
    margin-bottom: 16px;
}

.profile-pic-border {
    width: 128px;
    height: 128px;
    border-radius: 50%;
    padding: 4px;
    background: var(--tiktok-gradient);
}

.pfp {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid var(--bg-card);
    background: var(--bg-card);
}

.live-indicator {
    position: absolute;
    bottom: 8px;
    right: 8px;
    width: 16px;
    height: 16px;
    background: #22c55e;
    border-radius: 50%;
    border: 3px solid var(--bg-card);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.2); opacity: 0.8; }
}

.profile-pic-badge {
    position: absolute;
    bottom: 0;
    left: 0;
    background: var(--tiktok-black);
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 3px solid var(--bg-card);
}

.profile-pic-badge svg {
    width: 16px;
    height: 16px;
}

.title {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 8px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.verified-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: linear-gradient(135deg, rgba(0,242,234,0.1), rgba(255,0,80,0.1));
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    color: var(--tiktok-pink);
    margin-bottom: 8px;
}

.main-odo {
    font-size: clamp(48px, 12vw, 96px);
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.1;
    margin: 16px 0 8px 0;
    min-height: 1.2em;
    contain: layout style;
}

.follower-label {
    font-size: 16px;
    color: var(--text-secondary);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 0;
}

/* ============================================
   Stats Grid - CLS optimized
   ============================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 20px;
    contain: layout style;
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    padding: 16px 12px;
    text-align: center;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 90px;
    contain: layout style;
    overflow: hidden;
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.stat-card.hearts-card {
    border-top: 3px solid var(--tiktok-pink);
}

.stat-card.goal-card {
    border-top: 3px solid var(--tiktok-aqua);
}

.stat-card.video-card {
    border-top: 3px solid #a855f7;
}

.stat-card.following-card {
    border-top: 3px solid #22c55e;
}

.bottom-odo {
    font-size: clamp(18px, 3.5vw, 28px);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
    min-height: 1.2em;
    contain: layout style;
    word-break: break-all;
    max-width: 100%;
    overflow: hidden;
}

.stat-label {
    font-size: clamp(10px, 1.8vw, 13px);
    color: var(--text-secondary);
    font-weight: 500;
    margin: 0;
    white-space: nowrap;
}

/* ============================================
   Search Section
   ============================================ */
.search-section {
    margin-bottom: 20px;
}

.search-wrapper {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 20px;
    box-shadow: var(--shadow-sm);
}

.search-box {
    display: flex;
    gap: 12px;
}

.search-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 15px;
    transition: var(--transition);
    background: var(--bg-primary);
}

.search-input:focus {
    outline: none;
    border-color: var(--tiktok-aqua);
    box-shadow: 0 0 0 3px rgba(0,242,234,0.1);
}

.search-button {
    padding: 12px 24px;
    background: var(--tiktok-gradient);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
}

.search-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255,0,80,0.3);
}

.search-help {
    text-align: center;
    color: var(--text-secondary);
    font-size: 13px;
    margin-top: 12px;
    margin-bottom: 0;
}

.search-help kbd {
    background: var(--bg-primary);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
    border: 1px solid var(--border-color);
}

/* ============================================
   User Info Card
   ============================================ */
.user-info-card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    padding: 24px;
    margin-bottom: 20px;
}

.user-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.user-info-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-primary);
    border-radius: var(--radius-sm);
}

.user-info-item i {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--tiktok-gradient);
    color: #fff;
    border-radius: var(--radius-sm);
}

.user-info-content {
    flex: 1;
}

.user-info-label {
    display: block;
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 2px;
}

.user-info-value {
    font-weight: 600;
    color: var(--text-primary);
}

.user-description {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.user-description h4 {
    font-size: 14px;
    color: var(--text-secondary);
    margin: 0 0 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.user-description p {
    margin: 0;
    color: var(--text-primary);
    line-height: 1.6;
}

.user-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.user-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: var(--transition);
}

.user-action-btn:hover {
    background: var(--tiktok-gradient);
    color: #fff;
    border-color: transparent;
    text-decoration: none;
}

/* ============================================
   Chart
   ============================================ */
#chart {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    padding: 20px;
    margin-bottom: 20px;
    min-height: 300px;
}

/* ============================================
   Cards
   ============================================ */
.card {
    background: var(--bg-card);
    border: none;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    margin-bottom: 20px;
}

.card-body {
    padding: 24px;
}

.info-card h2 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 12px;
}

.info-card p {
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 16px;
}

.info-card p:last-child {
    margin-bottom: 0;
}

/* ============================================
   Popular Users Section
   ============================================ */
.popular-users-section h2 {
    font-size: 20px;
    font-weight: 600;
    margin: 0 0 8px;
}

.section-desc {
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.popular-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}

.popular-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-primary);
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: var(--text-primary);
    transition: var(--transition);
}

.popular-item:hover {
    background: linear-gradient(135deg, rgba(0,242,234,0.1), rgba(255,0,80,0.1));
    transform: translateY(-2px);
    text-decoration: none;
    color: var(--text-primary);
}

.popular-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
}

.popular-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.popular-info {
    flex: 1;
    min-width: 0;
}

.popular-name {
    display: block;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.popular-sub {
    display: block;
    font-size: 12px;
    color: var(--text-secondary);
}

/* ============================================
   Milestones Section
   ============================================ */
.milestones-section h2 {
    font-size: 20px;
    font-weight: 600;
    margin: 0 0 8px;
}

.milestone-list {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.milestone-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-primary);
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.milestone-item.achieved {
    background: linear-gradient(135deg, rgba(0,242,234,0.15), rgba(255,0,80,0.15));
}

.milestone-item.achieved .milestone-icon {
    background: var(--tiktok-gradient);
    color: #fff;
}

.milestone-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--border-color);
    border-radius: 50%;
    color: var(--text-muted);
}

.milestone-info {
    display: flex;
    flex-direction: column;
}

.milestone-value {
    font-weight: 700;
    font-size: 16px;
}

.milestone-label {
    font-size: 12px;
    color: var(--text-muted);
}

/* ============================================
   FAQ Section
   ============================================ */
.faq-section h2 {
    font-size: 20px;
    font-weight: 600;
    margin: 0 0 20px;
}

.faq-item {
    border-bottom: 1px solid var(--border-color);
    padding: 16px 0;
}

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

.faq-question {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    font-weight: 500;
    color: var(--text-primary);
}

.faq-question i {
    transition: transform 0.3s ease;
}

.faq-item.active .faq-question i {
    transform: rotate(180deg);
}

.faq-answer {
    display: none;
    padding-top: 12px;
    color: var(--text-secondary);
    line-height: 1.7;
}

.faq-item.active .faq-answer {
    display: block;
}

/* ============================================
   Sharing Section
   ============================================ */
.sharing-section {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    padding: 24px;
    margin-bottom: 20px;
}

.sharing-section h3 {
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sharing-section h3 i {
    color: var(--tiktok-pink);
}

.share-input-group {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.share-input-group input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 14px;
    background: var(--bg-primary);
}

.share-input-group button {
    padding: 10px 16px;
    background: var(--tiktok-gradient);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 500;
}

.embed-code {
    background: var(--bg-primary);
    padding: 16px;
    border-radius: var(--radius-sm);
    margin-top: 16px;
}

.embed-code h4 {
    font-size: 14px;
    margin: 0 0 8px;
    color: var(--text-secondary);
}

.embed-code pre {
    margin: 0;
    padding: 12px;
    background: var(--text-primary);
    color: #fff;
    border-radius: var(--radius-sm);
    font-size: 12px;
    overflow-x: auto;
}

/* ============================================
   Footer
   ============================================ */
.site-footer {
    background: var(--bg-card);
    border-top: 1px solid var(--border-color);
    padding: 24px 20px;
    text-align: center;
    color: var(--text-muted);
    font-size: 14px;
}

/* ============================================
   Search Modal
   ============================================ */
.search-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.6);
    z-index: 300;
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding: 80px 20px;
    backdrop-filter: blur(4px);
}

.search-modal-overlay.active {
    display: flex;
}

.search-modal {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 600px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.search-modal-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}

.search-modal-header i {
    color: var(--text-muted);
    font-size: 18px;
}

.search-modal-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 16px;
    padding: 4px 0;
    background: transparent;
}

.search-modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius-sm);
}

.search-modal-close:hover {
    background: var(--bg-primary);
    color: var(--text-primary);
}

.search-modal-results {
    max-height: 400px;
    overflow-y: auto;
}

.search-modal-empty {
    padding: 40px;
    text-align: center;
    color: var(--text-muted);
}

.search-modal-empty i {
    font-size: 32px;
    margin-bottom: 12px;
    opacity: 0.5;
}

.search-result-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    cursor: pointer;
    transition: var(--transition);
}

.search-result-item:hover {
    background: var(--bg-primary);
}

.search-result-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
}

.search-result-info {
    flex: 1;
}

.search-result-name {
    font-weight: 600;
    color: var(--text-primary);
}

.search-result-username {
    font-size: 13px;
    color: var(--text-muted);
}

/* ============================================
   Responsive Design
   ============================================ */
@media (max-width: 900px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .header-nav {
        gap: 4px;
    }
    
    .nav-btn {
        padding: 8px 12px;
    }
    
    .nav-btn-text {
        display: none;
    }
    
    .search-shortcut {
        display: none;
    }
    
    .search-box {
        flex-direction: column;
    }
    
    .popular-grid {
        grid-template-columns: 1fr;
    }
    
    .milestone-list {
        flex-direction: column;
    }
    
    .user-info-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .main-container {
        padding: 16px;
    }
    
    .profile-card {
        padding: 24px 16px;
    }
    
    .header-title {
        font-size: 16px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .stat-card {
        padding: 16px 12px;
        min-height: 80px;
    }
    
    .bottom-odo {
        font-size: clamp(18px, 5vw, 28px);
    }
}

/* ============================================
   Utility Classes
   ============================================ */
.d-none {
    display: none !important;
}

.d-flex {
    display: flex !important;
}

.justify-content-center {
    justify-content: center !important;
}

.text-center {
    text-align: center !important;
}

.mb-4 {
    margin-bottom: 1.5rem !important;
}

/* ============================================
   Chart Card & Statistics Table
   ============================================ */
.chart-card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    margin-bottom: 20px;
}

.chart-card .card-body {
    padding: 20px;
}

#chart {
    min-height: 350px;
    width: 100%;
}

.stats-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 12px;
}

.stats-tab {
    padding: 10px 20px;
    background: var(--bg-primary);
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
}

.stats-tab:hover {
    background: var(--tiktok-gradient);
    color: #fff;
}

.stats-tab.active {
    background: var(--tiktok-gradient);
    color: #fff;
}

.stats-tab-content {
    display: none;
}

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

.stats-table-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 12px;
}

.stats-table-info {
    font-size: 14px;
    color: var(--text-secondary);
}

.stats-table-info select {
    padding: 4px 8px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-primary);
    color: var(--text-primary);
    margin: 0 4px;
}

.stats-table-search {
    font-size: 14px;
    color: var(--text-secondary);
}

.stats-table-search input {
    padding: 6px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-primary);
    color: var(--text-primary);
    margin-left: 8px;
    width: 150px;
}

.table-responsive {
    overflow-x: auto;
}

.stats-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.stats-table th {
    background: var(--bg-primary);
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 2px solid var(--border-color);
    white-space: nowrap;
}

.stats-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

.stats-table tbody tr:hover {
    background: var(--bg-primary);
}

.stats-table .change-positive {
    color: #22c55e;
    font-size: 12px;
    margin-left: 8px;
    font-weight: 500;
}

.stats-table .change-negative {
    color: #ef4444;
    font-size: 12px;
    margin-left: 8px;
    font-weight: 500;
}

.stats-table .change-neutral {
    color: var(--text-muted);
    font-size: 12px;
    margin-left: 8px;
}

.stats-table-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 16px;
    flex-wrap: wrap;
    gap: 12px;
}

#table-info {
    font-size: 14px;
    color: var(--text-secondary);
}

.table-pagination {
    display: flex;
    gap: 4px;
}

.table-pagination button {
    padding: 6px 12px;
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 13px;
    transition: var(--transition);
}

.table-pagination button:hover {
    background: var(--tiktok-aqua);
    color: #fff;
    border-color: var(--tiktok-aqua);
}

.table-pagination button.active {
    background: var(--tiktok-aqua);
    color: #fff;
    border-color: var(--tiktok-aqua);
}

.table-pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Hide old elements */
body > ul,
.nav-title,
.nav-title2,
.link,
.link2 {
    display: none !important;
}

/* ============================================
   AI Analysis Section
   ============================================ */
.ai-analysis-card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    margin-bottom: 20px;
    border-left: 4px solid var(--tiktok-aqua);
}

.ai-analysis-card h2 {
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 8px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.ai-insights {
    margin-top: 16px;
}

.ai-loading {
    text-align: center;
    padding: 24px;
    color: var(--text-secondary);
}

.ai-loading i {
    color: var(--tiktok-aqua);
    margin-right: 8px;
}

.ai-insight-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
}

.ai-insight-item {
    background: var(--bg-primary);
    border-radius: var(--radius-sm);
    padding: 16px;
    border-left: 3px solid var(--tiktok-aqua);
}

.ai-insight-item.positive {
    border-left-color: #22c55e;
}

.ai-insight-item.negative {
    border-left-color: #ef4444;
}

.ai-insight-item.neutral {
    border-left-color: var(--tiktok-aqua);
}

.ai-insight-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.ai-insight-label i {
    font-size: 14px;
}

.ai-insight-value {
    font-size: 15px;
    color: var(--text-primary);
    line-height: 1.5;
}

.ai-disclaimer {
    margin-top: 16px;
    padding: 12px;
    background: rgba(0, 242, 234, 0.05);
    border-radius: var(--radius-sm);
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.ai-disclaimer i {
    color: var(--tiktok-aqua);
    margin-top: 2px;
}

/* ============================================
   Theme Toggle Button & Panel
   ============================================ */
.theme-toggle-btn {
    position: fixed;
    bottom: 70px;
    right: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--bg-card);
    border: none;
    box-shadow: var(--shadow-lg);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: var(--text-primary);
    z-index: 99;
    transition: var(--transition);
}

.theme-toggle-btn:hover {
    transform: scale(1.1);
    background: var(--tiktok-gradient);
    color: #fff;
}

.theme-panel {
    position: fixed;
    bottom: 130px;
    right: 20px;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 16px;
    box-shadow: var(--shadow-lg);
    z-index: 98;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: var(--transition);
}

.theme-panel.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.theme-panel-title {
    font-size: 14px;
    font-weight: 600;
    margin: 0 0 12px;
    color: var(--text-primary);
}

.theme-options {
    display: flex;
    gap: 10px;
}

.theme-option {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid transparent;
    transition: var(--transition);
}

.theme-option:hover {
    transform: scale(1.1);
}

.theme-option.active {
    border-color: var(--tiktok-aqua);
}

.theme-option[data-theme="light"] {
    background: linear-gradient(135deg, #f4f5f7 50%, #ffffff 50%);
    border: 3px solid #ddd;
}

.theme-option[data-theme="dark"] {
    background: linear-gradient(135deg, #0f0f0f 50%, #1a1a1a 50%);
}

.theme-option[data-theme="rgb-light"] {
    background: linear-gradient(135deg, #00f2ea, #ff0050, #00f2ea);
    background-size: 200% 200%;
    animation: rgb-gradient 2s ease infinite;
}

.theme-option[data-theme="rgb-dark"] {
    background: linear-gradient(135deg, #00f2ea, #ff0050, #00f2ea);
    background-size: 200% 200%;
    animation: rgb-gradient 2s ease infinite;
    box-shadow: inset 0 0 0 12px rgba(0,0,0,0.6);
}

.theme-option.active[data-theme="light"] {
    border-color: var(--tiktok-pink);
}

@keyframes rgb-gradient {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* ============================================
   Dark Mode Theme
   ============================================ */
body.theme-dark {
    --bg-primary: #0f0f0f;
    --bg-card: #1a1a1a;
    --text-primary: #ffffff;
    --text-secondary: #a0a0a0;
    --text-muted: #666666;
    --border-color: #2d2d2d;
}

body.theme-dark .site-header {
    background: linear-gradient(135deg, #1a1a1a 0%, #0f0f0f 100%);
    border-bottom: 1px solid var(--tiktok-aqua);
}

body.theme-dark .sidebar {
    background: linear-gradient(180deg, #1a1a1a 0%, #0f0f0f 100%);
}

body.theme-dark .sidebar-header {
    background: #1a1a1a;
    border-bottom-color: var(--tiktok-aqua);
}

body.theme-dark .profile-pic-border {
    background: linear-gradient(135deg, var(--tiktok-aqua) 0%, var(--tiktok-pink) 50%, var(--tiktok-aqua) 100%);
}

body.theme-dark .main-odo,
body.theme-dark .bottom-odo,
body.theme-dark .odometer {
    color: #fff !important;
}

body.theme-dark #chart {
    background: var(--bg-card);
}

body.theme-dark .highcharts-background {
    fill: var(--bg-card);
}

body.theme-dark .highcharts-title,
body.theme-dark .highcharts-axis-labels text {
    fill: var(--text-primary) !important;
}

body.theme-dark .card,
body.theme-dark .profile-card,
body.theme-dark .stat-card {
    background: var(--bg-card);
    border-color: var(--border-color);
}

body.theme-dark .share-input-group input,
body.theme-dark .search-box input {
    background: var(--bg-primary);
    border-color: var(--border-color);
    color: var(--text-primary);
}

body.theme-dark .search-modal-content {
    background: var(--bg-card);
    border-color: var(--border-color);
}

body.theme-dark .search-modal-input {
    background: var(--bg-primary);
    border-color: var(--border-color);
    color: var(--text-primary);
}

body.theme-dark .search-result-item:hover {
    background: var(--bg-primary);
}

body.theme-dark .site-footer {
    background: var(--bg-card);
}

body.theme-dark .stats-table th {
    background: var(--bg-primary);
}

body.theme-dark .stats-table td {
    border-color: var(--border-color);
}

body.theme-dark .stats-table tbody tr:hover {
    background: rgba(255,255,255,0.05);
}

body.theme-dark .stats-table-info select,
body.theme-dark .stats-table-search input {
    background: var(--bg-primary);
    border-color: var(--border-color);
    color: var(--text-primary);
}

body.theme-dark .table-pagination button {
    background: var(--bg-primary);
    border-color: var(--border-color);
    color: var(--text-primary);
}

body.theme-dark .stats-tab {
    background: var(--bg-primary);
    color: var(--text-secondary);
}

body.theme-dark .ai-insight-item {
    background: var(--bg-primary);
}

body.theme-dark .ai-disclaimer {
    background: rgba(0, 242, 234, 0.1);
}

/* ============================================
   RGB Light Mode
   ============================================ */
body.theme-rgb-light {
    --bg-primary: #f4f5f7;
    --bg-card: #ffffff;
}

body.theme-rgb-light .main-odo,
body.theme-rgb-light .main-odo .odometer-digit,
body.theme-rgb-light .main-odo .odometer-value {
    background: linear-gradient(135deg, #00f2ea, #ff0050, #00f2ea) !important;
    background-size: 400% 400% !important;
    -webkit-background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
    background-clip: text !important;
    animation: rgb-gradient 3s ease infinite !important;
}

body.theme-rgb-light .profile-pic-border {
    background: linear-gradient(135deg, #00f2ea, #ff0050, #00f2ea);
    background-size: 400% 400%;
    animation: rgb-gradient 3s ease infinite;
}

body.theme-rgb-light .site-header {
    background: linear-gradient(135deg, #00f2ea, #ff0050, #00f2ea);
    background-size: 400% 400%;
    animation: rgb-gradient 3s ease infinite;
}

body.theme-rgb-light .site-header .header-title,
body.theme-rgb-light .site-header .search-shortcut {
    color: #fff;
}

/* Ensure bottom stats stay visible in RGB light */
body.theme-rgb-light .bottom-odo,
body.theme-rgb-light .stat-card .odometer {
    color: var(--text-primary) !important;
    -webkit-text-fill-color: var(--text-primary) !important;
}

/* ============================================
   RGB Dark Mode
   ============================================ */
body.theme-rgb-dark {
    --bg-primary: #0f0f0f;
    --bg-card: #1a1a1a;
    --text-primary: #ffffff;
    --text-secondary: #a0a0a0;
    --text-muted: #666666;
    --border-color: #2d2d2d;
}

body.theme-rgb-dark .main-odo,
body.theme-rgb-dark .main-odo .odometer-digit,
body.theme-rgb-dark .main-odo .odometer-value {
    background: linear-gradient(135deg, #00f2ea, #ff0050, #00f2ea) !important;
    background-size: 400% 400% !important;
    -webkit-background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
    background-clip: text !important;
    animation: rgb-gradient 3s ease infinite !important;
}

body.theme-rgb-dark .profile-pic-border {
    background: linear-gradient(135deg, #00f2ea, #ff0050, #00f2ea);
    background-size: 400% 400%;
    animation: rgb-gradient 3s ease infinite;
}

body.theme-rgb-dark .site-header {
    background: linear-gradient(135deg, #1a1a1a 0%, #0f0f0f 100%);
    border-bottom: 2px solid transparent;
    border-image: linear-gradient(90deg, #00f2ea, #ff0050, #00f2ea) 1;
}

body.theme-rgb-dark .sidebar {
    background: linear-gradient(180deg, #1a1a1a 0%, #0f0f0f 100%);
}

body.theme-rgb-dark .sidebar-header {
    background: #1a1a1a;
    border-bottom: 2px solid transparent;
    border-image: linear-gradient(90deg, #00f2ea, #ff0050) 1;
}

body.theme-rgb-dark #chart {
    background: var(--bg-card);
}

body.theme-rgb-dark .highcharts-background {
    fill: var(--bg-card);
}

body.theme-rgb-dark .card,
body.theme-rgb-dark .profile-card,
body.theme-rgb-dark .stat-card {
    background: var(--bg-card);
    border-color: var(--border-color);
}

body.theme-rgb-dark .share-input-group input,
body.theme-rgb-dark .search-box input {
    background: var(--bg-primary);
    border-color: var(--border-color);
    color: var(--text-primary);
}

body.theme-rgb-dark .search-modal-content {
    background: var(--bg-card);
    border-color: var(--border-color);
}

body.theme-rgb-dark .search-modal-input {
    background: var(--bg-primary);
    border-color: var(--border-color);
    color: var(--text-primary);
}

body.theme-rgb-dark .site-footer {
    background: var(--bg-card);
}

body.theme-rgb-dark .ai-insight-item {
    background: var(--bg-primary);
}

body.theme-rgb-dark .ai-disclaimer {
    background: rgba(0, 242, 234, 0.1);
}

body.theme-rgb-dark .stats-table th {
    background: var(--bg-primary);
}

body.theme-rgb-dark .stats-table td {
    border-color: var(--border-color);
}

body.theme-rgb-dark .stats-table tbody tr:hover {
    background: rgba(255,255,255,0.05);
}

body.theme-rgb-dark .stats-table-info select,
body.theme-rgb-dark .stats-table-search input {
    background: var(--bg-primary);
    border-color: var(--border-color);
    color: var(--text-primary);
}

body.theme-rgb-dark .table-pagination button {
    background: var(--bg-primary);
    border-color: var(--border-color);
    color: var(--text-primary);
}

body.theme-rgb-dark .stats-tab {
    background: var(--bg-primary);
    color: var(--text-secondary);
}

/* Ensure bottom stats stay visible in RGB dark */
body.theme-rgb-dark .bottom-odo,
body.theme-rgb-dark .stat-card .odometer {
    color: #fff !important;
    -webkit-text-fill-color: #fff !important;
}
