/* =====================================================
   VRChat Group Tracker - Main Stylesheet
   Modern, clean design with dark theme
   ===================================================== */

/* ===== CSS Variables ===== */
:root {
    /* Primary Colors - VRChat inspired */
    --primary: #1DB8AB;
    --primary-hover: #18a89c;
    --primary-light: rgba(29, 184, 171, 0.1);
    
    /* Accent Colors */
    --accent-blue: #3B82F6;
    --accent-purple: #8B5CF6;
    --accent-pink: #EC4899;
    --accent-orange: #F97316;
    
    /* Background Colors */
    --bg-primary: #0F0F14;
    --bg-secondary: #16161D;
    --bg-tertiary: #1E1E28;
    --bg-card: #1A1A24;
    --bg-hover: #252532;
    
    /* Text Colors */
    --text-primary: #FFFFFF;
    --text-secondary: #A0A0B0;
    --text-muted: #6B6B7B;
    --text-inverse: #0F0F14;
    
    /* Border Colors */
    --border-color: #2A2A38;
    --border-light: #3A3A48;
    
    /* Status Colors */
    --success: #10B981;
    --success-light: rgba(16, 185, 129, 0.1);
    --warning: #F59E0B;
    --warning-light: rgba(245, 158, 11, 0.1);
    --danger: #EF4444;
    --danger-light: rgba(239, 68, 68, 0.1);
    --info: #3B82F6;
    --info-light: rgba(59, 130, 246, 0.1);
    
    /* Spacing */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --spacing-2xl: 3rem;
    
    /* Border Radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-full: 9999px;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.3);
    --shadow-glow: 0 0 20px rgba(29, 184, 171, 0.3);
    
    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
    --transition-slow: 350ms ease;
    
    /* Layout */
    --sidebar-width: 260px;
    --header-height: 64px;
    --content-max-width: 1600px;
}

/* ===== Reset & Base ===== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--primary-hover);
}

img {
    max-width: 100%;
    height: auto;
}

/* ===== Typography ===== */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.3;
    color: var(--text-primary);
}

h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.125rem; }
h5 { font-size: 1rem; }
h6 { font-size: 0.875rem; }

.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }
.text-info { color: var(--info); }
.text-primary-color { color: var(--primary); }

.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }

/* ===== Layout ===== */
.app-container {
    display: flex;
    min-height: 100vh;
}

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    /* Prevent horizontal overflow from content that uses 100vw or similar */
    max-width: calc(100vw - var(--sidebar-width));
    overflow-x: hidden;
}

.page-content {
    flex: 1;
    padding: var(--spacing-xl);
    max-width: var(--content-max-width);
    margin: 0 auto;
    width: 100%;
}

/* ===== Sidebar ===== */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: var(--sidebar-width);
    height: 100vh;
    height: 100dvh; /* Dynamic viewport height for mobile browsers */
    background-color: #16161D; /* Fallback for iOS Safari */
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    z-index: 100;
    /* Prevent iOS Safari background issues */
    -webkit-overflow-scrolling: touch;
}

.sidebar-header {
    padding: var(--spacing-lg);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar-toggle-btn {
    width: 32px;
    height: 32px;
    padding: 0;
    background: #10B981 !important;
    border: none !important;
    border-radius: var(--radius-md);
    color: white !important;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sidebar-toggle-btn:hover {
    background: #059669 !important;
}

.sidebar-toggle-btn svg {
    flex-shrink: 0;
}

/* Floating sidebar expand button - doesn't affect page layout */
.sidebar-expand-btn {
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 200;
    width: 44px;
    height: 44px;
    padding: 0;
    background: rgba(22, 22, 29, 0.95) !important;
    border: 1px solid var(--primary) !important;
    border-radius: var(--radius-lg);
    color: var(--primary) !important;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(8px);
    box-shadow: 
        0 4px 12px rgba(0, 0, 0, 0.4),
        0 0 15px rgba(29, 184, 171, 0.3),
        0 0 30px rgba(29, 184, 171, 0.15);
    transition: all var(--transition-fast);
    animation: expandBtnPulse 2.5s ease-in-out infinite;
}

/* Pulsing glow animation for discoverability */
@keyframes expandBtnPulse {
    0%, 100% {
        box-shadow: 
            0 4px 12px rgba(0, 0, 0, 0.4),
            0 0 15px rgba(29, 184, 171, 0.3),
            0 0 30px rgba(29, 184, 171, 0.15);
        border-color: var(--primary);
    }
    50% {
        box-shadow: 
            0 4px 12px rgba(0, 0, 0, 0.4),
            0 0 20px rgba(29, 184, 171, 0.5),
            0 0 40px rgba(29, 184, 171, 0.25),
            0 0 60px rgba(29, 184, 171, 0.1);
        border-color: rgba(29, 184, 171, 0.8);
    }
}

.sidebar-expand-btn:hover {
    background: rgba(37, 37, 50, 0.98) !important;
    transform: scale(1.08);
    box-shadow: 
        0 6px 16px rgba(0, 0, 0, 0.5),
        0 0 25px rgba(29, 184, 171, 0.5),
        0 0 50px rgba(29, 184, 171, 0.3);
    animation: none; /* Stop pulse on hover for cleaner interaction */
}

.sidebar-expand-btn:active {
    transform: scale(0.95);
}

.sidebar-expand-btn svg {
    flex-shrink: 0;
    color: var(--primary);
    width: 22px;
    height: 22px;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.sidebar-logo-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.sidebar-nav {
    flex: 1;
    padding: var(--spacing-md);
    overflow-y: auto;
}

.nav-section {
    margin-bottom: var(--spacing-lg);
}

.nav-section-title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    padding: var(--spacing-sm) var(--spacing-md);
    margin-bottom: var(--spacing-xs);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    transition: all var(--transition-fast);
    margin-bottom: 2px;
}

.nav-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--primary-light);
    color: var(--primary);
}

