/* /css/style.css */

/* --- GLOBALE VARIABLEN & BASICS --- */
:root {
  --bg: #FAFAFA;
  --surface: #FFFFFF;
  --primary: #FF0000;         /* Reines Festival-Rot */
  --text-primary: #0F0F0F;    /* Tiefschwarz */
  --text-secondary: #666666;
  --border: #EAEAEA;
  --danger: #EF4444;          /* Admin Löschen-Farbe */
  --success: #22C55E;         /* Admin Speicher-Farbe */
  --accent: #3B82F6;          /* Admin Info-Fokus */
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Roboto', sans-serif;
  -webkit-tap-highlight-color: transparent;
}

body {
  background: var(--bg);
  color: var(--text-primary);
  padding: 6px;
  font-size: 13px;
  padding-bottom: 40px;
}

main {
  max-width: 600px;
  margin: 30px auto 0 auto;
  padding: 16px;
}

/* --- KOPFZEILE & CORE-UI --- */
.top-bar {
  background: var(--surface);
  height: 60px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  position: sticky;
  top: 0;
  z-index: 90;
}

.logo-area {
  font-weight: 900;
  font-size: 20px;
  letter-spacing: -0.5px;
}

.logo-badge {
  background-color: var(--primary) !important;
  color: #FFFFFF !important;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: bold;
  margin-left: 6px;
}

.login-btn {
  background: var(--text-primary);
  color: #FFF;
  border: none;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 700;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}
.login-btn:hover { background: var(--primary); }
.login-btn:active { transform: scale(0.96); }

/* --- STRUKTURELEMENTE (CARDS & LAYOUTS) --- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 8px;
  margin-bottom: 8px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.card h2 {
  margin-top: 0;
  margin-bottom: 6px;
  font-size: 11px;
  color: var(--text-primary);
  border-bottom: 2px solid var(--bg);
  padding-bottom: 2px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Info & Status-Bereiche */
.hero-blabla {
  text-align: center;
  margin: 25px auto 35px auto;
  max-width: 700px;
  font-size: 14px;
  letter-spacing: 0.2px;
  line-height: 1.6;
  color: #555;
  background: #fafafa;
  padding: 18px 25px;
  border-radius: 6px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--text-primary);
}
.hero-blabla strong { color: var(--text-primary); font-weight: 600; }

.event-last-run {
  text-align: center;
  margin: -10px auto 25px auto;
  max-width: 450px;
  background: var(--bg);
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 13px;
  color: #334155;
  font-weight: 600;
  border: 1px solid var(--border);
}
.event-last-run strong { color: var(--text-primary); }

.event-info-context {
  font-size: 16px;
  color: var(--text-primary);
  font-weight: 600;
}
.event-info-context small {
  display: block;
  margin-top: 4px;
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
}

/* --- BUTTONS & CHIPS --- */
.chip-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}
.chip {
  flex: 1;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 12px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 14px;
  color: var(--text-primary);
  text-decoration: none;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  outline: none;
}
.chip.active {
  background: var(--text-primary);
  color: #FFF;
  border-color: var(--text-primary);
}
.chip-dashed {
  border: 1px dashed var(--border) !important;
  background: transparent !important;
}

.btn {
  width: 100%;
  text-align: center;
  box-sizing: border-box;
  padding: 8px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 3px;
  border: none;
  cursor: pointer;
}
.btn-primary { background: var(--text-primary); color: white; }
.btn-primary:hover { background: var(--primary); }
.btn-danger { background: var(--danger); color: white; text-decoration: none; display: block; }

/* --- FORMULARE & INPUTS --- */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 4px;
}
.form-group { margin-bottom: 0; }

label {
  display: block;
  font-size: 10px;
  font-weight: 600;
  margin-bottom: 1px;
  color: var(--text-secondary);
}

input[type="text"], input[type="date"], input[type="number"] {
  width: 100%;
  padding: 6px;
  border: 1px solid #cbd5e1;
  border-radius: 3px;
  box-sizing: border-box;
  font-size: 13px;
  background: #fff;
  color: var(--text-primary);
}

/* --- DASHBOARD / LEADERBOARD LISTE --- */
.leaderboard-list {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0,0,0,0.02);
  margin-bottom: 24px;
}
.list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.list-item:last-child { border-bottom: none; }
.left-content { display: flex; align-items: center; gap: 12px; }

.rank-num { font-size: 14px; font-weight: 900; width: 20px; color: var(--text-secondary); }
.avatar {
  width: 36px; height: 36px; background: #EFEFEF; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px; text-transform: uppercase;
}
.player-name { font-size: 15px; font-weight: 700; }
.player-meta { font-size: 11px; color: var(--text-secondary); margin-top: 1px; }
.score-badge { font-size: 16px; font-weight: 900; }

