/* ═══════════════════════════════════════════════════════════════════════════
   layout.css — App-Shell: Topbar, Bottom-Tab-Bar (mobil), Sidebar (Desktop)
   Mobile-first: Basis = Handy, Desktop via min-width:768px
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Login-Screen ── */
#login-screen {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(1200px 600px at 50% -10%, var(--gold-alpha-08), transparent 60%),
    var(--bg);
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px 26px calc(32px + var(--safe-bottom));
  box-shadow: var(--shadow-card);
}
.login-logo {
  font-family: var(--font-display);
  font-size: 1.8rem;
  text-align: center;
  color: var(--gold);
  margin-bottom: 4px;
}
.login-sub {
  text-align: center;
  color: var(--text-faint);
  font-size: .85rem;
  margin-bottom: 26px;
}
.login-form { display: flex; flex-direction: column; gap: 14px; }
.login-error {
  background: var(--red-dim);
  color: var(--red);
  border: 1px solid var(--red);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: .85rem;
  margin-bottom: 14px;
}

/* ── App-Shell ── */
#app {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* ── Topbar (mobil: Titel + Suche + Glocke) ── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 8px;
  height: calc(var(--topbar-h) + var(--safe-top));
  padding: var(--safe-top) 12px 0 var(--page-pad);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.topbar-title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.3rem;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topbar-btn {
  position: relative;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-pill);
  font-size: 1.15rem;
  color: var(--text-dim);
  transition: background var(--t-fast), color var(--t-fast);
}
.topbar-btn:active, .topbar-btn:hover { background: var(--gold-alpha-15); color: var(--gold-bright); }
.topbar-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 2px solid var(--gold);
  display: grid; place-items: center;
  font-size: .75rem; font-weight: 700;
  color: var(--gold);
  overflow: hidden;
  flex-shrink: 0;
}
.topbar-avatar img { width: 100%; height: 100%; object-fit: cover; }

/* ── Main ── */
.main {
  flex: 1;
  padding: var(--page-pad);
  padding-bottom: calc(var(--bottombar-h) + var(--safe-bottom) + 20px);
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
}
.page { display: none; }
.page.active { display: block; animation: pageIn var(--t-med) both; }
@keyframes pageIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

/* ── Bottom-Tab-Bar (nur mobil) ── */
.bottombar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 40;
  height: calc(var(--bottombar-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  display: flex;
  background: color-mix(in srgb, var(--bg-elev) 92%, transparent);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--border);
}
.tab-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-size: .62rem;
  color: var(--text-faint);
  position: relative;
  transition: color var(--t-fast);
  -webkit-tap-highlight-color: transparent;
}
.tab-icon { font-size: 1.3rem; line-height: 1; }
.tab-item.active { color: var(--gold-bright); }
.tab-item.active::before {
  content: '';
  position: absolute;
  top: 0; left: 50%;
  transform: translateX(-50%);
  width: 28px; height: 2px;
  border-radius: 2px;
  background: var(--gold);
  box-shadow: 0 0 8px var(--gold-alpha-40);
}
.tab-badge {
  position: absolute;
  top: 6px;
  left: calc(50% + 6px);
  min-width: 16px; height: 16px;
  padding: 0 4px;
  border-radius: var(--radius-pill);
  background: var(--red);
  color: #fff;
  font-size: .6rem;
  font-weight: 700;
  display: grid;
  place-items: center;
}

/* ── „Mehr"-Sheet (mobil) ── */
.more-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 4px 0 8px;
}
.more-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px 6px;
  border-radius: var(--radius);
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: .74rem;
  color: var(--text-dim);
  position: relative;
  transition: border-color var(--t-fast), color var(--t-fast);
}
.more-item:active { border-color: var(--gold); color: var(--gold-bright); }
.more-item .tab-icon { font-size: 1.5rem; }
.more-item.active { border-color: var(--gold); color: var(--gold-bright); box-shadow: var(--glow-gold); }
.more-item .tab-badge { top: 8px; right: 8px; left: auto; }

/* ── Sidebar (Desktop) ── */
.sidebar { display: none; }

/* ═══ Desktop ≥768px ═══ */
@media (min-width: 768px) {
  #app { flex-direction: row; }
  .bottombar { display: none; }

  .sidebar {
    display: flex;
    flex-direction: column;
    width: var(--sidebar-w);
    flex-shrink: 0;
    position: sticky;
    top: 0;
    height: 100dvh;
    background: var(--bg-elev);
    border-right: 1px solid var(--border);
    padding: 22px 14px 18px;
  }
  .sidebar-logo {
    font-family: var(--font-display);
    font-size: 1.35rem;
    color: var(--gold);
    padding: 0 10px 18px;
  }
  .sidebar-nav { flex: 1; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
  .nav-item {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-dim);
    font-size: .92rem;
    text-align: left;
    position: relative;
    transition: background var(--t-fast), color var(--t-fast);
  }
  .nav-item:hover { background: var(--gold-alpha-08); color: var(--text); }
  .nav-item.active {
    background: var(--gold-alpha-15);
    color: var(--gold-bright);
    box-shadow: inset 2px 0 0 var(--gold);
  }
  .nav-icon { font-size: 1.05rem; width: 22px; text-align: center; }
  .nav-badge {
    margin-left: auto;
    min-width: 18px; height: 18px;
    padding: 0 5px;
    border-radius: var(--radius-pill);
    background: var(--red);
    color: #fff;
    font-size: .65rem;
    font-weight: 700;
    display: grid;
    place-items: center;
  }
  .sidebar-footer {
    border-top: 1px solid var(--border);
    padding-top: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
  }
  .sidebar-avatar {
    width: 38px; height: 38px;
    border-radius: 50%;
    border: 2px solid var(--gold);
    display: grid; place-items: center;
    font-size: .8rem; font-weight: 700;
    color: var(--gold);
    overflow: hidden;
    flex-shrink: 0;
    cursor: pointer;
  }
  .sidebar-avatar img { width: 100%; height: 100%; object-fit: cover; }
  .sidebar-user { flex: 1; min-width: 0; }
  .sidebar-username { font-size: .88rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .sidebar-role-tag {
    display: inline-block;
    font-size: .62rem;
    padding: 1px 8px;
    border-radius: var(--radius-pill);
    background: var(--gold-alpha-15);
    color: var(--gold);
    border: 1px solid var(--gold-alpha-40);
    margin-top: 2px;
  }

  .main {
    padding: 26px var(--page-pad) 40px;
  }
  .topbar { padding-left: var(--page-pad); }
  .topbar-title { font-size: 1.15rem; }
}