.nav-item-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

/* Live Activity nav item with pulsing dot */
.nav-item--live {
    position: relative;
}

.nav-live-dot {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.nav-live-dot::before {
    content: '';
    width: 8px;
    height: 8px;
    background: #30D158;
    border-radius: 50%;
    animation: pulse-nav-dot 2s ease-in-out infinite;
}

@keyframes pulse-nav-dot {
    0%, 100% { 
        opacity: 1;
        box-shadow: 0 0 4px #30D158;
    }
    50% { 
        opacity: 0.6;
        box-shadow: 0 0 8px #30D158;
    }
}

.sidebar-footer {
    padding: var(--spacing-md);
    border-top: 1px solid var(--border-color);
}

.sidebar-legal-links {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    margin-top: var(--spacing-sm);
    font-size: 0.7rem;
}

.sidebar-legal-links a {
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.2s ease;
}

.sidebar-legal-links a:hover,
.sidebar-legal-links a.active {
    color: var(--primary);
}

.sidebar-legal-links .separator {
    color: var(--text-muted);
    opacity: 0.5;
}

.sidebar-support-link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: var(--spacing-sm);
    padding: 0.5rem 0.75rem;
    background: rgba(var(--primary-rgb), 0.1);
    border: 1px solid rgba(var(--primary-rgb), 0.2);
    border-radius: var(--radius-sm);
    color: var(--primary);
    font-size: 0.75rem;
    text-decoration: none;
    transition: all 0.2s ease;
}

.sidebar-support-link:hover {
    background: rgba(var(--primary-rgb), 0.2);
    border-color: var(--primary);
}

.sidebar-support-link i {
    font-size: 0.875rem;
}

.sidebar-disclaimer {
    padding: var(--spacing-md);
    font-size: 0.5rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border-color);
    text-align: center;
}

.sidebar-disclaimer p {
    margin: 0;
    line-height: 1.4;
}

.sidebar-credit {
    margin-top: 0.25rem !important;
}

.sidebar-credit a {
    color: var(--text-secondary);
    text-decoration: none;
}

.sidebar-credit a:hover {
    color: var(--primary);
}

/* ===== Header ===== */
.page-header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: var(--spacing-lg) var(--spacing-xl);
    position: sticky;
    top: 0;
    z-index: 50;
}

.page-header-content {
    max-width: var(--content-max-width);
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--spacing-lg);
}

.page-header-title-group {
    text-align: left;
}

.page-title {
    font-size: 1.5rem;
    font-weight: 600;
}

.page-subtitle {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-top: var(--spacing-xs);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

/* ===== Cards ===== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.card-header {
    padding: var(--spacing-md) var(--spacing-lg);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-title {
    font-size: 1rem;
    font-weight: 600;
}

.card-body {
    padding: var(--spacing-lg);
}

.card-footer {
    padding: var(--spacing-md) var(--spacing-lg);
    border-top: 1px solid var(--border-color);
    background: var(--bg-tertiary);
}

/* Stat Cards */
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    transition: all var(--transition-normal);
}

.stat-card:hover {
    border-color: var(--border-light);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--spacing-sm);
}

.stat-card-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.stat-card-icon.primary { background: var(--primary-light); color: var(--primary); }
.stat-card-icon.success { background: var(--success-light); color: var(--success); }
.stat-card-icon.warning { background: var(--warning-light); color: var(--warning); }
.stat-card-icon.danger { background: var(--danger-light); color: var(--danger); }
.stat-card-icon.info { background: var(--info-light); color: var(--info); }

.stat-card-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.stat-card-value {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.2;
}

.stat-card-change {
    font-size: 0.75rem;
    margin-top: var(--spacing-xs);
}

.stat-card-change.positive { color: var(--success); }
.stat-card-change.negative { color: var(--danger); }

/* ===== Stats Grid ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: var(--spacing-lg);
}

/* ===== Grid System ===== */
.grid {
    display: grid;
    gap: var(--spacing-lg);
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 1200px) {
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
    .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing-md);
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
}

