/* ============================================================
   SportLink Web-App — Styles (zusätzlich zu style.css)
   ============================================================ */

body { background: var(--paper); }

.brand-sub {
  color: var(--ink-soft);
  font-weight: 600;
  font-size: 0.95rem;
}

/* ---------- Authentifizierung ---------- */

.auth-wrap {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.2rem;
  overflow-y: auto;
  background: rgba(8, 12, 24, 0.62);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.auth-wrap[hidden] { display: none; }
.auth-card { position: relative; }
.auth-card {
  width: min(430px, 100%);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow-lift);
  padding: 1.8rem 1.6rem;
}
.auth-card h2 { font-size: 1.3rem; margin-top: 1.2rem; }
.auth-card .sub { color: var(--ink-soft); font-size: 0.93rem; margin-bottom: 1.2rem; }
.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  background: #e8ecf3;
  border-radius: 999px;
  padding: 4px;
}
.auth-tabs button {
  border: 0;
  background: transparent;
  font: inherit;
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--ink-soft);
  padding: 0.55rem 1rem;
  border-radius: 999px;
  cursor: pointer;
}
.auth-tabs button[aria-selected="true"] {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.12);
}
.link-btn {
  background: none;
  border: none;
  color: var(--accent-strong);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  padding: 0;
}

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-weight: 700;
  font-size: 0.88rem;
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
}

/* ---------- App-Shell ---------- */

.app-shell {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 64px);
  transition: width 0.32s cubic-bezier(0.22, 0.8, 0.3, 1);
}
.app-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  padding: 0.7rem 1rem;
  background: #fff;
  border-bottom: 1px solid var(--line);
}
.app-tabs button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border: 0;
  background: transparent;
  font: inherit;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--ink-soft);
  padding: 0.65rem 0.5rem;
  border-radius: 12px;
  cursor: pointer;
}
.app-tabs button[aria-selected="true"] {
  background: var(--accent-soft);
  color: var(--accent-strong);
}
.app-main { flex: 1; min-height: 0; position: relative; }
.app-view { position: absolute; inset: 0; overflow-y: auto; padding: 1.2rem; }
.view-title { font-size: 1.25rem; margin: 0 0 1rem; }

/* ---------- Karte ---------- */

#view-map { padding: 0; overflow: hidden; }
.map-canvas { position: absolute; inset: 0; z-index: 0; }
.map-hint {
  position: absolute;
  z-index: 1;
  left: 1rem;
  bottom: 1rem;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.5rem 1rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink-soft);
  box-shadow: var(--shadow);
}
.map-pin {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  box-shadow: 0 4px 10px rgba(2, 6, 23, 0.4);
  font-size: 1rem;
}
.map-pin span { transform: rotate(45deg); }
.leaflet-popup-content { font-family: var(--font); }
.popup-title { font-weight: 800; margin: 0 0 0.25rem; }
.popup-meta { color: var(--ink-soft); font-size: 0.85rem; margin: 0 0 0.6rem; }

/* ---------- Aktivitäten ---------- */

.activity-list { display: grid; gap: 0.9rem; max-width: 720px; }
.activity-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 1rem 1.2rem;
  box-shadow: var(--shadow);
  display: grid;
  gap: 0.4rem;
}
.activity-card .top { display: flex; justify-content: space-between; gap: 1rem; align-items: baseline; }
.activity-card h3 { margin: 0; font-size: 1.02rem; }
.activity-card .meta { color: var(--ink-soft); font-size: 0.88rem; }
.activity-card .actions { display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: center; }
.activity-card .result { font-size: 0.88rem; font-weight: 700; color: var(--accent-strong); }
.activity-card .result.warn { color: #b45309; }

/* ---------- Chat ---------- */

#view-chat { padding: 0; overflow: hidden; }
.chat-layout { position: absolute; inset: 0; display: flex; }
.chat-list-pane {
  width: 100%;
  padding: 1.2rem;
  overflow-y: auto;
  border-right: 1px solid var(--line);
  background: #fff;
}
.chat-messages-pane {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--paper);
}
.conversation-list { display: grid; gap: 0.6rem; max-width: 420px; }
.conversation-item {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: var(--radius-sm);
  padding: 0.8rem 1rem;
  cursor: pointer;
  font: inherit;
}
.conversation-item:hover { border-color: var(--accent); }
.conversation-item .avatar {
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
}
.conversation-item .name { font-weight: 700; }
.conversation-item .last { color: var(--ink-faint); font-size: 0.8rem; }

