:root { 
    caret-color: transparent;
    --bg-color: #0d1117;
    --card-bg: rgba(22, 27, 34, 0.7);
    --border-color: #30363d;
    --text-primary: #c9d1d9;
    --text-secondary: #9198a1;
    --link-color: #58a6ff;
    --accent-color: #238636;
    --hover-bg: rgba(177, 186, 196, 0.04);
    --badge-bg: rgba(56, 139, 253, 0.15);
    --badge-text: #58a6ff;
    --badge-hover: rgba(56, 139, 253, 0.3);
    --input-bg: #0d1117;
}

body { 
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Helvetica, Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    margin: 0;
    padding: 20px;
    background-image: radial-gradient(circle at top right, #161b22 0%, transparent 40%), radial-gradient(circle at bottom left, #161b22 0%, transparent 40%);
    background-attachment: fixed;
    min-height: 100vh;
    font-size: 13px;
    cursor: default;
}

.container { max-width: 1000px; margin: 0 auto; }

/* Global Utilities */
.hidden { display: none !important; }
.unselectable { user-select: none; -webkit-user-select: none; }

/* Header & Branding */
.header {
    background: rgba(22, 27, 34, 0.6);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 20px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.header-top { display: flex; justify-content: space-between; align-items: center; }

.header-brand h1 { margin: 0; font-size: 20px; font-weight: 600; color: #f0f6fc; }
.header-brand .username { color: var(--link-color); font-weight: 600; }
.header-brand .subtext { margin-top: 4px; color: var(--text-secondary); }

/* Dashboard Summary Cards / Stats Block */
.stats { display: flex; gap: 15px; font-size: 13px; color: var(--text-secondary); }
.stat-item strong { color: var(--text-primary); display: inline; font-size: 14px; margin-right: 4px; }

/* Dashboard Summary Cards (alternative grid) */
.stats-grid { 
    display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); 
    gap: 12px; margin-top: 15px;
}
.stat-card { 
    background: var(--card-bg); border: 1px solid var(--border-color);
    border-radius: 8px; padding: 12px; text-align: center;
    transition: transform 0.2s, background 0.2s;
}
.stat-card:hover { transform: translateY(-2px); background: var(--hover-bg); }
.stat-val { font-size: 22px; font-weight: 700; color: #ffffff; display: block; }
.stat-label { font-size: 11px; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.5px; }

/* Inputs & Form Elements */
select, button, input {
    background: var(--input-bg); border: 1px solid var(--border-color);
    color: var(--text-primary); padding: 8px 12px; border-radius: 6px;
    font-size: 13px; outline: none; transition: border-color 0.2s, box-shadow 0.2s;
}
input:focus, select:focus { 
    border-color: var(--link-color); 
    box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.1); 
}

/* Tabs System (Pill style) */
.tabs { 
    display: inline-flex; 
    background: rgba(110, 118, 129, 0.1); 
    border-radius: 6px; 
    padding: 4px; 
    margin-bottom: 20px; 
    border: 1px solid var(--border-color);
}
.tab-btn { 
    background: none; border: none; color: var(--text-secondary); 
    padding: 6px 16px; font-size: 13px; cursor: pointer; 
    border-radius: 5px; transition: all 0.2s;
    font-weight: 500; display: flex; align-items: center; gap: 8px;
}
.tab-btn:hover { color: var(--text-primary); background: rgba(177, 186, 196, 0.08); }
.tab-btn.active { 
    background: rgba(110, 118, 129, 0.3);
    color: var(--text-primary); font-weight: 600;
}
.tab-btn svg { fill: currentColor; }

.tab-content { display: none; }
.tab-content.active { display: block; animation: fadeIn 0.3s ease-out; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

/* Data Tables */
.table-container {
    background: var(--card-bg); backdrop-filter: blur(8px);
    border: 1px solid var(--border-color); border-radius: 8px;
    overflow: hidden; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}
table { border-collapse: collapse; width: 100%; }
th { 
    text-align: left; padding: 0;
    background: rgba(22, 27, 34, 0.8); border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary); font-weight: 600; font-size: 11px;
    text-transform: uppercase; letter-spacing: 0.5px;
    position: relative;
}
td { 
    padding: 8px 12px; border-bottom: 1px solid var(--border-color); vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tr:hover { background-color: var(--hover-bg); }

.sort-btn {
    width: 100%; text-align: left; background: none; border: none;
    color: inherit; font-family: inherit; font-size: inherit; font-weight: inherit;
    text-transform: inherit; letter-spacing: inherit; padding: 12px;
    cursor: pointer; display: flex; align-items: center; justify-content: space-between;
    outline: none; transition: background 0.2s, color 0.2s;
}
.sort-btn:hover { color: var(--text-primary); background: rgba(33, 38, 45, 0.8); }

.sort-icon { opacity: 0.2; font-size: 10px; transition: opacity 0.2s; }
.sort-asc .sort-icon::after { content: '↑'; opacity: 1; color: var(--link-color); }
.sort-desc .sort-icon::after { content: '↓'; opacity: 1; color: var(--link-color); }
.sort-icon::after { content: '↕'; }

/* User Components */
.user-grid { 
    display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; 
}
.user-card { 
    background: var(--card-bg); border: 1px solid var(--border-color); 
    border-radius: 8px; padding: 12px; display: flex; align-items: center; gap: 12px;
    transition: all 0.2s; text-decoration: none;
}
.user-card:hover { 
    border-color: #8b949e; background: var(--hover-bg); transform: translateY(-2px);
}
.avatar-placeholder {
    width: 36px; height: 36px; border-radius: 50%; background: #21262d;
    display: flex; align-items: center; justify-content: center;
    font-size: 16px; color: var(--link-color); font-weight: bold;
    border: 1px solid var(--border-color); flex-shrink: 0;
}
.user-info { display: flex; flex-direction: column; overflow: hidden; }
.user-name { color: var(--text-primary); font-weight: 600; font-size: 13px; }
.user-meta { color: var(--text-secondary); font-size: 11px; margin-top: 1px; }

/* Badges & Links */
.count-badge { 
    background: rgba(110, 118, 129, 0.4);
    color: var(--text-primary); padding: 2px 8px;
    border-radius: 12px; font-weight: 500; font-size: 11px;
}
.user-badge { 
    display: inline-block; background: var(--badge-bg); color: var(--badge-text);
    padding: 2px 8px; border-radius: 12px; font-size: 11px;
    text-decoration: none; transition: all 0.2s; border: 1px solid transparent;
}
.user-badge:hover { 
    background: var(--badge-hover); border-color: rgba(88, 166, 255, 0.3);
    transform: translateY(-1px);
}

.film-link { 
    color: var(--text-primary); text-decoration: none;
    font-weight: 600; font-size: 14px; display: inline-block;
    transition: color 0.2s;
}
.film-link:hover { color: var(--link-color); text-decoration: underline; }

.film-badge {
    display: inline-block; background: rgba(110, 118, 129, 0.15); color: var(--text-primary);
    padding: 2px 8px; border-radius: 12px; font-size: 11px;
    text-decoration: none; border: 1px solid transparent;
    white-space: nowrap; transition: all 0.2s;
}
.film-badge:hover { 
    color: var(--link-color); background: rgba(56, 139, 253, 0.2); border-color: rgba(56, 139, 253, 0.4);
}

/* Footer */
.footer { text-align: center; margin-top: 40px; color: var(--text-secondary); font-size: 11px; padding: 20px; opacity: 0.7; }

/* Global UI Elements */
#scrollTopBtn {
    position: fixed; bottom: 30px; right: 30px; z-index: 1000;
    background: var(--link-color); color: white; border: none; outline: none;
    width: 48px; height: 48px; border-radius: 50%; cursor: pointer;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5); transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex; align-items: center; justify-content: center; 
    opacity: 0; transform: translateY(20px); pointer-events: none;
}
#scrollTopBtn.visible { opacity: 1; transform: translateY(0); pointer-events: auto; }
#scrollTopBtn:hover { background: #79c0ff; transform: scale(1.1); }
#scrollTopBtn svg { width: 24px; height: 24px; fill: currentColor; }
