/* ═══════════════════════════════════════════════
   VEREINS-APP – Mobile-first App Shell
   ═══════════════════════════════════════════════ */

:root {
  --primary:      #4f46e5;
  --primary-dk:   #3730a3;
  --primary-lt:   #ede9fe;
  --success:      #10b981;
  --success-lt:   #d1fae5;
  --danger:       #ef4444;
  --danger-lt:    #fee2e2;
  --warning:      #f59e0b;
  --warning-lt:   #fef3c7;
  --gray-50:      #f8fafc;
  --gray-100:     #f1f5f9;
  --gray-200:     #e2e8f0;
  --gray-300:     #cbd5e1;
  --gray-400:     #94a3b8;
  --gray-500:     #64748b;
  --gray-600:     #475569;
  --gray-700:     #334155;
  --gray-900:     #0f172a;
  --header-h:     54px;
  --bottom-h:     62px;
  --r:            12px;
  --r-sm:         8px;
}

/* ── Reset ──────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; }
body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--gray-50);
  color: var(--gray-900);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;
}

/* ── App Shell ──────────────────────────────────── */
#app {
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

/* ── Header ─────────────────────────────────────── */
.hdr {
  height: var(--header-h);
  background: #fff;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem;
  flex-shrink: 0;
  position: relative;
  z-index: 50;
}
.hdr-brand {
  font-size: 1rem;
  font-weight: 800;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: .45rem;
  letter-spacing: -.2px;
}
.hdr-right { display: flex; align-items: center; gap: .5rem; }

/* ── Scroll Area ────────────────────────────────── */
#main-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding: 1rem;
  /* Platz für FAB + Bottom-Nav */
  padding-bottom: calc(var(--bottom-h) + 4.5rem);
}

/* ── Bottom Nav ─────────────────────────────────── */
.bnav {
  height: var(--bottom-h);
  background: #fff;
  border-top: 1px solid var(--gray-200);
  display: flex;
  align-items: stretch;
  flex-shrink: 0;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.bnav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--gray-400);
  font-size: .65rem;
  font-weight: 600;
  padding: 0;
  position: relative;
  transition: color .15s;
  -webkit-tap-highlight-color: transparent;
}
.bnav-btn i { font-size: 1.2rem; transition: transform .15s; }
.bnav-btn.active { color: var(--primary); }
.bnav-btn.active i { transform: translateY(-1px); }
.bnav-btn.active::after {
  content: '';
  position: absolute;
  top: 0; left: 25%; right: 25%;
  height: 2.5px;
  background: var(--primary);
  border-radius: 0 0 3px 3px;
}

