/* ============================================================
   Bogenschießen App – Stylesheet
   Mobile/Tablet-First Design
   ============================================================ */

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

:root {
  /* Farben */
  --bg:          #0f172a;
  --bg-card:     #1e293b;
  --bg-input:    #0f172a;
  --border:      #334155;
  --text:        #e2e8f0;
  --text-muted:  #94a3b8;
  --accent:      #3b82f6;
  --accent-dark: #2563eb;
  --green:       #10b981;
  --red:         #ef4444;
  --orange:      #f59e0b;
  --purple:      #8b5cf6;

  /* Bogenarten */
  --bow-recurve:     #3b82f6;
  --bow-compound:    #10b981;
  --bow-longbow:     #f59e0b;
  --bow-barebow:     #8b5cf6;
  --bow-traditional: #f97316;

  /* Layout */
  --toolbar-h: 60px;
  --sidebar-w: 260px;
  --radius:    10px;
  --shadow:    0 4px 20px rgba(0,0,0,.35);
}

html { height: 100%; }
body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-tap-highlight-color: transparent;
}

/* ── Toolbar ── */
.toolbar {
  position: fixed; top: 0; left: 0; right: 0;
  height: var(--toolbar-h);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 16px; gap: 12px;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,.3);
}
.toolbar-logo { font-size: 20px; font-weight: 800; color: var(--accent); text-decoration: none; display: flex; align-items: center; gap: 8px; }
.toolbar-title { font-size: 16px; font-weight: 600; flex: 1; }
.toolbar-actions { display: flex; gap: 8px; margin-left: auto; }

/* ── Layout ── */
.page-wrap {
  padding-top: var(--toolbar-h);
  min-height: 100%;
}
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 20px 16px;
}

