/* App Shell */
body {
  padding-top: calc(var(--header-height) + var(--safe-top));
  padding-bottom: calc(var(--nav-height) + var(--safe-bottom));
}

/* Header — füllt auch den Notch-Bereich grün aus (iOS Safe-Area) */
#top-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: calc(var(--header-height) + var(--safe-top));
  padding-top: var(--safe-top);
  background: var(--color-primary);
  color: var(--color-white);
  display: flex;
  align-items: center;
  padding-left: 16px;
  padding-right: 16px;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.header-back {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--color-white);
  margin-right: 8px;
  transition: background var(--transition);
}

.header-back:hover {
  background: rgba(255,255,255,0.15);
}

.header-title {
  font-family: var(--font-display);
  font-variant: small-caps;
  font-size: 1.2rem;
  letter-spacing: 0.05em;
  flex: 1;
}

.header-action {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--color-white);
  transition: background var(--transition);
}

.header-action:hover {
  background: rgba(255,255,255,0.15);
}

/* Bottom Navigation */
#bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(var(--nav-height) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: var(--color-white);
  border-top: 1px solid var(--color-border);
  display: flex;
  z-index: 100;
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: var(--color-muted);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  transition: color var(--transition);
  padding: 8px 0;
}

.nav-item.active {
  color: var(--color-primary);
}

.nav-icon {
  width: 24px;
  height: 24px;
}

.nav-icon svg {
  width: 100%;
  height: 100%;
}

/* Main Content */
#app {
  min-height: calc(100vh - var(--header-height) - var(--nav-height) - var(--safe-bottom));
}

/* Floating Action Button */
.fab {
  position: fixed;
  bottom: calc(var(--nav-height) + var(--safe-bottom) + 16px);
  right: 16px;
  width: 48px;
  height: 48px;
  border-radius: var(--radius-full);
  background: var(--color-primary);
  color: var(--color-white);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-lg);
  z-index: 50;
  transition: all var(--transition);
}

.fab:hover {
  background: var(--color-primary-dark);
  transform: scale(1.05);
}

/* Scroll-to-bottom FAB */
.fab-scroll {
  bottom: calc(var(--nav-height) + var(--safe-bottom) + 16px);
  right: 16px;
  width: 44px;
  height: 44px;
  font-size: 1.2rem;
}

/* Overlay / Modal */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.overlay-content {
  background: var(--color-bg);
  border-radius: var(--radius-card) var(--radius-card) 0 0;
  width: 100%;
  max-width: 480px;
  max-height: 85vh;
  overflow-y: auto;
  padding: 24px 16px calc(24px + var(--safe-bottom));
  animation: slideUp 0.3s ease;
}

.overlay-handle {
  width: 40px;
  height: 4px;
  background: var(--color-border);
  border-radius: var(--radius-full);
  margin: 0 auto 16px;
}

/* Loading spinner */
.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 24px auto;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Toast Container */
#toast-container {
  position: fixed;
  top: calc(var(--header-height) + var(--safe-top) + 8px);
  left: 16px;
  right: 16px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: var(--color-text);
  color: var(--color-white);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  box-shadow: var(--shadow-md);
  animation: fadeIn 0.3s ease;
  pointer-events: auto;
}

.toast--success { background: var(--color-primary); }
.toast--error { background: var(--color-danger); }