.btn-primary {
    background: var(--primary);
    color: var(--text-inverse);
}

.btn-primary:hover {
    background: var(--primary-hover);
    color: var(--text-inverse);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg-hover);
    border-color: var(--border-light);
}

.btn-danger {
    background: var(--danger);
    color: white;
    border: 1px solid var(--danger);
}

.btn-danger:hover:not(:disabled) {
    background: #dc2626;
    border-color: #dc2626;
}

.btn-danger:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}

.btn-ghost:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.btn-sm {
    padding: var(--spacing-xs) var(--spacing-sm);
    font-size: 0.75rem;
}

.btn-lg {
    padding: var(--spacing-md) var(--spacing-lg);
    font-size: 1rem;
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
}

/* ===== Form Elements ===== */
.form-group {
    margin-bottom: var(--spacing-md);
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-xs);
}

.form-input,
.form-select {
    width: 100%;
    padding: var(--spacing-sm) var(--spacing-md);
    font-size: 0.875rem;
    color: var(--text-primary);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.form-input:focus,
.form-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.form-input::placeholder {
    color: var(--text-muted);
}

.search-input-wrapper {
    position: relative;
}

.search-input-wrapper .search-icon {
    position: absolute;
    left: var(--spacing-md);
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

.search-input-wrapper .form-input {
    padding-left: 2.5rem;
}

/* ===== Tables ===== */
.table-container {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: var(--spacing-md);
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.table th {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    background: var(--bg-tertiary);
}

.table tbody tr {
    transition: background var(--transition-fast);
}

.table tbody tr:hover {
    background: var(--bg-hover);
}

.table-clickable tbody tr {
    cursor: pointer;
}

/* ===== Badges ===== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: var(--spacing-xs) var(--spacing-sm);
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: var(--radius-full);
}

.badge-primary {
    background: var(--primary-light);
    color: var(--primary);
}

.badge-success {
    background: var(--success-light);
    color: var(--success);
}

.badge-warning {
    background: var(--warning-light);
    color: var(--warning);
}

.badge-danger {
    background: var(--danger-light);
    color: var(--danger);
}

.badge-info {
    background: var(--info-light);
    color: var(--info);
}

.badge-neutral {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

/* ===== Status Indicators ===== */
.status-dot {
    width: 8px;
    height: 8px;
    border-radius: var(--radius-full);
    display: inline-block;
}

.status-dot.online { background: var(--success); }
.status-dot.offline { background: var(--text-muted); }
.status-dot.warning { background: var(--warning); }
.status-dot.error { background: var(--danger); }

.status-indicator {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-xs);
}

.status-indicator .status-dot {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ===== Group Items ===== */
.group-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-md);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    transition: all var(--transition-fast);
}

.group-item:hover {
    border-color: var(--border-light);
    background: var(--bg-hover);
}

.group-item-logo {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    object-fit: cover;
    background: var(--bg-tertiary);
    flex-shrink: 0;
}

.group-item-info {
    flex: 1;
    min-width: 0;
}

.group-item-name {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.group-item-stats {
    display: flex;
    gap: var(--spacing-md);
    margin-top: var(--spacing-xs);
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.group-item-stat {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
}

/* ===== Charts ===== */
.chart-container {
    position: relative;
    height: 300px;
    width: 100%;
}

.chart-container.small {
    height: 200px;
}

.chart-container.large {
    height: 400px;
}

/* ===== Loading States ===== */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-2xl);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.skeleton {
    background: linear-gradient(90deg, var(--bg-tertiary) 25%, var(--bg-hover) 50%, var(--bg-tertiary) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-sm);
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ===== Empty States ===== */
.empty-state {
    text-align: center;
    padding: var(--spacing-2xl);
}

.empty-state-icon {
    font-size: 3rem;
    color: var(--text-muted);
    margin-bottom: var(--spacing-md);
}

.empty-state-title {
    font-size: 1.25rem;
    margin-bottom: var(--spacing-sm);
}

.empty-state-text {
    color: var(--text-secondary);
    max-width: 400px;
    margin: 0 auto;
}

/* ===== Pagination ===== */
.pagination {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    justify-content: center;
}

.pagination-btn {
    min-width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    color: var(--text-secondary);
    background: transparent;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.pagination-btn:hover:not(:disabled) {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.pagination-btn.active {
    background: var(--primary);
    color: var(--text-inverse);
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination-ellipsis {
    color: var(--text-muted);
    padding: 0 var(--spacing-sm);
}

/* ===== Tabs ===== */
.tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    gap: var(--spacing-xs);
}

.tab {
    padding: var(--spacing-sm) var(--spacing-md);
    font-size: 0.875rem;
    color: var(--text-secondary);
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: all var(--transition-fast);
    background: none;
    border-left: none;
    border-right: none;
    border-top: none;
}

.tab:hover {
    color: var(--text-primary);
}

.tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* ===== Tooltips ===== */
[data-tooltip] {
    position: relative;
}

[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: var(--spacing-xs) var(--spacing-sm);
    font-size: 0.75rem;
    color: var(--text-primary);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-fast);
    z-index: 100;
}

[data-tooltip]:hover::after {
    opacity: 1;
    visibility: visible;
}

/* ===== Progress Bar ===== */
.progress {
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: var(--primary);
    border-radius: var(--radius-full);
    transition: width var(--transition-normal);
}

.progress-bar.success { background: var(--success); }
.progress-bar.warning { background: var(--warning); }
.progress-bar.danger { background: var(--danger); }

/* ===== Alerts ===== */
.alert {
    padding: var(--spacing-md);
    border-radius: var(--radius-md);
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-sm);
}

.alert-success {
    background: var(--success-light);
    border: 1px solid var(--success);
    color: var(--success);
}

.alert-warning {
    background: var(--warning-light);
    border: 1px solid var(--warning);
    color: var(--warning);
}

.alert-danger {
    background: var(--danger-light);
    border: 1px solid var(--danger);
    color: var(--danger);
}

.alert-info {
    background: var(--info-light);
    border: 1px solid var(--info);
    color: var(--info);
}

/* ===== Utility Classes ===== */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-sm { gap: var(--spacing-sm); }
.gap-md { gap: var(--spacing-md); }
.gap-lg { gap: var(--spacing-lg); }

.mt-sm { margin-top: var(--spacing-sm); }
.mt-md { margin-top: var(--spacing-md); }
.mt-lg { margin-top: var(--spacing-lg); }
.mb-sm { margin-bottom: var(--spacing-sm); }
.mb-md { margin-bottom: var(--spacing-md); }
.mb-lg { margin-bottom: var(--spacing-lg); }

.p-sm { padding: var(--spacing-sm); }
.p-md { padding: var(--spacing-md); }
.p-lg { padding: var(--spacing-lg); }

.w-full { width: 100%; }
.h-full { height: 100%; }

.hidden { display: none; }
.truncate {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ===== Responsive ===== */

/* Desktop: Sidebar can be collapsed */
.sidebar {
    transition: transform var(--transition-normal);
}

.sidebar:not(.open) {
    transform: translateX(-100%);
}

.sidebar.open {
    transform: translateX(0);
}

/* Adjust main content when sidebar is collapsed */
.main-content {
    transition: margin-left var(--transition-normal), max-width var(--transition-normal);
}

body:has(.sidebar:not(.open)) .main-content {
    margin-left: 0;
    max-width: 100vw;
}

/* When sidebar is collapsed, add left padding to page titles to avoid overlap with floating menu button */
/* This uses multiple selectors to catch all page header variations */
body:has(.sidebar:not(.open)) .page-header-title-group:first-child,
body:has(.sidebar:not(.open)) .page-header-content > .page-header-title-group,
body:has(.sidebar:not(.open)) .page-header > .page-header-title-group,
body:has(.sidebar:not(.open)) .live-activity-header__title {
    padding-left: 56px;
}

@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform var(--transition-normal);
        /* Ensure dark background on mobile */
        background: var(--bg-secondary);
        -webkit-backdrop-filter: none;
        backdrop-filter: none;
    }
    
    .sidebar.open {
        transform: translateX(0);
        /* Add overlay shadow when open */
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.5);
    }
    
    .main-content {
        margin-left: 0;
        max-width: 100vw;
    }
    
    /* On mobile, sidebar is hidden by default - add padding to all titles */
    .page-header-title-group:first-child,
    .page-header-content > .page-header-title-group,
    .page-header > .page-header-title-group,
    .live-activity-header__title {
        padding-left: 56px;
    }
    
    /* Reset padding when sidebar is open on mobile */
    body:has(.sidebar.open) .page-header-title-group,
    body:has(.sidebar.open) .live-activity-header__title {
        padding-left: 0;
    }
    
    /* Hide expand button when sidebar is open on mobile */
    .sidebar.open ~ .sidebar-expand-btn {
        display: none !important;
    }
    
    .mobile-menu-btn {
        display: flex;
        background: var(--accent) !important;
        border: 1px solid var(--accent) !important;
        color: white !important;
    }
}

/* Dark overlay behind sidebar on mobile */
@media (max-width: 1024px) {
    body::before {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0);
        z-index: 99;
        pointer-events: none;
        transition: background var(--transition-normal);
    }
    
    body:has(.sidebar.open)::before {
        background: rgba(0, 0, 0, 0.5);
        pointer-events: auto;
    }
}