/* ── FAB ────────────────────────────────────────── */
.fab {
  position: fixed;
  bottom: calc(var(--bottom-h) + .75rem);
  right: 1rem;
  width: 3rem; height: 3rem;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  box-shadow: 0 4px 18px rgba(79,70,229,.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 80;
  transition: transform .15s, box-shadow .15s;
}
.fab:active { transform: scale(.92); box-shadow: 0 2px 8px rgba(79,70,229,.3); }

/* ── Animations ─────────────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes slideUp {
  from { transform: translateY(50px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}
@keyframes spin { to { transform: rotate(360deg); } }

.view { animation: fadeUp .2s ease both; }

/* ── Loader ─────────────────────────────────────── */
.loader {
  display: inline-block;
  width: 1.4rem; height: 1.4rem;
  border-radius: 50%;
  border: 2.5px solid var(--gray-200);
  border-top-color: var(--primary);
  animation: spin .6s linear infinite;
}
.loading {
  display: flex; align-items: center; justify-content: center;
  padding: 3rem; flex-direction: column; gap: .75rem;
  color: var(--gray-400); font-size: .875rem;
}

/* ── Toast ──────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: calc(var(--bottom-h) + .6rem);
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex; flex-direction: column; align-items: center; gap: .35rem;
  pointer-events: none;
  width: max-content;
  max-width: calc(100vw - 2rem);
}
.toast {
  padding: .6rem 1.1rem;
  border-radius: 99px;
  color: #fff;
  font-weight: 600; font-size: .82rem;
  box-shadow: 0 4px 16px rgba(0,0,0,.2);
  animation: fadeUp .18s ease;
  white-space: nowrap;
}
.toast-success { background: var(--success); }
.toast-error   { background: var(--danger); }
.toast-info    { background: var(--primary); }

/* ── Avatar ─────────────────────────────────────── */
.av {
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; flex-shrink: 0;
}
.av-sm { width: 1.75rem; height: 1.75rem; font-size: .68rem; }
.av-md { width: 2.25rem; height: 2.25rem; font-size: .82rem; }
.av-lg { width: 3rem;    height: 3rem;    font-size: 1.05rem; }
.av-xl { width: 3.75rem; height: 3.75rem; font-size: 1.3rem; }

/* ── Button ─────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .55rem 1rem;
  border-radius: 99px;
  border: none;
  font-weight: 700; font-size: .82rem;
  cursor: pointer; white-space: nowrap;
  transition: all .15s;
  -webkit-tap-highlight-color: transparent;
}
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn:active:not(:disabled) { transform: scale(.96); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-dk); }
.btn-success { background: var(--success); color: #fff; }
.btn-danger  { background: var(--danger);  color: #fff; }
.btn-ghost   { background: var(--gray-100); color: var(--gray-700); border: 1.5px solid var(--gray-200); }
.btn-ghost:hover:not(:disabled) { background: var(--gray-200); }
.btn-sm   { padding: .38rem .8rem; font-size: .75rem; }
.btn-icon {
  width: 2rem; height: 2rem; padding: 0;
  border-radius: 50%; justify-content: center;
  background: var(--gray-100); color: var(--gray-500);
  border: 1.5px solid var(--gray-200);
}
.btn-icon:hover { background: var(--gray-200); }
.btn-icon.danger { color: var(--danger); }
.btn-full { width: 100%; justify-content: center; border-radius: var(--r-sm); padding: .7rem; }

/* ── Card ───────────────────────────────────────── */
.card {
  background: #fff;
  border-radius: var(--r);
  border: 1px solid var(--gray-200);
  overflow: hidden;
}

/* ── Form ───────────────────────────────────────── */
.fg { margin-bottom: .85rem; }
.fg:last-child { margin-bottom: 0; }
.lbl {
  display: block;
  font-size: .72rem; font-weight: 700;
  color: var(--gray-500);
  text-transform: uppercase; letter-spacing: .5px;
  margin-bottom: .3rem;
}
.inp {
  width: 100%;
  padding: .65rem .85rem;
  border-radius: var(--r-sm);
  border: 1.5px solid var(--gray-200);
  font-size: .9rem; outline: none;
  background: #fff; color: var(--gray-900);
  transition: border .15s, box-shadow .15s;
  -webkit-appearance: none;
}
.inp:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,70,229,.1); }
textarea.inp { resize: vertical; min-height: 72px; }
.hint { font-size: .72rem; color: var(--gray-400); margin-top: .25rem; }

/* ── Divider ────────────────────────────────────── */
.divider {
  display: flex; align-items: center; gap: .6rem;
  color: var(--gray-400); font-size: .75rem; margin: .9rem 0;
}
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--gray-200); }

/* ── Section header ─────────────────────────────── */
.sec-hdr { display: flex; align-items: center; justify-content: space-between; margin-bottom: .65rem; }
.sec-ttl { font-size: .95rem; font-weight: 800; color: var(--gray-900); }

