/* ==========================================================================
   RepForge – App-Layout
   Mobile-first: Kopfzeile oben, scrollender Inhalt, feste Tab-Leiste unten.
   Ab 56rem (Desktop): Tab-Leiste wird zur linken Seitenleiste.
   ========================================================================== */

.app {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* ---- Kopfzeile --------------------------------------------------------- */
.appbar {
  position: sticky;
  top: 0;
  z-index: var(--z-nav);
  padding: calc(var(--safe-top) + var(--space-3)) calc(var(--safe-right) + var(--space-4))
    var(--space-3) calc(var(--safe-left) + var(--space-4));
  background: var(--color-bg); /* Fallback für Browser ohne color-mix */
  background: color-mix(in srgb, var(--color-bg) 92%, transparent);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--color-border);
}

.appbar__inner {
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  min-height: var(--tap-size);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-weight: var(--weight-bold);
  letter-spacing: 0.01em;
}

.brand__mark {
  width: 1.75rem;
  height: 1.75rem;
  border-radius: var(--radius-sm);
  background: var(--color-accent);
  color: var(--color-accent-ink);
  display: grid;
  place-items: center;
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
}

.appbar__title {
  font-size: var(--text-md);
  font-weight: var(--weight-medium);
  color: var(--color-text-muted);
}

/* ---- Inhalt ------------------------------------------------------------ */
.view {
  flex: 1;
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: var(--space-5) calc(var(--safe-right) + var(--space-4))
    calc(var(--nav-height) + var(--safe-bottom) + var(--space-8)) calc(var(--safe-left) + var(--space-4));
  outline: none;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.view-enter {
  animation: view-enter var(--duration-base) var(--ease-out);
}

@keyframes view-enter {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* ---- Untere Tab-Leiste -------------------------------------------------- */
.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: var(--z-nav);
  padding: 0 var(--safe-right) var(--safe-bottom) var(--safe-left);
  background: var(--color-surface-1); /* Fallback für Browser ohne color-mix */
  background: color-mix(in srgb, var(--color-surface-1) 94%, transparent);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--color-border);
}

.tabbar__list {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  max-width: var(--content-max);
  margin: 0 auto;
}

.tab {
  min-height: var(--nav-height);
  min-width: var(--tap-size);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: var(--space-2) var(--space-1);
  color: var(--color-text-muted);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  text-decoration: none;
  transition: color var(--duration-fast) var(--ease-out);
}

.tab svg {
  width: 1.5rem;
  height: 1.5rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tab[aria-current="page"] {
  color: var(--color-accent);
}

/* ---- Desktop: Seitenleiste --------------------------------------------- */
@media (min-width: 56rem) {
  .app {
    padding-left: 15rem;
  }

  .tabbar {
    top: 0;
    right: auto;
    width: 15rem;
    padding: var(--space-6) var(--space-3);
    border-top: 0;
    border-right: 1px solid var(--color-border);
  }

  .tabbar__list {
    grid-template-columns: 1fr;
    gap: var(--space-1);
    max-width: none;
  }

  .tab {
    flex-direction: row;
    justify-content: flex-start;
    gap: var(--space-3);
    min-height: var(--tap-size);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-md);
    font-size: var(--text-md);
  }

  .tab:hover {
    background: var(--color-surface-2);
  }

  .tab[aria-current="page"] {
    background: var(--color-accent-soft);
  }

  .view {
    padding-bottom: var(--space-10);
  }
}