@media (max-width: 768px) {
    :root {
        --spacing-xl: 1.5rem;
        --spacing-2xl: 2rem;
    }
    
    h1 { font-size: 1.5rem; }
    h2 { font-size: 1.25rem; }
    
    .page-content {
        padding: var(--spacing-md);
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .header-actions {
        display: none;
    }
}

/* ===== Print Styles ===== */
@media print {
    .sidebar,
    .header-actions {
        display: none;
    }
    
    .main-content {
        margin-left: 0;
    }
}

/* =====================================================
   Instance Rewind - Live Dashboard Styles
   ===================================================== */

/* Rewind Page Layout */
.rewind-page {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
    padding: var(--spacing-lg);
    max-width: 100%;
}

.rewind-header .page-header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--spacing-md);
}

/* Live Indicator */
.live-indicator {
    animation: pulse-live 2s infinite;
    margin-right: var(--spacing-sm);
}

@keyframes pulse-live {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Auto-refresh indicator */
.auto-refresh-indicator {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing-md);
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.refresh-dot {
    width: 8px;
    height: 8px;
    background: var(--success);
    border-radius: 50%;
    animation: pulse-dot 1s infinite;
}

.refresh-dot.paused {
    background: var(--warning);
    animation: none;
}

@keyframes pulse-dot {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.2); opacity: 0.7; }
}