/* Podium Farben */
.pos-1 { background: #FFFDF0; }
.pos-1 .rank-num { color: #FFB800; }
.pos-1 .avatar { background: #FFB800; color: #FFF; }
.pos-1 .score-badge { color: #D49A00; }
.pos-2 { background: #F9F9FA; }
.pos-2 .rank-num { color: #95A5A6; }
.pos-2 .avatar { background: #95A5A6; color: #FFF; }
.pos-3 { background: #FCF7F3; }
.pos-3 .rank-num { color: #CD7F32; }
.pos-3 .avatar { background: #CD7F32; color: #FFF; }

.leaderboard-empty-state {
  padding: 24px 0;
  text-align: center;
  color: var(--text-secondary);
  font-size: 14px;
}

/* --- STATISTIKEN & CHARTS --- */
.stats-section { margin-top: 32px; }
.stats-title { font-size: 16px; font-weight: 900; margin-bottom: 12px; letter-spacing: -0.3px; }
.stats-grid { display: flex; gap: 12px; margin-bottom: 16px; }
.stat-card {
  flex: 1; background: var(--surface); border: 1px solid var(--border);
  padding: 16px; border-radius: 14px; display: flex; flex-direction: column; justify-content: space-between; gap: 16px;
}
.stat-lbl { font-size: 12px; color: var(--text-secondary); font-weight: 500; }
.stat-val { font-size: 24px; font-weight: 900; margin-top: 2px; }

.stat-split-bar { height: 6px; background: #EFEFEF; border-radius: 3px; overflow: hidden; display: flex; }
.split-becher { background: var(--primary); }
.split-trichter { background: var(--text-primary); }
.stat-split-lbl { display: flex; justify-content: space-between; font-size: 10px; color: var(--text-secondary); margin-top: 6px; font-weight: 500; }

.chart-box { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 16px; margin-bottom: 16px; position: relative; }
.chart-lbl { font-size: 13px; font-weight: 700; }
.chart-legend-hint { font-size: 11px; float: right; color: var(--text-secondary); }
.canvas-container { position: relative; height: 180px; width: 100%; margin-top: 12px; }
.legend-color-b { color: var(--primary); font-weight: bold; }
.legend-color-t { color: var(--text-primary); font-weight: bold; }
.stats-chip-hidden { display: none; }

/* --- MODALS (OVERLAYS) --- */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease-in-out;
}
.modal-overlay.open { opacity: 1; pointer-events: auto; }
.modal-box {
  background: var(--surface); padding: 24px; border-radius: 20px;
  width: 90%; max-width: 380px; text-align: center; box-shadow: 0 15px 35px rgba(0,0,0,0.15);
  animation: modalPop 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
@keyframes modalPop {
  from { transform: scale(0.85); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.modal-box h3 { font-size: 18px; font-weight: 900; margin-bottom: 6px; color: var(--text-primary); }
.modal-box p { font-size: 13px; color: var(--text-secondary); line-height: 1.4; margin-bottom: 8px; }
.modal-box label { text-align: left; text-transform: uppercase; margin-top: 12px; margin-bottom: 4px; }
.modal-box input {
  width: 100%; padding: 12px; border: 1px solid var(--border); background: var(--bg);
  border-radius: 10px; font-size: 16px; text-align: center; font-weight: 700; outline: none; color: var(--text-primary);
}
.modal-box input:focus { border-color: var(--text-primary); background: #FFF; }

.btn-submit {
  background: var(--primary); color: #FFF; border: none; width: 100%; padding: 14px;
  border-radius: 10px; font-weight: 700; font-size: 15px; margin-top: 20px; cursor: pointer; transition: background 0.2s;
}
.btn-submit:hover { background: #D60000; }
.btn-submit:disabled { background: #999; cursor: not-allowed; }

.close-modal { margin-top: 14px; display: inline-block; font-size: 13px; color: var(--text-secondary); cursor: pointer; text-decoration: underline; }
.close-modal:hover { color: var(--text-primary); }

/* --- MARGINS & HELPERS --- */
.view-picker-margin { margin-bottom: 15px; }
.game-picker-margin { margin-top: 15px; }
.modal-success-step { display: none; text-align: center; padding: 20px 0; }

/* --- ADMINTABELLE EINZEILER-ERWEITERUNG --- */
.event-switcher {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 4px;
}
.event-tab {
  padding: 6px; background: #fff; border: 1px solid var(--border); border-radius: 3px;
  text-decoration: none; color: var(--text-primary); font-weight: 500; text-align: center; font-size: 12px;
  text-overflow: ellipsis; white-space: nowrap; overflow: hidden;
}
.event-tab.active { background: var(--text-primary); color: white; border-color: var(--text-primary); }

.run-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 6px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 3px;
  margin-bottom: 4px;
}
.run-meta {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.2;
}
.run-time {
  font-size: 14px;
  padding: 0 4px;
  white-space: nowrap;
  color: var(--text-primary);
}
.action-zone {
  display: flex;
  align-items: center;
  gap: 4px;
}
.edit-box {
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
}
.inline-form {
  display: flex;
  gap: 4px;
}
.inline-form input[type="text"] {
  width: 80px;
  padding: 3px 5px;
  font-size: 12px;
}
.inline-form .btn-save {
  background: var(--success);
  color: white;
  border: none;
  border-radius: 3px;
  padding: 0 8px;
  font-weight: bold;
  cursor: pointer;
  height: 24px;
  font-size: 12px;
}
.btn-delete-compact {
  background: var(--danger);
  color: white;
  text-decoration: none;
  padding: 3px 8px;
  font-size: 12px;
  font-weight: bold;
  border-radius: 3px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

        .badge-no-event {
            background: var(--danger);
            color: white;
            font-size: 9px;
            font-weight: bold;
            padding: 1px 4px;
            border-radius: 3px;
            margin-left: 4px;
            text-transform: uppercase;
        }
