/* Infinity Cheerleader – Trainingskalender
   Apple-inspiriertes Schwarz-Lila Theme, mobile-first. */

:root {
  --bg:        #0a0a0f;
  --bg-2:      #12101a;
  --surface:   rgba(255, 255, 255, 0.05);
  --surface-2: rgba(255, 255, 255, 0.08);
  --border:    rgba(255, 255, 255, 0.10);
  --violet:    #a855f7;
  --violet-2:  #7c3aed;
  --violet-soft: rgba(168, 85, 247, 0.15);
  --grad:      linear-gradient(135deg, #7c3aed 0%, #a855f7 100%);
  --text:      #f5f5f7;
  --muted:     #a1a1aa;
  --danger:    #f43f5e;
  --radius:    18px;
  --radius-sm: 12px;
  --shadow:    0 20px 60px rgba(0, 0, 0, 0.5);
  --ease:      cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
}

.bg-glow {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 60% 50% at 50% -10%, rgba(124, 58, 237, 0.35), transparent 60%),
    radial-gradient(ellipse 50% 40% at 90% 10%, rgba(168, 85, 247, 0.18), transparent 60%);
}

.hidden { display: none !important; }
.muted { color: var(--muted); }

/* ---------- Buttons ---------- */
.btn {
  font: inherit;
  font-weight: 600;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0.72rem 1.3rem;
  cursor: pointer;
  transition: transform 0.15s var(--ease), background 0.2s var(--ease), opacity 0.2s;
  color: var(--text);
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.55; cursor: default; }
.btn-primary { background: var(--grad); color: #fff; box-shadow: 0 8px 24px rgba(124, 58, 237, 0.4); }
.btn-ghost { background: var(--surface); border-color: var(--border); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: 0.5rem 0.95rem; font-size: 0.85rem; }
.btn-icon { padding: 0.4rem 0.85rem; font-size: 1.3rem; line-height: 1; }
.btn-block { display: block; width: 100%; margin-top: 1rem; }

/* ---------- Brand ---------- */
.brand { text-align: center; margin-bottom: 1.5rem; }
.brand-mark {
  width: 64px; height: 64px; margin: 0 auto 0.75rem;
  display: grid; place-items: center;
  font-size: 2rem; font-weight: 700; color: #fff;
  border-radius: 20px; background: var(--grad);
  box-shadow: 0 10px 30px rgba(124, 58, 237, 0.5);
}
.brand-mark.small { width: 34px; height: 34px; border-radius: 11px; font-size: 1.15rem; box-shadow: none; }

/* Echtes Vereinslogo */
.brand-logo {
  display: block; width: 88px; height: 88px; margin: 0 auto 0.85rem;
  object-fit: contain;
  filter: drop-shadow(0 10px 24px rgba(124, 58, 237, 0.45));
}
.brand-logo.small {
  width: 34px; height: 34px; margin: 0;
  filter: none;
}
.brand h1 { margin: 0; font-size: 1.5rem; letter-spacing: -0.02em; }
.brand-sub { margin: 0.2rem 0 0; color: var(--muted); font-size: 0.95rem; }

/* ---------- Auth ---------- */
.auth-wrap {
  position: relative; z-index: 1;
  min-height: 100dvh;
  display: grid; place-items: center;
  padding: 1.5rem;
}
.auth-card {
  width: 100%; max-width: 400px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem 1.75rem;
  box-shadow: var(--shadow);
  animation: rise 0.5s var(--ease);
}
@keyframes rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }

.tabs {
  display: flex; gap: 0.25rem;
  background: var(--surface); border-radius: 999px;
  padding: 0.25rem; margin-bottom: 1.5rem;
}
.tab {
  flex: 1; border: 0; background: transparent; color: var(--muted);
  font: inherit; font-weight: 600; padding: 0.6rem; border-radius: 999px;
  cursor: pointer; transition: background 0.25s var(--ease), color 0.25s;
}
.tab.active { background: var(--grad); color: #fff; }

.auth-form { display: none; flex-direction: column; gap: 0.9rem; }
.auth-form.active { display: flex; animation: fade 0.3s var(--ease); }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.field { display: flex; flex-direction: column; gap: 0.35rem; }
.field > span { font-size: 0.82rem; color: var(--muted); font-weight: 600; }
.field-row { display: flex; gap: 0.75rem; }
.field-row .field { flex: 1; }

input, select, textarea {
  font: inherit; color: var(--text);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 0.75rem 0.9rem;
  transition: border-color 0.2s, background 0.2s;
  width: 100%;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--violet); background: var(--surface-2);
}
textarea { resize: vertical; }
input[type="date"], input[type="time"] { color-scheme: dark; }