.chat-back { margin: 1.2rem 1.2rem 0; align-self: flex-start; }
#chat-title { padding: 0.6rem 1.2rem 0; margin-bottom: 0.4rem; }
.messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.message {
  max-width: min(75%, 480px);
  padding: 0.6rem 0.9rem;
  border-radius: 16px;
  font-size: 0.95rem;
  line-height: 1.45;
  background: #fff;
  border: 1px solid var(--line);
  align-self: flex-start;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
}
.message.mine {
  align-self: flex-end;
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.message .sender { font-size: 0.72rem; font-weight: 800; opacity: 0.75; margin-bottom: 0.15rem; }
.message .time { font-size: 0.68rem; opacity: 0.6; margin-top: 0.2rem; }
.message-form {
  display: flex;
  gap: 0.6rem;
  padding: 0.9rem 1.2rem;
  background: #fff;
  border-top: 1px solid var(--line);
}
.message-form input {
  flex: 1;
  padding: 0.75rem 1rem;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  font: inherit;
}
.message-form input:focus {
  outline: none;
  border-color: var(--accent);
}
.empty-note { color: var(--ink-faint); font-size: 0.92rem; }

/* ---------- Desktop ---------- */

@media (min-width: 900px) {
  .app-shell { max-width: none; }
  .app-tabs { justify-content: center; }
  .app-tabs button { padding-inline: 2.2rem; }
  .activity-list, .conversation-list { margin-inline: auto; }
  .chat-list-pane { width: 340px; }
  .chat-back { display: none; }

  /* 50/50-Split:-offenes Detail rechts, Liste links bleibt aktiv. */
  .detail-backdrop { display: none; }
  body.detail-open .app-shell { width: 50vw; }
  body.detail-open .activity-list,
  body.detail-open .activity-toolbar { max-width: none; margin-inline: 0; }
}

@media (max-width: 899px) {
  .chat-messages-pane { position: absolute; inset: 0; z-index: 5; }
}

/* ---------- Gast-Modus & Login-Overlay ---------- */

.auth-reason {
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-weight: 700;
  font-size: 0.92rem;
  border-radius: 10px;
  padding: 0.7rem 0.9rem;
  margin: 0 0 1rem;
}

.guest-note {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 1.4rem;
  display: grid;
  gap: 0.5rem;
  max-width: 420px;
}
.guest-note p { margin: 0; color: var(--ink-soft); }
.guest-note .btn { justify-self: start; }
.guest-note .hint { font-size: 0.85rem; color: var(--ink-faint); }

/* App-Header zeigt Login/Abmelden auch auf kleinen Bildschirmen. */
.header-actions { display: flex; gap: 0.6rem; align-items: center; }

/* ---------- Karte: Sportfilter (wie SportFilterMenu der App) ---------- */

#view-map { padding: 0; overflow: hidden; }
.map-toolbar {
  position: absolute;
  z-index: 1;
  top: 1rem;
  left: 1rem;
  right: 1rem;
  display: flex;
  pointer-events: none;
}
.sport-pill {
  pointer-events: auto;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.4rem;
  box-shadow: var(--shadow);
  max-width: 100%;
}
.sport-pill button {
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--ink-soft);
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
}
.sport-pill button.active {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

/* ---------- Aktivitäten: Suchleiste + Filter ---------- */

.activity-toolbar { max-width: 720px; margin-bottom: 1.2rem; }
.activity-toolbar input[type="search"] {
  width: 100%;
  padding: 0.7rem 1rem;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  font: inherit;
  margin-bottom: 0.6rem;
  background: #fff;
}
.activity-toolbar input[type="search"]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(22, 163, 74, 0.14);
}
.activity-filters { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.activity-filters select {
  flex: 1 1 auto;
  min-width: 130px;
  padding: 0.55rem 0.7rem;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ink);
  background: #fff;
}
.activity-filters select:focus { outline: none; border-color: var(--accent); }