/* Stats Bar */
.rewind-stats-bar {
    display: flex;
    gap: var(--spacing-lg);
    padding: var(--spacing-md) var(--spacing-lg);
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
}

.rewind-stat {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.rewind-stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
}

.rewind-stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Controls Row */
.rewind-controls {
    display: flex;
    gap: var(--spacing-xl);
    padding: var(--spacing-md) var(--spacing-lg);
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    align-items: flex-end;
    flex-wrap: wrap;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.control-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-group {
    display: flex;
    gap: 2px;
    background: var(--bg-tertiary);
    padding: 2px;
    border-radius: var(--radius-md);
}

.btn-group .btn {
    background: transparent;
    border: none;
    padding: var(--spacing-xs) var(--spacing-sm);
    font-size: 0.8rem;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.btn-group .btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.btn-group .btn.active {
    background: var(--primary);
    color: var(--text-primary);
}

/* Size Legend */
.size-legend {
    display: flex;
    gap: var(--spacing-md);
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.legend-color {
    width: 12px;
    height: 3px;
    border-radius: 2px;
}

.legend-color.heat-glow {
    background: linear-gradient(90deg, #EF4444, #F97316);
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.6);
    animation: heat-pulse 1s infinite;
}

@keyframes heat-pulse {
    0%, 100% { box-shadow: 0 0 8px rgba(239, 68, 68, 0.6); }
    50% { box-shadow: 0 0 16px rgba(239, 68, 68, 0.9); }
}

.heat-legend {
    color: var(--danger);
    font-weight: 600;
}

/* Custom Date Picker */
.custom-date-picker {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    margin-top: var(--spacing-sm);
}

.custom-date-picker .form-input {
    padding: var(--spacing-xs) var(--spacing-sm);
    font-size: 0.8rem;
}

/* Filters Row */
.rewind-filters {
    display: flex;
    gap: var(--spacing-lg);
    padding: var(--spacing-md) var(--spacing-lg);
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    align-items: flex-end;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    min-width: 150px;
}

.filter-label {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.filter-label i {
    font-size: 0.875rem;
}

.filter-select-wrapper {
    display: flex;
    gap: var(--spacing-xs);
    align-items: center;
}

.filter-select {
    min-width: 180px;
    max-width: 250px;
}

/* Main Content Area */
.rewind-main {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: var(--spacing-lg);
    min-height: 500px;
}

/* Charts Container (left side with both charts stacked) */
.rewind-charts {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
}

/* Individual Chart Section */
.chart-section {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.chart-section-header {
    padding: var(--spacing-md) var(--spacing-lg);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chart-title {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
}

.chart-subtitle {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Bubble Chart Container */
.bubble-chart-container {
    position: relative;
    padding: var(--spacing-md);
}

.bubble-wrapper {
    height: 280px;
}

/* Chart Container */
.rewind-chart-container {
    position: relative;
    padding: var(--spacing-lg);
}

.line-wrapper {
    height: 700px;
}

.chart-wrapper {
    position: relative;
}

.chart-wrapper canvas {
    width: 100% !important;
    height: 100% !important;
}

/* Fullscreen Chart Mode */
.chart-section.fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    border-radius: 0;
    background: var(--bg-primary);
    display: flex;
    flex-direction: column;
}

.chart-section.fullscreen .chart-section-header {
    flex-shrink: 0;
}

.chart-section.fullscreen .rewind-chart-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding-bottom: var(--spacing-lg);
}

.chart-section.fullscreen .line-wrapper {
    flex: 1;
    height: auto;
}

.chart-section.fullscreen #btn-fullscreen-chart i {
    transform: rotate(45deg);
}

/* Fullscreen overlay backdrop */
.fullscreen-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 9998;
}

.chart-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-md);
    background: var(--bg-card);
    color: var(--text-secondary);
    z-index: 10;
}

.chart-loading.hidden {
    display: none;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Capacity Line Label */
.capacity-label {
    position: absolute;
    right: var(--spacing-lg);
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.7rem;
    color: var(--text-muted);
    background: var(--bg-card);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    opacity: 0.7;
}

/* Right Sidebar */
.rewind-sidebar {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.sidebar-section {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    padding: var(--spacing-md);
}

.sidebar-title {
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: var(--spacing-sm);
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.sidebar-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-style: italic;
}

/* Pinned Instance Card */
.pinned-instance {
    margin-top: var(--spacing-sm);
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.pinned-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-sm) var(--spacing-md);
    background: var(--bg-hover);
}

.pinned-status {
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: var(--radius-full);
}

.pinned-status.active {
    background: var(--success-light);
    color: var(--success);
}

.pinned-status.closed {
    background: var(--danger-light);
    color: var(--danger);
}

.pinned-body {
    padding: var(--spacing-md);
}

.pinned-group-name {
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 2px;
}

.pinned-world-name {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-md);
}

.pinned-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-md);
}

