/* BTR Connect — Design */
:root {
  --primary: #0b4fb3;
  --primary-2: #1a73e8;
  --primary-grad: linear-gradient(135deg, #0b3d91, #1a73e8);
  --accent: #ff7a18;
  --bg: #eef1f6;
  --card: #ffffff;
  --text: #101828;
  --text-2: #5b6474;
  --line: rgba(16, 24, 40, 0.08);
  --like: #e0245e;
  --radius: 18px;
  --shadow: 0 1px 2px rgba(16,24,40,.05), 0 6px 24px -8px rgba(16,24,40,.12);
  --tabbar-h: 62px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1117;
    --card: #161b26;
    --text: #e8ecf3;
    --text-2: #98a2b3;
    --line: rgba(255,255,255,.09);
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 28px -10px rgba(0,0,0,.6);
  }
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100%;
  overscroll-behavior-y: none;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; border: 0; background: none; color: inherit; cursor: pointer; }
img { display: block; }
svg { fill: currentColor; }
[hidden] { display: none !important; }

/* ---------- Topbar ---------- */
#topbar {
  position: sticky; top: 0; z-index: 50;
  padding-top: env(safe-area-inset-top);
  background: color-mix(in srgb, var(--card) 78%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  backdrop-filter: saturate(180%) blur(18px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 640px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-logo { width: 34px; height: 34px; border-radius: 9px; box-shadow: var(--shadow); }
.brand-name { font-size: 1.15rem; letter-spacing: -.02em; font-weight: 500; }
.brand-name b { font-weight: 800; background: var(--primary-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.iconbtn { position: relative; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; color: var(--text-2); transition: background .2s; }
.iconbtn:active { background: var(--line); }
.iconbtn svg { width: 24px; height: 24px; }
.badge {
  position: absolute; top: 4px; right: 2px; min-width: 17px; height: 17px;
  background: var(--like); color: #fff; font-size: .68rem; font-weight: 700;
  border-radius: 9px; display: grid; place-items: center; padding: 0 4px;
  border: 2px solid var(--card);
}

/* ---------- Layout ---------- */
#view {
  max-width: 640px; margin: 0 auto;
  padding: 14px 12px calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 24px);
  animation: fadein .25s ease;
}
@keyframes fadein { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- Tabbar ---------- */
#tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
  display: flex; justify-content: space-around; align-items: stretch;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: color-mix(in srgb, var(--card) 82%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  backdrop-filter: saturate(180%) blur(18px);
  border-top: 1px solid var(--line);
}
.tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; font-size: .66rem; font-weight: 600; color: var(--text-2);
  transition: color .2s, transform .1s;
}
.tab svg { width: 25px; height: 25px; }
.tab.active { color: var(--primary-2); }
.tab:active { transform: scale(.92); }
.compose-circle {
  display: grid; place-items: center; width: 42px; height: 42px; margin-top: -14px;
  border-radius: 50%; background: var(--primary-grad); color: #fff;
  box-shadow: 0 6px 18px -4px rgba(26,115,232,.55);
}
.compose-circle svg { width: 22px; height: 22px; }
.tab-compose { color: var(--text-2); }

/* ---------- Cards & Buttons ---------- */
.card {
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow); border: 1px solid var(--line);
  margin-bottom: 14px; overflow: hidden;
}
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--primary-grad); color: #fff; font-weight: 700;
  border-radius: 14px; padding: 13px 22px; width: 100%;
  transition: transform .12s, opacity .2s; font-size: 1rem;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .55; }