/* ── Cards ── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}
.card-title {
  font-size: 15px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
  margin-bottom: 14px;
}

/* ── Grid ── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 16px; }
@media (max-width: 600px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 20px;
  border-radius: 8px; border: none;
  font-size: 14px; font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: opacity .15s, transform .1s;
  white-space: nowrap;
}
.btn:active { transform: scale(.97); }
.btn-primary   { background: var(--accent);     color: #fff; }
.btn-success   { background: var(--green);      color: #fff; }
.btn-danger    { background: var(--red);        color: #fff; }
.btn-warning   { background: var(--orange);     color: #fff; }
.btn-secondary { background: var(--border);     color: var(--text); }
.btn-ghost     { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn:hover     { opacity: .85; }
.btn:disabled  { opacity: .4; cursor: not-allowed; }
.btn-lg        { padding: 14px 28px; font-size: 16px; border-radius: 10px; }
.btn-sm        { padding: 6px 12px;  font-size: 13px; }
.btn-icon      { width: 38px; height: 38px; padding: 0; border-radius: 8px; }
.btn-full      { width: 100%; }

/* ── Formulare ── */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 13px; color: var(--text-muted); margin-bottom: 6px; font-weight: 500; }
.form-control {
  width: 100%; padding: 10px 14px;
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text); font-size: 15px;
  outline: none; transition: border-color .15s;
}
.form-control:focus { border-color: var(--accent); }
select.form-control { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M0 0l6 8 6-8z' fill='%2394a3b8'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }

/* ── Score-Eingabe Buttons (groß für Tablet) ── */
.score-grid {
  display: grid;
  gap: 8px;
}
.score-grid-wa  { grid-template-columns: repeat(6, 1fr); }
.score-grid-3d  { grid-template-columns: repeat(5, 1fr); }

.score-btn {
  aspect-ratio: 1;
  border: 2px solid transparent;
  border-radius: 10px;
  font-size: clamp(18px, 4vw, 28px);
  font-weight: 800;
  cursor: pointer;
  transition: transform .1s, border-color .1s;
  display: flex; align-items: center; justify-content: center;
  touch-action: manipulation;
}
.score-btn:active { transform: scale(.93); }
.score-btn.selected { border-color: #fff; transform: scale(1.05); }

/* Score-Farben WA */
.score-miss  { background: #374151; color: #9ca3af; }
.score-1-3   { background: #1d4ed8; color: #bfdbfe; }
.score-4-5   { background: #1d4ed8; color: #bfdbfe; }
.score-6-7   { background: #1d4ed8; color: #bfdbfe; }
.score-8-9   { background: #1e3a5f; color: #93c5fd; }
.score-10    { background: #fbbf24; color: #1c1917; }
.score-x     { background: #fbbf24; color: #1c1917; border: 2px solid #f59e0b; }

/* Score-Farben 3D */
.score-3d-0  { background: #374151; color: #9ca3af; }
.score-3d-5  { background: #7c3aed; color: #e9d5ff; }
.score-3d-8  { background: #1d4ed8; color: #bfdbfe; }
.score-3d-10 { background: #059669; color: #a7f3d0; }
.score-3d-11 { background: #fbbf24; color: #1c1917; }

/* ── Schützen-Avatar ── */
.archer-avatar {
  width: 48px; height: 48px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 16px; flex-shrink: 0;
  overflow: hidden;
}
.archer-avatar img { width: 100%; height: 100%; object-fit: cover; }
.archer-avatar-lg { width: 72px; height: 72px; font-size: 22px; }
.archer-avatar-xl { width: 96px; height: 96px; font-size: 28px; }

/* ── Bow-Type Badge ── */
.bow-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 20px; font-size: 12px; font-weight: 600;
}
.bow-recurve    { background: rgba(59,130,246,.2);  color: #93c5fd; }
.bow-compound   { background: rgba(16,185,129,.2);  color: #6ee7b7; }
.bow-longbow    { background: rgba(245,158,11,.2);  color: #fcd34d; }
.bow-barebow    { background: rgba(139,92,246,.2);  color: #c4b5fd; }
.bow-traditional{ background: rgba(249,115,22,.2);  color: #fed7aa; }

/* ── Tabellen ── */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--border); font-size: 14px; }
.table th { color: var(--text-muted); font-weight: 600; font-size: 12px; text-transform: uppercase; }
.table tr:hover td { background: rgba(255,255,255,.03); }

/* ── Badges / Tags ── */
.badge { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.badge-green  { background: rgba(16,185,129,.2);  color: #6ee7b7; }
.badge-blue   { background: rgba(59,130,246,.2);  color: #93c5fd; }
.badge-orange { background: rgba(245,158,11,.2);  color: #fcd34d; }
.badge-red    { background: rgba(239,68,68,.2);   color: #fca5a5; }
.badge-gray   { background: rgba(148,163,184,.15);color: #94a3b8; }

/* ── Achievement-Karte ── */
.achievement {
  display: flex; align-items: center; gap: 12px;
  padding: 12px; border-radius: 10px;
  background: rgba(255,255,255,.04);
  border: 1px solid var(--border);
}
.achievement.earned { border-color: rgba(245,158,11,.4); background: rgba(245,158,11,.06); }
.achievement.secret { opacity: .5; filter: grayscale(.5); }
.achievement-icon  { font-size: 28px; width: 42px; text-align: center; flex-shrink: 0; }
.achievement-name  { font-weight: 700; font-size: 14px; }
.achievement-desc  { font-size: 12px; color: var(--text-muted); }
.achievement-date  { font-size: 11px; color: var(--orange); margin-top: 2px; }

/* ── Notifications / Toast ── */
#toast-container {
  position: fixed; bottom: 20px; right: 20px;
  z-index: 9999; display: flex; flex-direction: column; gap: 8px;
}
.toast {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 10px; padding: 12px 16px;
  font-size: 14px; max-width: 320px;
  animation: slideIn .3s ease;
  box-shadow: var(--shadow);
  display: flex; align-items: center; gap: 10px;
}
.toast.achievement-toast { border-color: rgba(245,158,11,.5); background: rgba(245,158,11,.1); }
@keyframes slideIn { from { transform: translateX(100%); opacity:0; } to { transform: translateX(0); opacity:1; } }

/* ── Aktive Session Banner ── */
.session-banner {
  background: linear-gradient(135deg, var(--accent), var(--purple));
  border-radius: 12px; padding: 16px 20px;
  display: flex; align-items: center; gap: 16px;
  margin-bottom: 20px;
}
.session-banner-info { flex: 1; }
.session-banner-title { font-size: 18px; font-weight: 800; }
.session-banner-meta  { font-size: 13px; opacity: .85; }

/* ── Fortschrittsbalken ── */
.progress-bar-wrap { height: 8px; background: var(--border); border-radius: 4px; overflow: hidden; }
.progress-bar      { height: 100%; border-radius: 4px; transition: width .4s; }

/* ── Scoreboard (große Anzeige während Session) ── */
.scoreboard {
  display: grid; gap: 12px;
}
.scoreboard-row {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 12px; padding: 14px 16px;
  display: flex; align-items: center; gap: 14px;
  transition: border-color .2s;
}
.scoreboard-row.current-archer { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(59,130,246,.25); }
.scoreboard-rank  { font-size: 22px; font-weight: 900; width: 32px; text-align: center; color: var(--text-muted); }
.scoreboard-rank.first  { color: #fbbf24; }
.scoreboard-rank.second { color: #94a3b8; }
.scoreboard-rank.third  { color: #cd7c4b; }
.scoreboard-name  { flex: 1; font-weight: 700; font-size: 16px; }
.scoreboard-score { font-size: 26px; font-weight: 900; color: var(--accent); min-width: 60px; text-align: right; }
.scoreboard-ends  { font-size: 12px; color: var(--text-muted); text-align: right; }

/* ── Statistik-Karte ── */
.stat-card { text-align: center; padding: 20px 12px; }
.stat-value { font-size: 36px; font-weight: 900; color: var(--accent); line-height: 1; }
.stat-label { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; margin-top: 4px; }

/* ── Alerts ── */
.alert { padding: 12px 16px; border-radius: 8px; font-size: 14px; margin-bottom: 12px; }
.alert-success { background: rgba(16,185,129,.15); border: 1px solid rgba(16,185,129,.4); color: #6ee7b7; }
.alert-error   { background: rgba(239,68,68,.15);  border: 1px solid rgba(239,68,68,.4);  color: #fca5a5; }
.alert-info    { background: rgba(59,130,246,.1);  border: 1px solid rgba(59,130,246,.3); color: #93c5fd; }

/* ── Responsive ── */
@media (max-width: 768px) {
  :root { --toolbar-h: 56px; }
  .container { padding: 14px 12px; }
  .card { padding: 16px; }
  .score-btn { font-size: clamp(20px, 6vw, 32px); }
  .scoreboard-score { font-size: 22px; }
  .hide-mobile { display: none !important; }
}

/* ── Print ── */
@media print {
  .toolbar, .btn-primary, .btn-danger { display: none !important; }
  body { background: white; color: black; }
  .card { border: 1px solid #ccc; box-shadow: none; }
}
