:root { 
    --primary: #2563eb; 
    --secondary: #db2777; 
    --bg: #f1f5f9; 
    --card-bg: #ffffff; 
    --text: #1e293b; 
    --border: #cbd5e1; 
}

/* Dark Mode Farben */
body.dark-mode {
    --bg: #0f172a;
    --card-bg: #1e293b;
    --text: #f1f5f9;
    --border: #334155;
}

/* Dark Mode Switch Styling */
.theme-switch {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
}

.theme-switch button {
    padding: 8px 15px;
    font-size: 12px;
    background: var(--card-bg);
    color: var(--text);
    border: 1px solid var(--border);
}

* { box-sizing: border-box; }

body { 
    font-family: 'Segoe UI', system-ui, sans-serif; 
    background: var(--bg); 
    color: var(--text); 
    padding: 10px; 
    margin: 0; 
}

.dashboard-container { 
    max-width: 1200px; 
    margin: auto; 
    padding-bottom: 50px; 
}

.card { 
    background: var(--card-bg); 
    padding: 15px; 
    border-radius: 12px; 
    box-shadow: 0 2px 4px rgba(0,0,0,0.05); 
    margin-bottom: 20px; 
}

.search-grid { 
    display: grid; 
    grid-template-columns: 1fr; 
    gap: 15px; 
}

@media (min-width: 768px) { 
    .search-grid { grid-template-columns: 1fr 1fr; } 
    body { padding: 20px; } 
}

.input-group { 
    display: flex; 
    flex-direction: column; 
    gap: 10px; 
}

@media (min-width: 480px) { 
    .input-group { flex-direction: row; } 
}

input, select, button { 
    padding: 12px; 
    border-radius: 8px; 
    font-size: 16px; 
    border: 1px solid var(--border); 
}

button { 
    background: var(--primary); 
    color: white; 
    border: none; 
    font-weight: 600; 
    cursor: pointer; 
}

.toggle-group { 
    display: none; 
    justify-content: center; 
    gap: 5px; 
    margin-top: 15px; 
    background: #f8fafc; 
    padding: 5px; 
    border-radius: 10px; 
}

.btn-toggle { 
    flex: 1; 
    border: none; 
    padding: 8px; 
    cursor: pointer; 
    border-radius: 6px; 
}

.btn-toggle.active { background: var(--primary); color: white; }
.btn-toggle.active.inf { background: var(--secondary); }

.chart-main-wrapper { 
    position: relative; 
    height: 300px; 
    width: 100%; 
}

@media (min-width: 768px) { 
    .chart-main-wrapper { height: 500px; } 
}

.user-details-row { 
    display: none; 
    grid-template-columns: 1fr; 
    gap: 15px; 
    margin-top: 20px; 
}

@media (min-width: 768px) { 
    .user-details-row { grid-template-columns: 1fr 1fr; } 
}

#loader { 
    display: none; 
    text-align: center; 
    margin: 30px; 
}

.spinner { 
    border: 4px solid rgba(0,0,0,0.1); 
    width: 30px; 
    height: 30px; 
    border-radius: 50%; 
    border-left-color: var(--primary); 
    animation: spin 1s linear infinite; 
    display: inline-block; 
}

@keyframes spin { 100% { transform: rotate(360deg); } }

#visualization-area { 
    transition: opacity 0.3s ease; 
}

/* --- TABELLEN OPTIMIERUNG --- */

.table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-top: 10px;
    border-radius: 8px;
    border: 1px solid var(--border);
}

table {
    width: 100%;
    min-width: 650px; 
    border-collapse: separate; 
    border-spacing: 0;
}

/* Header-Zellen */
th {
    position: sticky;
    top: 0;
    z-index: 11;
    background: var(--bg) !important;
    padding: 12px;
    text-align: center;
    font-weight: bold;
    border-bottom: 2px solid var(--border);
}

/* Fixierte erste Spalte (Sticky) */
th:first-child, 
td:first-child {
    position: sticky;
    left: 0;
    z-index: 10;
    text-align: left;
    background: var(--card-bg) !important; /* Blickdicht für Zebra-Fix */
    border-right: 2px solid var(--border);
    min-width: 130px;
	width: 150px;
}

th:first-child { z-index: 12; } /* Obere linke Ecke am höchsten */

td {
    padding: 8px;
    text-align: center;
    border-bottom: 1px solid var(--border);
    background: var(--card-bg);
}

/* Zebra-Look (Nur für Daten-Spalten, nicht für die fixierte erste Spalte) */
tbody tr:nth-child(even) td:not(:first-child) {
    background: rgba(0, 0, 0, 0.03);
}

body.dark-mode tbody tr:nth-child(even) td:not(:first-child) {
    background: rgba(255, 255, 255, 0.05);
}

/* Hover-Effekt für Zeilen */
tbody tr:hover td {
    background: rgba(37, 99, 235, 0.08) !important;
}

/* Farben für Wertänderungen */
.up { 
    color: #ef4444 !important; /* Rot bei Verlust/Zuwachs (Logik-abhängig) */
    font-weight: 600;
}

.down { 
    color: #10b981 !important; /* Grün */
    font-weight: 600;
}

body.dark-mode .up { color: #f87171 !important; }
body.dark-mode .down { color: #34d399 !important; }

/* Markierung der Current Spalte */
td:nth-child(2) {
    background: rgba(37, 99, 235, 0.05);
    font-weight: bold;
}

.table-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

/* Support Buttons */
.btn-support {
    display: block;
    text-align: center;
    padding: 12px;
    background: var(--primary);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    transition: opacity 0.2s;
}

.btn-support.secondary {
    background: var(--secondary);
}

.btn-support:hover {
    opacity: 0.9;
}

/* Supporter Grid für Analytics Look */
.supporter-grid-analytics {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
}

.supporter-item {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    position: relative;
}

.supporter-item.top-supporter {
    border-color: var(--primary);
    background: rgba(37, 99, 235, 0.05);
}

.supporter-item .rank {
    font-size: 0.75rem;
    font-weight: bold;
    color: var(--primary);
    margin-right: 10px;
    opacity: 0.6;
}

.supporter-item .name {
    font-weight: 600;
    font-size: 0.95rem;
}

.supporter-item .crown {
    margin-left: auto;
    font-size: 1.1rem;
}

/* Dark Mode Anpassung für das Datum */
body.dark-mode .supporter-item {
    background: rgba(255, 255, 255, 0.03);
}

.toggle-group {
    display: none;
    justify-content: center;
    gap: 5px;
    flex-wrap: wrap; /* Wichtig für Mobile */
    margin-top: 10px;
}