.pinned-stat {
    text-align: center;
    padding: var(--spacing-sm);
    background: var(--bg-card);
    border-radius: var(--radius-sm);
}

.pinned-stat-value {
    display: block;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
}

.pinned-stat-label {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.pinned-meta {
    font-size: 0.8rem;
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.pinned-meta strong {
    color: var(--text-muted);
}

/* Group Leaderboard */
.group-leaderboard {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

.leaderboard-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm);
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    transition: background var(--transition-fast);
}

.leaderboard-item:hover {
    background: var(--bg-hover);
}

.leaderboard-rank {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 600;
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
}

.leaderboard-rank.gold { background: #F59E0B20; color: #F59E0B; }
.leaderboard-rank.silver { background: #94A3B820; color: #94A3B8; }
.leaderboard-rank.bronze { background: #CD7F3220; color: #CD7F32; }

.leaderboard-logo {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border-color);
    flex-shrink: 0;
}

.leaderboard-color-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.leaderboard-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.leaderboard-players {
    font-weight: 600;
    color: var(--primary);
}

.leaderboard-instances {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.leaderboard-loading {
    text-align: center;
    padding: var(--spacing-md);
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* Concurrent Chart */
.concurrent-chart-wrapper {
    height: 100px;
}

/* Instance Line Markers */
.instance-marker-open {
    color: var(--success);
}

.instance-marker-close {
    color: var(--danger);
}

/* Heat Indicator Animation for Hot Lines */
@keyframes heat-line-glow {
    0%, 100% { 
        filter: drop-shadow(0 0 4px currentColor);
    }
    50% { 
        filter: drop-shadow(0 0 10px currentColor) drop-shadow(0 0 20px currentColor);
    }
}

/* ===== Block-based Instance Visualization ===== */
.blocks-wrapper {
    padding: var(--spacing-md);
    overflow: hidden;
}

.blocks-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    align-content: flex-start;
    width: 100%;
    overflow-x: hidden;
    box-sizing: border-box;
}

/* Layout mode: grouped (default) - instances grouped together */
.blocks-grid.layout-grouped {
    gap: var(--spacing-sm);
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
}

/* Layout mode: tetris - all blocks flow together like Tetris */
.blocks-grid.layout-tetris {
    gap: 0;
    display: flex;
    flex-wrap: wrap;
}

.blocks-grid.layout-tetris .instance-block-group {
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 0;
    gap: 0;
}

.blocks-grid.layout-tetris .instance-block-group:hover {
    border: none;
    transform: none;
    box-shadow: none;
}

.blocks-grid.layout-tetris .instance-block {
    border-radius: 0;
}

/* Layout mode: compact - no gaps between blocks within groups */
.blocks-grid.layout-compact {
    gap: var(--spacing-xs);
    grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
}

.blocks-grid.layout-compact .instance-block-group {
    gap: 0;
    padding: 1px;
}

.blocks-grid.layout-compact .instance-block {
    border-radius: 0;
}

/* Instance block group container */
.instance-block-group {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    padding: var(--spacing-sm);
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    position: relative;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.instance-block-group:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.instance-block-group.has-queue {
    border-color: var(--warning);
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.3);
}

.instance-block {
    width: 12px;
    height: 12px;
    border-radius: 2px;
    transition: transform var(--transition-fast);
}

/* Logo block - larger size to fit logo (2x2 blocks = 26px with gap) */
.instance-block.instance-block-logo {
    width: 26px;
    height: 26px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 2px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* In grouped/compact modes, force blocks to start below the logo */
.blocks-grid.layout-grouped .instance-block.instance-block-logo,
.blocks-grid.layout-compact .instance-block.instance-block-logo {
    flex-basis: 100%;
    width: 26px;
    max-width: 26px;
}

.instance-block.instance-block-logo .block-logo-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 2px;
}

/* In tetris mode, logo blocks are slightly smaller to blend better */
.blocks-grid.layout-tetris .instance-block.instance-block-logo {
    width: 22px;
    height: 22px;
}

/* In compact mode, logo blocks are same size as grouped */
.blocks-grid.layout-compact .instance-block.instance-block-logo {
    width: 20px;
    height: 20px;
}

.instance-block:hover {
    transform: scale(1.2);
    z-index: 5;
}

/* Logo block hover - scale less to avoid overlap issues */
.instance-block.instance-block-logo:hover {
    transform: scale(1.15);
    z-index: 10;
    border-color: rgba(255, 255, 255, 0.3);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

/* Tetris mode hover effect on individual blocks */
.blocks-grid.layout-tetris .instance-block:hover {
    transform: scale(1.3);
    box-shadow: 0 0 8px currentColor;
}

/* Tetris mode logo hover - maintain visibility */
.blocks-grid.layout-tetris .instance-block.instance-block-logo:hover {
    trrder-color: rgba(255, 255, 255, 0.4);
    boansform: scale(1.2);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.instance-block-label {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-primary);
    color: var(--text-primary);
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    font-size: 0.7rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-fast);
    z-index: 20;
    border: 1px solid var(--border-color);
}

.instance-block-group:hover .instance-block-label {
    opacity: 1;
}

/* Hide labels in tetris mode (use tooltip instead) */
.blocks-grid.layout-tetris .instance-block-label {
    display: none;
}

.instance-block-tooltip {
    position: fixed;
    background: var(--bg-primary);
    color: var(--text-primary);
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--radius-md);
    font-size: 0.8rem;
    z-index: 1000;
    pointer-events: none;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    max-width: 300px;
}

.instance-block-tooltip .tooltip-group {
    font-weight: 600;
    margin-bottom: 4px;
}

.instance-block-tooltip .tooltip-world {
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.instance-block-tooltip .tooltip-stats {
    display: flex;
    gap: var(--spacing-md);
    margin-top: var(--spacing-xs);
}

.instance-block-tooltip .tooltip-stat {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Chart view toggle buttons */
.chart-controls {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.chart-toggle-buttons {
    display: flex;
    gap: 2px;
    background: var(--bg-tertiary);
    padding: 2px;
    border-radius: var(--radius-sm);
}

.chart-toggle-buttons .btn {
    padding: 4px 8px;
}

.chart-toggle-buttons .btn.active {
    background: var(--primary);
    color: var(--text-primary);
}

/* Layout selector dropdown */
.layout-selector {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
}

.layout-selector label {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.layout-selector select {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    padding: 4px 8px;
    font-size: 0.75rem;
    cursor: pointer;
}

.layout-selector select:hover {
    border-color: var(--primary);
}

/* Leaderboard link styling */
.leaderboard-link {
    color: var(--text-primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.leaderboard-link:hover {
    color: var(--primary);
    text-decoration: underline;
}

/* Responsive */
@media (max-width: 1200px) {
    .rewind-main {
        grid-template-columns: 1fr;
    }
    
    .rewind-sidebar {
        flex-direction: row;
        flex-wrap: wrap;
    }
    
    .sidebar-section {
        flex: 1;
        min-width: 280px;
    }
}

@media (max-width: 768px) {
    .rewind-stats-bar {
        flex-wrap: wrap;
    }
    
    .rewind-controls,
    .rewind-filters {
        flex-direction: column;
        align-items: stretch;
    }
    
    .size-legend {
        justify-content: center;
    }
    
    .chart-wrapper {
        height: 350px;
    }
}

/* =====================================================
   Tag System Styles
   ===================================================== */

/* Tag Pills Container */
.tag-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.tag-pills-compact {
    gap: 4px;
}

.tag-pills-inline {
    display: inline-flex;
    margin-left: var(--spacing-sm);
}

/* Individual Tag Pill */
.tag-pill {
    --tag-color: #6B7280;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: var(--radius-full);
    background: color-mix(in srgb, var(--tag-color) 20%, transparent);
    color: var(--tag-color);
    border: 1px solid color-mix(in srgb, var(--tag-color) 40%, transparent);
    white-space: nowrap;
    transition: all var(--transition-fast);
    cursor: default;
}

.tag-pill:hover {
    background: color-mix(in srgb, var(--tag-color) 30%, transparent);
}

.tag-pills-compact .tag-pill {
    padding: 2px 8px;
    font-size: 0.7rem;
}

/* Clickable/Interactive Tags */
.tag-pill-interactive {
    cursor: pointer;
}

.tag-pill-interactive:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.tag-pill-interactive.active {
    background: var(--tag-color);
    color: white;
    border-color: var(--tag-color);
}

/* Tag with remove button */
.tag-pill-removable {
    padding-right: 6px;
}

.tag-pill-remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    margin-left: 2px;
    border-radius: 50%;
    background: transparent;
    border: none;
    color: inherit;
    cursor: pointer;
    opacity: 0.6;
    transition: all var(--transition-fast);
}

.tag-pill-remove:hover {
    opacity: 1;
    background: rgba(0, 0, 0, 0.2);
}

/* Tag Size Variants */
.tag-pill-xs {
    padding: 1px 6px;
    font-size: 0.65rem;
}

.tag-pill-sm {
    padding: 2px 8px;
    font-size: 0.7rem;
}

/* Tag Filter Bar */
.tag-filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-md);
    padding: var(--spacing-md);
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    align-items: center;
}

.tag-filter-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
}

.tag-filter-group {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.tag-filter-clear {
    margin-left: auto;
}

/* Tag Selector (for editing) */
.tag-selector {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
}

.tag-selector-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-md);
    padding-bottom: var(--spacing-sm);
    border-bottom: 1px solid var(--border-color);
}

.tag-selector-title {
    font-weight: 600;
    font-size: 0.875rem;
}

.tag-selector-search {
    position: relative;
    margin-bottom: var(--spacing-md);
}

.tag-selector-search input {
    width: 100%;
    padding: var(--spacing-sm) var(--spacing-md);
    padding-left: 36px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.875rem;
}

.tag-selector-search input:focus {
    outline: none;
    border-color: var(--primary);
}

.tag-selector-search i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.tag-selector-category {
    margin-bottom: var(--spacing-md);
}

.tag-selector-category-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: var(--spacing-sm);
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
}

.tag-selector-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

/* Create New Tag */
.tag-create-form {
    display: flex;
    gap: var(--spacing-sm);
    margin-top: var(--spacing-md);
    padding-top: var(--spacing-md);
    border-top: 1px solid var(--border-color);
}

.tag-create-form input[type="text"] {
    flex: 1;
    padding: var(--spacing-sm) var(--spacing-md);
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.875rem;
}

.tag-create-form input[type="color"] {
    width: 40px;
    height: 36px;
    padding: 2px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
}

/* Edit Token Display */
.edit-token-display {
    background: var(--warning-light);
    border: 1px solid var(--warning);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    margin: var(--spacing-md) 0;
}

.edit-token-display h4 {
    color: var(--warning);
    margin-bottom: var(--spacing-sm);
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.edit-token-code {
    font-family: monospace;
    background: var(--bg-primary);
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    word-break: break-all;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--spacing-sm);
}

.edit-token-code button {
    flex-shrink: 0;
}

.edit-token-warning {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: var(--spacing-sm);
}

/* Admin Badge */
.admin-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: linear-gradient(135deg, var(--danger), var(--accent-orange));
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: var(--radius-full);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Edit Token Input Modal */
.token-input-modal {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    max-width: 400px;
    width: 100%;
}

.token-input-modal h3 {
    margin-bottom: var(--spacing-md);
}

.token-input-modal input {
    width: 100%;
    padding: var(--spacing-sm) var(--spacing-md);
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: monospace;
    margin-bottom: var(--spacing-md);
}

/* Tags in Tables */
.table .tag-pills {
    max-width: 200px;
}

/* Tags in Cards */
.group-card .tag-pills {
    margin-top: var(--spacing-sm);
    padding-top: var(--spacing-sm);
    border-top: 1px solid var(--border-color);
}

/* Tag Section Headers (for live-graphs) */
.tag-section {
    margin-bottom: var(--spacing-xl);
}

.tag-section-header {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-md);
    padding-bottom: var(--spacing-sm);
    border-bottom: 2px solid var(--border-color);
}

.tag-section-header .tag-pill {
    font-size: 0.875rem;
    padding: 4px 12px;
}

.tag-section-count {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-left: auto;
}

/* Mobile Tag Responsiveness */
@media (max-width: 768px) {
    .tag-filter-bar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .tag-filter-clear {
        margin-left: 0;
        margin-top: var(--spacing-sm);
    }
    
    .tag-selector {
        max-height: 60vh;
        overflow-y: auto;
    }
    
    .tag-pill {
        padding: 4px 12px;
        font-size: 0.8rem;
    }
    
    .edit-token-code {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }
}

/* ===== Site Footer ===== */
.site-footer {
    margin-top: auto;
    padding: var(--spacing-lg) var(--spacing-xl);
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
    flex-shrink: 0;
}

.footer-content {
    max-width: var(--content-max-width);
    margin: 0 auto;
    text-align: center;
}

.footer-links {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: var(--spacing-sm);
}

.footer-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.875rem;
    transition: color 0.2s ease;
}

.footer-links a:hover {
    color: var(--primary);
}

.footer-links .separator {
    color: var(--text-muted);
    opacity: 0.5;
}

.footer-disclaimer {
    color: var(--text-muted);
    font-size: 0.75rem;
    margin: 0;
}

.footer-credit {
    margin-left: 0.5rem;
}

.footer-credit a {
    color: var(--text-secondary);
    text-decoration: none;
}

.footer-credit a:hover {
    color: var(--primary);
}

@media (max-width: 768px) {
    .footer-links {
        flex-direction: column;
        gap: 0.25rem;
    }
    
    .footer-links .separator {
        display: none;
    }
    
    .footer-credit {
        display: block;
        margin-left: 0;
        margin-top: 0.25rem;
    }
}