.link-btn {
  background: none; border: 0; padding: 0.25rem; margin: 0.1rem auto 0;
  color: var(--muted); font: inherit; font-size: 0.85rem; cursor: pointer;
  text-decoration: underline; text-underline-offset: 2px;
  transition: color 0.2s var(--ease);
}
.link-btn:hover { color: var(--violet); }

.auth-message {
  display: none; margin: 1rem 0 0; text-align: center;
  font-size: 0.9rem; color: var(--muted);
}
.auth-message.visible { display: block; }
.auth-message.error { color: var(--danger); }

/* ---------- App / Topbar ---------- */
.app { position: relative; z-index: 1; min-height: 100dvh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 0.75rem;
  padding: 0.85rem 1rem;
  background: rgba(10, 10, 15, 0.72);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--border);
}
.topbar-brand { display: flex; align-items: center; gap: 0.6rem; font-weight: 700; }
.topbar-actions { display: flex; align-items: center; gap: 0.5rem; }
.user-badge { display: none; font-size: 0.85rem; color: var(--muted); }
@media (min-width: 640px) { .user-badge { display: inline-flex; align-items: center; gap: 0.4rem; } }
.role-pill { font-size: 0.68rem; font-weight: 700; padding: 0.12rem 0.5rem; border-radius: 999px; letter-spacing: 0.02em; }
.role-trainer { background: var(--violet-soft); color: var(--violet); }
.role-active { background: rgba(74, 222, 128, 0.15); color: #4ade80; }
.role-pending { background: rgba(251, 191, 36, 0.16); color: #fbbf24; }

/* ---------- Kalender ---------- */
.calendar-main { flex: 1; padding: 1rem; max-width: 1000px; width: 100%; margin: 0 auto; }
.pending-banner {
  margin-bottom: 1rem; padding: 0.85rem 1rem; border-radius: var(--radius-sm);
  font-size: 0.9rem; line-height: 1.45;
  color: #fbbf24; background: rgba(251, 191, 36, 0.12);
  border: 1px solid rgba(251, 191, 36, 0.28);
}
.calendar-toolbar { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 1rem; }
.calendar-title { flex: 1; margin: 0; font-size: 1.25rem; letter-spacing: -0.02em; }
.calendar-weekdays {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px;
  margin-bottom: 4px; font-size: 0.72rem; color: var(--muted); font-weight: 600; text-align: center;
}
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-cell {
  min-height: 78px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 4px; display: flex; flex-direction: column; gap: 3px;
  transition: background 0.2s;
}
.cal-cell.outside { opacity: 0.4; }
.cal-cell.clickable { cursor: pointer; }
.cal-cell.clickable:hover { background: var(--surface-2); }
.cal-cell.today { border-color: var(--violet); box-shadow: inset 0 0 0 1px var(--violet); }
.cal-daynum { font-size: 0.75rem; color: var(--muted); font-weight: 600; padding-left: 2px; }
.cal-cell.today .cal-daynum { color: var(--violet); }
.cal-events { display: flex; flex-direction: column; gap: 2px; overflow: hidden; }
.cal-event {
  text-align: left; border: 0; cursor: pointer;
  background: var(--violet-soft); color: var(--text);
  border-radius: 6px; padding: 3px 5px; font-size: 0.68rem; line-height: 1.25;
  display: flex; flex-direction: column; transition: background 0.15s, transform 0.15s;
}
.cal-event:hover { background: rgba(168, 85, 247, 0.3); transform: translateY(-1px); }
.cal-event-time { color: var(--violet); font-weight: 700; }
.cal-event-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

@media (max-width: 560px) {
  .cal-cell { min-height: 62px; }
  .cal-event-title { display: none; }
  .cal-event { align-items: center; padding: 2px; }
  .cal-event-time { font-size: 0.6rem; }
}

/* ---------- Modals ---------- */
.modal { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
@media (min-width: 640px) { .modal { align-items: center; } }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.6); opacity: 0; transition: opacity 0.25s var(--ease); }
.modal.open .modal-backdrop { opacity: 1; }
.modal-card {
  position: relative; z-index: 1;
  width: 100%; max-width: 460px; max-height: 92dvh; overflow-y: auto;
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: 22px 22px 0 0; padding: 1.75rem 1.5rem 1.5rem;
  box-shadow: var(--shadow);
  transform: translateY(24px); opacity: 0;
  transition: transform 0.28s var(--ease), opacity 0.28s var(--ease);
}
@media (min-width: 640px) { .modal-card { border-radius: 22px; } }
.modal.open .modal-card { transform: none; opacity: 1; }
.modal-close {
  position: absolute; top: 0.85rem; right: 0.95rem;
  width: 32px; height: 32px; border-radius: 999px; border: 0;
  background: var(--surface); color: var(--text); font-size: 1.3rem; line-height: 1; cursor: pointer;
}
.modal-delete {
  position: absolute; top: 0.85rem; left: 0.95rem;
  width: 32px; height: 32px; border-radius: 999px; border: 0;
  background: rgba(244, 63, 94, 0.14); font-size: 1rem; line-height: 1; cursor: pointer;
  transition: background 0.2s var(--ease), transform 0.15s var(--ease);
}
.modal-delete:hover { background: rgba(244, 63, 94, 0.28); }
.modal-delete:active { transform: scale(0.92); }
/* Titel Platz lassen, wenn links der Mülleimer sitzt */
#detail-body .modal-title { padding-left: 2.5rem; }
.modal-title { margin: 0 0 1rem; font-size: 1.3rem; letter-spacing: -0.02em; padding-right: 2rem; }

#training-form { display: flex; flex-direction: column; gap: 0.9rem; }
.form-actions { display: flex; gap: 0.6rem; margin-top: 0.5rem; }
.form-actions .btn-primary { flex: 1; }

.chips-select { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.chip {
  display: inline-flex; align-items: center; gap: 0.35rem;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 999px; padding: 0.4rem 0.8rem; font-size: 0.85rem; cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}
.chip.on { background: var(--violet-soft); border-color: var(--violet); color: var(--violet); }
.chip input { display: none; }

/* ---------- Detail ---------- */
.detail-meta { display: flex; flex-direction: column; gap: 0.55rem; margin-bottom: 1rem; }
.meta-row { display: flex; align-items: center; gap: 0.65rem; font-size: 0.95rem; }
.meta-ico { width: 1.4rem; text-align: center; }
.detail-desc { color: var(--muted); line-height: 1.5; margin: 0 0 1rem; }
.detail-count { font-size: 0.9rem; color: var(--muted); margin-bottom: 0.25rem; }
.detail-count span { color: var(--violet); font-weight: 700; }
.full-note {
  margin: 1rem 0 0; text-align: center; font-weight: 600;
  color: var(--danger);
  background: rgba(244, 63, 94, 0.12); border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
}

.participants { margin-top: 1.25rem; border-top: 1px solid var(--border); padding-top: 1rem; }
.participants-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.5rem; }
.participants-head h4 { margin: 0; font-size: 1rem; }
.participant-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.35rem; }
.participant-list li { display: flex; justify-content: space-between; gap: 1rem; font-size: 0.9rem; padding: 0.45rem 0.6rem; background: var(--surface); border-radius: 8px; }
.detail-trainer-actions { margin-top: 1rem; }

/* ---------- Auth-Gate / Spinner ---------- */
.auth-gate { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; }
.spinner {
  width: 38px; height: 38px; border-radius: 50%;
  border: 3px solid var(--surface-2); border-top-color: var(--violet);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Footer ---------- */
.site-footer {
  position: relative; z-index: 1;
  text-align: center; padding: 1.5rem 1rem; color: var(--muted); font-size: 0.8rem;
}
.page-calendar .site-footer { border-top: 1px solid var(--border); }
