:root {
    --bg-color: #0f172a;
    --card-bg: #1e293b;
    --text-color: #e2e8f0;
    --accent-al: #ef4444;
    --accent-nl: #3b82f6;
    --success: #22c55e;
    --warning: #eab308;
    --danger: #dc2626;
    --border-color: #334155;
    --input-bg: #334155;
    --font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-color);
    padding: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* --- HEADER --- */
header {
    width: 99%;
    max-width: 1900px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 15px;
}

.logo-area h1 {
    font-size: 1.8rem;
    font-weight: 700;
    background: linear-gradient(90deg, #fff, #94a3b8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: flex;
    align-items: center;
}

.mlb-logo { height: 1.5em; margin-right: 15px; vertical-align: middle; }

.controls { display: flex; gap: 10px; align-items: center; }

/* Buttons */
button { padding: 8px 16px; border-radius: 4px; border: none; cursor: pointer; font-weight: bold; transition: opacity 0.2s; font-size: 0.85rem; }
button:hover { opacity: 0.9; }
.btn-admin { background-color: var(--warning); color: #000; }
.btn-view { background-color: var(--accent-nl); color: #fff; }
.btn-save { background-color: var(--success); color: #fff; width: 100%; padding: 10px; font-size: 1rem; margin-top: 15px;}
.btn-reset { background-color: var(--accent-al); color: #fff; margin-top: 15px; width: 48%;}
.btn-clear { background-color: var(--danger); color: #fff; margin-top: 15px; width: 48%; float: right;}

/* --- DASHBOARD LAYOUT --- */
.dashboard-grid { display: grid; grid-template-columns: 3.5fr 1fr; gap: 20px; width: 100%; max-width: 1900px; }
.leagues-container { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.admin-container-wrapper { width: 95%; max-width: 1600px; }

@media (max-width: 1400px) {
    .dashboard-grid { grid-template-columns: 1fr; }
    .leagues-container { grid-template-columns: 1fr; }
}

.card { 
    background-color: var(--card-bg); 
    border-radius: 10px; 
    overflow: hidden; 
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3); 
    margin-bottom: 15px; 
    border: 1px solid rgba(255,255,255,0.05); 
}

.card-header { padding: 8px 10px; font-weight: 800; text-transform: uppercase; letter-spacing: 1.5px; text-align: center; font-size: 0.95rem; text-shadow: 0 1px 2px rgba(0,0,0,0.5); }
.header-al { background: linear-gradient(135deg, rgba(239, 68, 68, 0.15), rgba(239, 68, 68, 0.4)); color: #fca5a5; border-bottom: 1px solid var(--accent-al); }
.header-nl { background: linear-gradient(135deg, rgba(59, 130, 246, 0.15), rgba(59, 130, 246, 0.4)); color: #93c5fd; border-bottom: 1px solid var(--accent-nl); }

table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 0.85rem; table-layout: fixed; } 
th, td { padding: 8px 6px; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
th { background-color: #161e2e; color: #94a3b8; font-weight: 700; font-size: 0.75rem; text-transform: uppercase; border-bottom: 1px solid var(--border-color); }
tbody tr:nth-child(even) { background-color: rgba(255, 255, 255, 0.02); }
tbody tr:hover { background-color: rgba(255, 255, 255, 0.06); transition: background-color 0.2s ease; }

.rank-badge { display: inline-flex; justify-content: center; align-items: center; width: 20px; height: 20px; background-color: #334155; color: #cbd5e1; border-radius: 50%; font-size: 0.7rem; font-weight: bold; }
.bg-correct { background-color: rgba(34, 197, 94, 0.1) !important; color: #86efac; font-weight: bold; box-shadow: inset 3px 0 0 var(--success); }
.bg-gold { background-color: rgba(234, 179, 8, 0.15) !important; color: #fde047; font-weight: bold; box-shadow: inset 3px 0 0 var(--warning); text-shadow: 0 0 5px rgba(234, 179, 8, 0.3); }
.points-row { background-color: #111827 !important; font-weight: bold; border-top: 1px solid var(--border-color); }
.total-points-cell { color: #fff; font-size: 1rem; }

/* Scoreboard & Progress */
.scoreboard-panel { display: flex; flex-direction: column; gap: 15px; }
.score-table th { background-color: var(--accent-nl); color: white; padding: 10px;}
.score-table th:first-child { background-color: transparent; }
.score-table td { font-size: 1.1rem; font-weight: bold; padding: 10px; border-bottom: 1px solid var(--border-color);}
.big-number { font-size: 1.8rem; color: white; }

.progress-container { padding: 15px; text-align: center; }
.progress-track { position: relative; height: 30px; background-color: #334155; border-radius: 15px; overflow: hidden; box-shadow: inset 0 2px 4px rgba(0,0,0,0.4); }
.progress-fill { height: 100%; width: 0%; transition: width 0.8s ease-in-out, background-color 0.5s ease; background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); background-size: 1rem 1rem; box-shadow: 0 0 10px rgba(0,0,0,0.3); }
.progress-text-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: bold; font-size: 0.9rem; text-shadow: 0 1px 3px rgba(0,0,0,0.8); z-index: 10; pointer-events: none; }
.status-dot { height: 10px; width: 10px; border-radius: 50%; display: inline-block; margin-right: 8px; }
.dot-red { background-color: #ef4444; box-shadow: 0 0 8px rgba(239, 68, 68, 0.6); }
.dot-green { background-color: #22c55e; box-shadow: 0 0 8px rgba(34, 197, 94, 0.6); }
.dot-yellow { background-color: #eab308; box-shadow: 0 0 8px rgba(234, 179, 8, 0.6); }
.dot-grey { background-color: #94a3b8; }

/* --- ADMIN STYLES (NEU: RECHTSBÜNDIG) --- */
.admin-layout-grid {
    display: grid;
    grid-template-columns: 1fr 250px; /* HIER GEÄNDERT: Links breit, Rechts schmal */
    gap: 20px;
    align-items: start;
}

.admin-sidebar { position: sticky; top: 20px; }
.admin-content { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }

/* Container für die Spalten AL und NL */
.league-column {
    display: flex;
    flex-direction: column;
    gap: 15px; /* Abstand zwischen den Divisionen untereinander */
}

@media (max-width: 1200px) {
    .admin-layout-grid { grid-template-columns: 1fr; }
    .admin-sidebar { position: static; margin-bottom: 20px; order: -1; /* Status auf Handy oben */ }
}

.admin-section { background-color: var(--card-bg); padding: 10px; border-radius: 6px; margin-bottom: 10px; border: 1px solid var(--border-color); font-size: 0.85rem; }
.admin-division-title { font-size: 0.95rem; margin-bottom: 8px; padding-bottom: 4px; border-bottom: 1px solid var(--border-color); color: #fff; font-weight: bold; text-transform: uppercase; }

.admin-header-row { display: grid; grid-template-columns: 25px 1fr 1fr 1fr 1.2fr; gap: 5px; margin-bottom: 4px; }
.admin-header-label { font-size: 0.75rem; color: #94a3b8; font-weight: bold; text-transform: uppercase; text-align: center; }

.admin-row { display: grid; grid-template-columns: 25px 1fr 1fr 1fr 1.2fr; gap: 5px; margin-bottom: 3px; padding: 2px; align-items: center; background-color: rgba(255, 255, 255, 0.02); border-radius: 4px; }
.admin-row label { font-size: 0.75rem; color: #cbd5e1; font-weight: bold; text-align: center; }

.admin-row input, .admin-row select, .admin-sidebar input, .admin-sidebar select { 
    width: 100%; background-color: var(--input-bg); border: 1px solid var(--border-color); color: white; padding: 3px 6px; border-radius: 4px; font-size: 0.8rem; height: 26px; transition: border-color 0.2s; 
}
.admin-row input:focus, .admin-row select:focus { border-color: var(--warning); outline: none; background-color: #1e293b; }

.input-wrapper { display: flex; flex-direction: column; margin-bottom: 10px; }
.input-wrapper label { display: block; color: #94a3b8; margin-bottom: 4px; font-size: 0.8rem; }
.points-preview { font-size: 0.75rem; padding: 4px; background: #0f172a; border-radius: 4px; color: var(--success); text-align: right; }

/* Login Form & Modal */
.header-login-wrapper { display: flex; align-items: center; gap: 10px; background: rgba(30, 41, 59, 0.5); padding: 8px 12px; border-radius: 8px; border: 1px solid rgba(255, 255, 255, 0.05); box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); }
.header-input { padding: 8px 12px; border-radius: 6px; border: 1px solid #334155; background-color: #0f172a; color: #e2e8f0; font-size: 0.9rem; width: 140px; transition: all 0.3s ease; height: auto; }
.header-input::placeholder { color: #64748b; font-size: 0.8rem; font-style: italic; }
.header-input:focus { border-color: var(--warning); box-shadow: 0 0 0 2px rgba(234, 179, 8, 0.2); outline: none; background-color: #1e293b; }
.header-login-wrapper button { background: linear-gradient(135deg, #3b82f6, #2563eb); color: white; border: none; padding: 8px 18px; border-radius: 6px; font-weight: 600; cursor: pointer; font-size: 0.85rem; text-transform: uppercase; transition: all 0.2s ease; box-shadow: 0 2px 4px rgba(0,0,0,0.2); }
.header-login-wrapper button:hover { transform: translateY(-1px); box-shadow: 0 4px 8px rgba(59, 130, 246, 0.4); filter: brightness(1.1); }
.register-link { color: #94a3b8; font-size: 0.75rem; text-decoration: none; margin-left: 8px; border-bottom: 1px dotted #94a3b8; cursor: pointer; transition: color 0.2s; }
.register-link:hover { color: var(--warning); border-color: var(--warning); }
.user-badge { color: var(--warning); font-weight: bold; font-size: 0.9rem; }

.modal-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(15, 23, 42, 0.85); backdrop-filter: blur(5px); z-index: 2000; justify-content: center; align-items: center; }
.modal-content { background: linear-gradient(145deg, #1e293b, #0f172a); padding: 30px; border-radius: 12px; box-shadow: 0 20px 50px rgba(0,0,0,0.6); border: 1px solid rgba(255,255,255,0.1); width: 90%; max-width: 350px; text-align: center; position: relative; }
.modal-title { font-size: 1.3rem; color: #fff; margin-bottom: 20px; font-weight: bold; text-transform: uppercase; }
.modal-content input { width: 100%; padding: 10px; margin-bottom: 15px; background-color: #334155; border: 1px solid #475569; border-radius: 6px; color: white; height: auto;}
.modal-content button { width: 100%; padding: 10px; background: var(--success); color: white; border: none; border-radius: 6px; font-weight: bold; cursor: pointer; }
.close-modal { position: absolute; top: 10px; right: 15px; color: #64748b; font-size: 1.5rem; cursor: pointer; }
footer { margin-top: 20px; color: #475569; font-size: 0.8rem; }