.btn-ghost { background: var(--line); color: var(--text); box-shadow: none; }
.btn-sm { width: auto; padding: 9px 16px; border-radius: 12px; font-size: .9rem; }
.btn-danger { background: linear-gradient(135deg,#c0392b,#e74c3c); }

input[type=text], input[type=password], textarea {
  width: 100%; border: 1.5px solid var(--line); border-radius: 14px;
  background: var(--bg); color: var(--text);
  padding: 13px 15px; font: inherit; outline: none;
  transition: border-color .2s, box-shadow .2s;
}
input:focus, textarea:focus { border-color: var(--primary-2); box-shadow: 0 0 0 3px rgba(26,115,232,.15); }
textarea { resize: none; min-height: 90px; }
label.field { display: block; margin-bottom: 14px; font-size: .82rem; font-weight: 600; color: var(--text-2); }
label.field input, label.field textarea { margin-top: 6px; }

/* ---------- Login ---------- */
.auth-wrap { min-height: 100dvh; display: flex; flex-direction: column; justify-content: center; padding: 24px; max-width: 440px; margin: 0 auto; }
.auth-logo { width: 92px; height: 92px; border-radius: 24px; margin: 0 auto 18px; box-shadow: 0 16px 40px -10px rgba(11,61,145,.5); }
.auth-title { text-align: center; font-size: 1.8rem; font-weight: 800; letter-spacing: -.03em; }
.auth-title span { background: var(--primary-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.auth-sub { text-align: center; color: var(--text-2); margin: 6px 0 26px; font-size: .95rem; }
.auth-card { padding: 22px; }
.auth-switch { text-align: center; margin-top: 18px; color: var(--text-2); font-size: .92rem; }
.auth-switch a { color: var(--primary-2); font-weight: 700; }

/* ---------- Composer ---------- */
.composer { padding: 16px; }
.composer-row { display: flex; gap: 12px; }
.composer textarea { min-height: 110px; }
.composer-actions { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; }
.attach-btn { display: inline-flex; align-items: center; gap: 8px; color: var(--primary-2); font-weight: 700; font-size: .92rem; padding: 8px 12px; border-radius: 12px; background: rgba(26,115,232,.1); }
.attach-btn svg { width: 20px; height: 20px; }
.img-preview { position: relative; margin-top: 12px; }
.img-preview img { width: 100%; border-radius: 14px; max-height: 340px; object-fit: cover; }
.img-preview .remove {
  position: absolute; top: 8px; right: 8px; width: 32px; height: 32px; border-radius: 50%;
  background: rgba(0,0,0,.6); color: #fff; display: grid; place-items: center; font-size: 1.1rem;
}

/* ---------- Post ---------- */
.post-head { display: flex; align-items: center; gap: 11px; padding: 14px 16px 0; }
.avatar {
  width: 44px; height: 44px; border-radius: 50%; object-fit: cover; flex: none;
  background: var(--primary-grad); color: #fff; display: grid; place-items: center;
  font-weight: 800; font-size: 1.05rem; overflow: hidden;
}
.avatar.sm { width: 34px; height: 34px; font-size: .85rem; }
.post-meta { min-width: 0; }
.post-name { font-weight: 700; font-size: .97rem; }
.post-sub { color: var(--text-2); font-size: .8rem; }
.post-more { margin-left: auto; color: var(--text-2); width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; }
.post-text { padding: 10px 16px 4px; white-space: pre-wrap; word-wrap: break-word; font-size: .98rem; line-height: 1.5; }
.post-img { margin-top: 8px; width: 100%; max-height: 560px; object-fit: cover; cursor: pointer; }
.post-stats { display: flex; gap: 14px; padding: 10px 16px 4px; color: var(--text-2); font-size: .82rem; }
.post-actions { display: flex; border-top: 1px solid var(--line); margin-top: 8px; }
.pact {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 7px;
  padding: 11px 0; color: var(--text-2); font-weight: 600; font-size: .9rem;
  transition: color .15s, transform .1s;
}
.pact svg { width: 21px; height: 21px; }
.pact:active { transform: scale(.94); }
.pact.liked { color: var(--like); }
.pact.liked svg { animation: pop .3s ease; }
@keyframes pop { 40% { transform: scale(1.35); } }

/* ---------- Kommentare ---------- */
.comments { padding: 6px 16px 14px; }
.comment { display: flex; gap: 10px; margin-top: 12px; }
.comment-bubble { background: var(--bg); border-radius: 14px; padding: 9px 13px; max-width: 100%; }
.comment-name { font-weight: 700; font-size: .84rem; }
.comment-text { font-size: .93rem; line-height: 1.4; word-wrap: break-word; white-space: pre-wrap; }
.comment-time { font-size: .72rem; color: var(--text-2); margin: 3px 0 0 13px; }
.comment-form { display: flex; gap: 9px; align-items: center; margin-top: 14px; }
.comment-form input { border-radius: 999px; padding: 11px 16px; }
.send-btn { flex: none; width: 42px; height: 42px; border-radius: 50%; background: var(--primary-grad); color: #fff; display: grid; place-items: center; }
.send-btn svg { width: 20px; height: 20px; }

/* ---------- Profil ---------- */
.profile-card { overflow: hidden; }
.banner { height: 150px; background: var(--primary-grad); position: relative; }
.banner img { width: 100%; height: 100%; object-fit: cover; }
.profile-head { padding: 0 18px 18px; margin-top: -44px; position: relative; }
.avatar.xl { width: 92px; height: 92px; font-size: 2rem; border: 4px solid var(--card); }
.profile-name { font-size: 1.35rem; font-weight: 800; margin-top: 10px; letter-spacing: -.02em; }
.profile-username { color: var(--text-2); font-size: .9rem; }
.profile-bio { margin-top: 10px; font-size: .95rem; line-height: 1.5; }
.profile-stats { display: flex; gap: 22px; margin-top: 14px; }
.pstat b { font-size: 1.05rem; }
.pstat span { color: var(--text-2); font-size: .82rem; margin-left: 4px; }
.profile-actions { margin-top: 16px; display: flex; gap: 10px; }
.section-title { font-weight: 800; font-size: 1.05rem; margin: 20px 4px 12px; letter-spacing: -.01em; }

/* ---------- Personen ---------- */
.person { display: flex; align-items: center; gap: 13px; padding: 13px 16px; }
.person + .person { border-top: 1px solid var(--line); }
.person-name { font-weight: 700; }
.person-sub { color: var(--text-2); font-size: .82rem; }

/* ---------- Mitteilungen ---------- */
.notif { display: flex; align-items: center; gap: 13px; padding: 13px 16px; }
.notif + .notif { border-top: 1px solid var(--line); }
.notif.unread { background: rgba(26,115,232,.07); }
.notif-text { font-size: .93rem; line-height: 1.4; }
.notif-time { color: var(--text-2); font-size: .78rem; margin-top: 2px; }
.notif-ico { margin-left: auto; font-size: 1.1rem; }

/* ---------- Sonstiges ---------- */
.empty { text-align: center; color: var(--text-2); padding: 46px 20px; }
.empty .emoji { font-size: 2.4rem; display: block; margin-bottom: 10px; }
.spinner { margin: 40px auto; width: 30px; height: 30px; border: 3px solid var(--line); border-top-color: var(--primary-2); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

#toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 18px);
  background: var(--text); color: var(--card);
  padding: 11px 20px; border-radius: 999px; font-size: .9rem; font-weight: 600;
  z-index: 100; box-shadow: var(--shadow); max-width: 85vw; text-align: center;
  animation: toast-in .25s ease;
}
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 10px); } to { opacity: 1; transform: translate(-50%, 0); } }

.push-hint { padding: 14px 16px; display: flex; gap: 12px; align-items: center; }
.push-hint .txt { flex: 1; font-size: .88rem; color: var(--text-2); line-height: 1.4; }
.push-hint b { color: var(--text); }

.lightbox {
  position: fixed; inset: 0; z-index: 200; background: rgba(0,0,0,.92);
  display: grid; place-items: center; animation: fadein .2s ease;
}
.lightbox img { max-width: 100vw; max-height: 100dvh; object-fit: contain; }

.settings-list { padding: 6px 0; }
.settings-item { display: flex; align-items: center; gap: 13px; width: 100%; text-align: left; padding: 14px 18px; font-weight: 600; font-size: .95rem; }
.settings-item + .settings-item { border-top: 1px solid var(--line); }
.settings-item svg { width: 22px; height: 22px; color: var(--text-2); }
.settings-item.danger { color: #e74c3c; }
