:root {
    --bg-dark: #0f172a;
    --primary: #9146FF; /* Twitch purple */
    --secondary: #00f2fe;
    --success: #10b981;
    --danger: #ef4444;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
}

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

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

.background-blobs {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; z-index: -1; overflow: hidden;
}
.blob {
    position: absolute; border-radius: 50%; filter: blur(80px); opacity: 0.5; animation: float 10s infinite alternate ease-in-out;
}
.blob-1 { top: -10%; left: -10%; width: 40vw; height: 40vw; background: var(--primary); }
.blob-2 { bottom: -10%; right: -10%; width: 30vw; height: 30vw; background: var(--secondary); animation-delay: -5s; }

@keyframes float {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(50px, 50px) scale(1.1); }
}

.container { max-width: 1200px; margin: 0 auto; padding: 2rem; }

header { text-align: center; margin-bottom: 3rem; animation: fadeInDown 1s ease-out; }
header h1 { font-size: 3rem; font-weight: 800; letter-spacing: -1px; }
.highlight { color: var(--primary); text-shadow: 0 0 20px rgba(145, 70, 255, 0.5); }
header p { color: var(--text-muted); font-size: 1.2rem; margin-top: 0.5rem; }

.api-key-banner { display: flex; justify-content: center; gap: 1rem; margin-bottom: 2rem; animation: fadeIn 1s ease-out 0.5s both; }
.api-key-banner input { background: var(--glass-bg); border: 1px solid var(--glass-border); color: white; padding: 0.8rem 1.5rem; border-radius: 30px; font-family: 'Outfit'; font-size: 1rem; outline: none; width: 300px; backdrop-filter: blur(10px); transition: all 0.3s ease; }
.api-key-banner input:focus { border-color: var(--primary); box-shadow: 0 0 15px rgba(145, 70, 255, 0.3); }
.api-key-banner button { background: linear-gradient(135deg, var(--primary), #b070ff); color: white; border: none; padding: 0.8rem 2rem; border-radius: 30px; font-size: 1rem; font-weight: 600; cursor: pointer; font-family: 'Outfit'; transition: all 0.3s ease; }
.api-key-banner button:hover { transform: translateY(-2px); box-shadow: 0 5px 15px rgba(145, 70, 255, 0.4); }

.glass { background: var(--glass-bg); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border: 1px solid var(--glass-border); border-radius: 20px; box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3); }

.filters-bar {
    position: relative;
    z-index: 100;
    display: flex; gap: 1rem; padding: 1.5rem 2rem; margin-bottom: 2rem; justify-content: center; flex-wrap: nowrap;
    animation: fadeIn 0.5s ease-out;
}
.filter-group { display: flex; flex-direction: column; gap: 0.5rem; }
.filter-group label { font-size: 0.9rem; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: 1px; }

/* Custom Selects */
.custom-select {
    position: relative;
    background: rgba(0,0,0,0.2);
    border: 1px solid var(--glass-border);
    color: white;
    padding: 0.6rem 1rem;
    border-radius: 10px;
    font-family: 'Outfit';
    cursor: pointer;
    min-width: 150px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.custom-select::after {
    content: '▼';
    font-size: 0.6rem;
    margin-left: 10px;
    color: var(--text-muted);
}
.custom-dropdown-list {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.4);
    /* 5 items * ~40px = 200px max height */
    max-height: 200px; 
    overflow-y: auto;
    z-index: 2000;
    display: none;
    margin-top: 5px;
}
.custom-dropdown-item {
    padding: 0.8rem 1rem;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.2s;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
.custom-dropdown-item:last-child { border-bottom: none; }
.custom-dropdown-item:hover { background: var(--primary); }

.custom-dropdown-list::-webkit-scrollbar { width: 6px; }
.custom-dropdown-list::-webkit-scrollbar-track { background: transparent; }
.custom-dropdown-list::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 10px; }

.custom-select-input {
    background: transparent;
    border: none;
    color: white;
    font-family: 'Outfit';
    font-size: 0.95rem;
    outline: none;
    width: 100%;
    cursor: pointer;
}
.custom-select-input:focus {
    cursor: text;
}
.custom-select-input::placeholder {
    color: rgba(255,255,255,0.5);
}

.date-input {
    background: rgba(0,0,0,0.2); border: 1px solid var(--glass-border); color: white; padding: 0.5rem 1rem; border-radius: 10px; font-family: 'Outfit'; outline: none; cursor: pointer;
}
.date-input::-webkit-calendar-picker-indicator { filter: invert(1); cursor: pointer; }

/* Tabs */
.tabs { display: flex; justify-content: center; gap: 1rem; margin-bottom: 2rem; }
.tab-btn { background: transparent; color: var(--text-muted); border: none; padding: 0.8rem 2rem; font-size: 1.1rem; font-weight: 600; cursor: pointer; font-family: 'Outfit'; border-bottom: 3px solid transparent; transition: all 0.3s ease; }
.tab-btn:hover { color: white; }
.tab-btn.active { color: white; border-bottom: 3px solid var(--primary); }
.tab-content { animation: fadeIn 0.4s ease-out; }

/* KPI Grid */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1.5rem; margin-bottom: 2rem; }
.kpi-card { padding: 1.5rem; display: flex; align-items: center; gap: 1.5rem; transition: transform 0.3s ease, box-shadow 0.3s ease; }
.kpi-card:hover { transform: translateY(-5px); box-shadow: 0 12px 40px 0 rgba(0, 0, 0, 0.4); }
.kpi-icon { font-size: 2.2rem; background: rgba(255, 255, 255, 0.05); width: 60px; height: 60px; display: flex; align-items: center; justify-content: center; border-radius: 15px; }
.kpi-info h3 { font-size: 0.85rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 0.3rem; }
.kpi-value { font-size: 1.8rem; font-weight: 800; }
.highlight-green { color: var(--success); }
.highlight-red { color: var(--danger); }