/* ── Badge ──────────────────────────────────────── */
.bdg {
  display: inline-flex; align-items: center; gap: .2rem;
  padding: .18rem .52rem; border-radius: 99px;
  font-size: .68rem; font-weight: 700;
}
.bdg-green  { background: var(--success-lt); color: #065f46; }
.bdg-red    { background: var(--danger-lt);  color: #991b1b; }
.bdg-gray   { background: var(--gray-100);   color: var(--gray-500); }
.bdg-blue   { background: var(--primary-lt); color: var(--primary-dk); }
.bdg-orange { background: var(--warning-lt); color: #92400e; }

/* ── Empty state ─────────────────────────────────── */
.empty {
  text-align: center; padding: 2.5rem 1rem; color: var(--gray-400);
}
.empty i { font-size: 2.2rem; margin-bottom: .6rem; display: block; opacity: .5; }
.empty p { font-size: .875rem; }

/* ══════════════════════════════════════════════════
   AUTH
   ══════════════════════════════════════════════════ */
.auth-bg {
  height: 100dvh;
  overflow-y: auto;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(145deg, #6366f1 0%, #8b5cf6 100%);
  padding: 1.25rem;
}
.auth-card {
  background: #fff;
  border-radius: 1.25rem;
  padding: 1.75rem;
  width: 100%; max-width: 370px;
  box-shadow: 0 20px 60px rgba(0,0,0,.2);
  animation: fadeUp .25s ease;
}
.auth-icon {
  width: 3.2rem; height: 3.2rem;
  background: var(--primary-lt);
  border-radius: .9rem;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto .85rem;
  font-size: 1.4rem; color: var(--primary);
}
.auth-title { font-size: 1.2rem; font-weight: 800; text-align: center; color: var(--gray-900); }
.auth-sub   { font-size: .82rem; text-align: center; color: var(--gray-400); margin: .2rem 0 1.25rem; }

/* ══════════════════════════════════════════════════
   CALENDAR
   ══════════════════════════════════════════════════ */
.cal-nav {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: .75rem;
}
.cal-nav-lbl {
  font-size: 1rem; font-weight: 800; color: var(--gray-900);
}

/* Grid */
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background: var(--gray-200);
  border-radius: var(--r);
  overflow: hidden;
  border: 1px solid var(--gray-200);
}
.cal-dow {
  background: var(--primary);
  color: rgba(255,255,255,.9);
  text-align: center;
  padding: .4rem 0;
  font-size: .65rem; font-weight: 700;
  letter-spacing: .4px;
}

/* Day cell */
.cal-cell {
  background: #fff;
  min-height: 72px;
  padding: .3rem .25rem .25rem;
  cursor: pointer;
  transition: background .1s;
  position: relative;
  overflow: hidden;
}
.cal-cell:active { background: var(--gray-50); }
.cal-cell.other  { background: #fafafa; }
.cal-cell.today  { background: #faf5ff; }

.cal-num {
  font-size: .72rem; font-weight: 600;
  line-height: 1;
  color: var(--gray-400);
  margin-bottom: .2rem;
}
.cal-cell.other  .cal-num { color: var(--gray-200); }
.cal-cell.today  .cal-num {
  color: #fff;
  background: var(--primary);
  width: 1.35rem; height: 1.35rem;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .65rem; font-weight: 800;
}

/* Event chips in cell */
.cal-events { display: flex; flex-direction: column; gap: 2px; }

.cal-chip {
  border-radius: 3px;
  padding: 1px 3px;
  font-size: .6rem; font-weight: 600;
  line-height: 1.45;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  cursor: pointer;
}
.cal-chip.yes  { background: var(--success-lt); color: #065f46; }
.cal-chip.no   { background: var(--danger-lt);  color: #991b1b; }
.cal-chip.open { background: var(--primary-lt); color: var(--primary-dk); }

/* On very small screens (< 360px): dots instead of text */
@media (max-width: 359px) {
  .cal-cell { min-height: 52px; padding: .25rem .2rem; }
  .cal-chip { width: 7px; height: 7px; border-radius: 50%; padding: 0; font-size: 0; }
  .cal-events { flex-direction: row; flex-wrap: wrap; gap: 2px; margin-top: 2px; }
  .cal-chip.yes  { background: var(--success); }
  .cal-chip.no   { background: var(--danger); }
  .cal-chip.open { background: var(--primary); }
}
.cal-more { font-size: .58rem; color: var(--gray-400); font-weight: 600; padding: 0 2px; }

/* ══════════════════════════════════════════════════
   EVENT LIST ITEMS
   ══════════════════════════════════════════════════ */
.ev-item {
  display: flex; align-items: flex-start; gap: .75rem;
  padding: .85rem 1rem;
  cursor: pointer;
  transition: background .1s;
  border-bottom: 1px solid var(--gray-100);
}
.ev-item:last-child { border-bottom: none; }
.ev-item:active { background: var(--gray-50); }

.ev-datebox {
  display: flex; flex-direction: column; align-items: center;
  min-width: 2.6rem;
  background: var(--primary-lt);
  color: var(--primary);
  border-radius: var(--r-sm);
  padding: .3rem .45rem;
  flex-shrink: 0;
}
.ev-datebox .day   { font-size: 1.1rem; font-weight: 800; line-height: 1; }
.ev-datebox .mon   { font-size: .58rem; font-weight: 700; text-transform: uppercase; }
.ev-datebox.yes { background: var(--success-lt); color: var(--success); }
.ev-datebox.no  { background: var(--danger-lt);  color: var(--danger); }

.ev-body { flex: 1; min-width: 0; }
.ev-title {
  font-weight: 700; font-size: .9rem; color: var(--gray-900);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-bottom: .18rem;
}
.ev-meta {
  display: flex; flex-wrap: wrap; gap: .35rem;
  font-size: .74rem; color: var(--gray-500);
}
.ev-meta span { display: flex; align-items: center; gap: .18rem; }
.ev-dl { font-size: .7rem; margin-top: .2rem; display: flex; align-items: center; gap: .2rem; }
.dl-ok     { color: var(--gray-400); }
.dl-soon   { color: var(--warning); font-weight: 600; }
.dl-urgent { color: var(--danger);  font-weight: 700; }
.dl-passed { color: var(--gray-300); text-decoration: line-through; }

/* ══════════════════════════════════════════════════
   MODAL / BOTTOM SHEET
   ══════════════════════════════════════════════════ */
.overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 400;
  display: flex; align-items: flex-end;
  animation: overlayIn .2s ease;
}
.overlay.center-modal { align-items: center; padding: 1rem; }
@keyframes overlayIn { from { opacity: 0; } to { opacity: 1; } }

.sheet {
  background: #fff;
  border-radius: var(--r) var(--r) 0 0;
  width: 100%;
  max-height: 92dvh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  animation: slideUp .24s cubic-bezier(.32,1,.23,1);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.sheet.center-sheet {
  border-radius: var(--r);
  max-height: 90dvh;
  max-width: 520px;
  width: 100%;
  animation: fadeUp .2s ease;
}

.sheet-handle {
  width: 2.2rem; height: 3.5px;
  background: var(--gray-200);
  border-radius: 99px;
  margin: .55rem auto .1rem;
  flex-shrink: 0;
}
.sheet-hdr {
  display: flex; align-items: center; justify-content: space-between;
  padding: .75rem 1rem .25rem;
}
.sheet-title { font-size: .95rem; font-weight: 800; color: var(--gray-900); }
.sheet-close {
  width: 1.75rem; height: 1.75rem;
  background: var(--gray-100); border: none; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--gray-500); font-size: .78rem; cursor: pointer;
  transition: background .15s;
}
.sheet-close:hover { background: var(--gray-200); }
.sheet-body   { padding: .85rem 1rem; }
.sheet-footer {
  padding: .75rem 1rem;
  border-top: 1px solid var(--gray-100);
  display: flex; gap: .5rem;
}

/* ── Detail rows (in event modal) ─────────────── */
.det-row {
  display: flex; align-items: flex-start; gap: .6rem;
  padding: .5rem 0;
  border-bottom: 1px solid var(--gray-100);
  font-size: .855rem; color: var(--gray-700);
}
.det-row:last-child { border-bottom: none; }
.det-row i { width: .95rem; text-align: center; color: var(--gray-400); flex-shrink: 0; margin-top: 1px; }

/* ── RSVP Buttons ────────────────────────────── */
.rsvp-row { display: flex; gap: .5rem; }
.rsvp-btn {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: .35rem;
  padding: .65rem;
  border-radius: var(--r-sm);
  border: 2px solid; font-weight: 700; font-size: .85rem;
  cursor: pointer; transition: all .15s;
}
.rsvp-btn:active { transform: scale(.96); }
.rsvp-yes { border-color: var(--success); color: var(--success); background: #fff; }
.rsvp-yes.active, .rsvp-yes:hover { background: var(--success); color: #fff; }
.rsvp-no  { border-color: var(--danger);  color: var(--danger);  background: #fff; }
.rsvp-no.active,  .rsvp-no:hover  { background: var(--danger);  color: #fff; }

/* ── Participant list ───────────────────────────── */
.parts-sec { margin-top: .85rem; }
.parts-lbl { font-size: .7rem; font-weight: 700; color: var(--gray-500); text-transform: uppercase; letter-spacing: .4px; margin-bottom: .4rem; }
.part-row  {
  display: flex; align-items: center; gap: .5rem;
  padding: .35rem 0; border-bottom: 1px solid var(--gray-100);
}
.part-row:last-child { border-bottom: none; }
.part-name    { font-size: .855rem; font-weight: 500; }
.part-comment { font-size: .72rem; color: var(--gray-400); margin-left: auto; font-style: italic; max-width: 45%; text-align: right; }

/* ── Member list ────────────────────────────────── */
.mem-row {
  display: flex; align-items: center; gap: .7rem;
  padding: .75rem 1rem;
  border-bottom: 1px solid var(--gray-100);
}
.mem-row:last-child { border-bottom: none; }
.mem-info { flex: 1; min-width: 0; }
.mem-name  { font-weight: 600; font-size: .875rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mem-email { font-size: .72rem; color: var(--gray-400); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mem-since { font-size: .68rem; color: var(--gray-400); margin-top: .1rem; }
.mem-since i { margin-right: .2rem; }
.mem-actions { display: flex; align-items: center; gap: .3rem; flex-shrink: 0; }

/* ── Profile color dots ─────────────────────────── */
.color-row { display: flex; gap: .5rem; flex-wrap: wrap; }
.cdot {
  width: 1.85rem; height: 1.85rem; border-radius: 50%;
  cursor: pointer; border: 3px solid transparent;
  transition: border-color .15s, transform .15s;
}
.cdot.on { border-color: var(--gray-900); transform: scale(1.2); }

/* ── Settings list ──────────────────────────────── */
.set-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: .85rem 1rem; border-bottom: 1px solid var(--gray-100);
  cursor: pointer;
}
.set-row:last-child { border-bottom: none; }
.set-row-lbl { font-weight: 600; font-size: .875rem; }
.set-row-sub { font-size: .72rem; color: var(--gray-400); margin-top: .1rem; }
.set-row-ico { color: var(--gray-300); font-size: .75rem; }

/* ── Inner form padding ─────────────────────────── */
.form-pad { padding: 1rem; }
.form-pad .fg:last-child { margin-bottom: 0; }

/* ── Section label inside card ──────────────────── */
.card-lbl {
  padding: .65rem 1rem;
  font-size: .72rem; font-weight: 700; color: var(--gray-400);
  text-transform: uppercase; letter-spacing: .5px;
  border-bottom: 1px solid var(--gray-100);
}