.section-subtitle {
  font-size: 1.02rem;
  font-weight: 800;
  margin: 1.4rem 0 0.6rem;
  color: var(--ink);
}
.activity-card .activity-card { border: 0; padding: 0; box-shadow: none; background: transparent; }

/* Filter-Zeile mit Gast-Hinweis rechts */
.activity-toolbar-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
}
.activity-toolbar-row .activity-filters { flex: 1 1 auto; }
.guest-hint {
  margin: 0;
  font-size: 0.84rem;
  color: var(--ink-faint);
  font-weight: 600;
  white-space: nowrap;
}
@media (max-width: 720px) {
  .guest-hint { white-space: normal; }
}

/* ---------- Aktivitaetskarten: einheitlich, klickbar, Kurzinfo ---------- */

.activity-card-link {
  cursor: pointer;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
  min-height: 0;
}
.activity-card-link:hover,
.activity-card-link:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 8px 24px rgba(22, 163, 74, 0.16);
  outline: none;
}
.activity-card-link .card-desc {
  color: var(--ink-soft);
  font-size: 0.92rem;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.activity-card-link .open-hint {
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--accent-strong);
  justify-self: end;
}
.activity-list .activity-card { grid-auto-rows: auto; }

/* ---------- Detailansicht ---------- */

.detail-desc { color: var(--ink-soft); font-size: 0.96rem; margin: 0 0 0.9rem; }
.detail-info-list {
  list-style: none;
  margin: 1rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.45rem;
  font-size: 0.92rem;
  color: var(--ink-soft);
}
.detail-subtitle { font-size: 1rem; font-weight: 800; margin: 1.2rem 0 0.5rem; }
.detail-events { display: grid; gap: 0.6rem; }
.detail-event {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.8rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.7rem 0.9rem;
}
.detail-event .meta { display: block; color: var(--ink-soft); font-size: 0.84rem; }
.detail-event .btn { flex: none; }

/* ---------- Aktivitaets-Detail: Seitenansicht rechts mit Mini-Karte ---------- */

.detail-backdrop {
  position: fixed;
  inset: 0;
  z-index: 150;
  background: rgba(8, 12, 24, 0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.28s ease;
}
.detail-backdrop.show {
  opacity: 1;
  pointer-events: auto;
}
.detail-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(50vw, 620px);
  z-index: 160;
  background: #fff;
  box-shadow: -18px 0 45px rgba(15, 23, 42, 0.25);
  display: flex;
  flex-direction: column;
  transform: translateX(102%);
  transition: transform 0.32s cubic-bezier(0.22, 0.8, 0.3, 1);
}
.detail-panel.open {
  transform: translateX(0);
}
.detail-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 1.8rem 1.6rem 1.2rem;
  position: relative;
}
.detail-map-wrap {
  height: 34%;
  min-height: 220px;
  position: relative;
  border-top: 1px solid var(--line);
  flex: none;
}
#detail-map {
  position: absolute;
  inset: 0;
  z-index: 0;
}
.detail-map-hint {
  position: absolute;
  left: 10px;
  bottom: 10px;
  z-index: 1;
  margin: 0;
  background: rgba(255, 255, 255, 0.92);
  border-radius: 999px;
  padding: 0.3rem 0.8rem;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--ink-soft);
  box-shadow: var(--shadow);
}
@media (max-width: 899px) {
  .detail-panel { width: 100vw; }
}
@media (prefers-reduced-motion: reduce) {
  .detail-panel, .detail-backdrop { transition: none; }
}