/* Charts */
.charts-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(400px, 1fr)); gap: 2rem; }
.chart-container { padding: 2rem; display: flex; flex-direction: column; align-items: center; width: 100%; }
.chart-container h2 { margin-bottom: 1.5rem; font-size: 1.3rem; font-weight: 600; align-self: flex-start; }
canvas { max-width: 100%; }

/* Table */
.bets-table { width: 100%; border-collapse: collapse; text-align: left; font-size: 0.95rem; }
.bets-table th { padding: 1rem; border-bottom: 2px solid var(--glass-border); color: var(--text-muted); font-weight: 600; text-transform: uppercase; font-size: 0.8rem; letter-spacing: 1px; }
.bets-table td { padding: 1rem; border-bottom: 1px solid rgba(255,255,255,0.05); vertical-align: middle; }
.bets-table tr:hover { background: rgba(255,255,255,0.02); }

.tag-badge { display: inline-block; background: var(--primary); color: white; padding: 0.2rem 0.6rem; border-radius: 12px; font-size: 0.75rem; margin-right: 0.3rem; margin-bottom: 0.3rem; cursor: pointer; transition: all 0.2s; }
.tag-badge:hover { background: var(--danger); text-decoration: line-through; }
.tag-input { background: rgba(0,0,0,0.3); border: 1px dashed var(--glass-border); color: white; padding: 0.3rem 0.6rem; border-radius: 10px; font-size: 0.8rem; width: 80px; outline: none; transition: all 0.3s; }
.tag-input:focus { border-color: var(--primary); width: 120px; }

/* Custom Autocomplete */
.autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.4);
    max-height: 150px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
    min-width: 120px;
    margin-top: 5px;
}
.autocomplete-item {
    padding: 0.5rem 1rem;
    cursor: pointer;
    font-size: 0.8rem;
    transition: background 0.2s;
}
.autocomplete-item:hover {
    background: var(--primary);
}

/* Custom Scrollbar for dropdowns */
.autocomplete-dropdown::-webkit-scrollbar { width: 6px; }
.autocomplete-dropdown::-webkit-scrollbar-track { background: transparent; }
.autocomplete-dropdown::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 10px; }

@keyframes fadeInDown { from { opacity: 0; transform: translateY(-20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
