/* ============================================================
   BASIS – Design-Tokens
   Ruhiger, dunkler Grund + ein kräftiger Akzent für Interaktion.
   Systemschrift = natives Gefühl + keine Ladezeit für Webfonts.
   ============================================================ */
:root {
  --color-bg: #14161c;
  --color-surface: #1b1e26;
  --color-surface-raised: #232732;
  --color-border: #2b2f3a;
  --color-text: #eceef2;
  --color-text-muted: #8b90a2;

  --color-accent: #3ed6b5;
  --color-accent-soft: rgba(62, 214, 181, 0.14);
  --color-coral: #ff7a59;

  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Helvetica, Arial, sans-serif;

  --header-height: 52px;
  --nav-height: 62px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* Icon-Akzentfarben je App – sorgt dafür, dass die Kacheln sich
   unterscheiden statt wie 10x dieselbe Karte auszusehen */
:root {
  --tile-blue: #5b9dff;
  --tile-purple: #a78bfa;
  --tile-amber: #f2b84b;
  --tile-teal: #3ed6b5;
  --tile-coral: #ff7a59;
  --tile-pink: #f472b6;
}

/* ============================================================
   Reset & Grundgerüst
   ============================================================ */
* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  overflow: hidden; /* die Seite selbst scrollt nie - nur .app-content tut das */
  overscroll-behavior-y: none; /* kein "Website-Gummiband"-Gefühl */
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation; /* unterbindet Doppeltipp-zum-Zoomen komplett */
}

body {
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.45;
  position: fixed; /* verhindert, dass iOS im Standalone-Modus fixed-Elemente
                       beim Scrollen kurz verrutschen lässt */
  inset: 0;
  width: 100%;
}

button, a { font-family: inherit; }

h1, h2, h3, p { margin: 0; }

a { text-decoration: none; color: inherit; }

/* ============================================================
   Header
   ============================================================ */
.app-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: calc(var(--header-height) + var(--safe-top));
  padding-top: var(--safe-top);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding-left: var(--space-4);
  padding-right: var(--space-4);
  background: rgba(20, 22, 28, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--color-border);
  z-index: 100;
}

.header-title {
  font-size: 17px;
  font-weight: 600;
  flex: 1;
  text-align: center;
}

.back-btn, .header-spacer {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.back-btn {
  background: none;
  border: none;
  color: var(--color-text);
  border-radius: var(--radius-sm);
}
.back-btn:active { background: var(--color-surface-raised); }

/* ============================================================
   Content-Bereich (hier wird Home bzw. jede Mini-App gerendert)
   ============================================================ */
.app-content {
  position: fixed;
  top: calc(var(--header-height) + var(--safe-top));
  bottom: calc(var(--nav-height) + var(--safe-bottom));
  left: 0;
  right: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain; /* Scroll bleibt in diesem Bereich, wandert nicht zur ganzen Seite */
}

/* ============================================================
   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);
  display: flex;
  background: rgba(20, 22, 28, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid var(--color-border);
  z-index: 100;
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--color-text-muted);
  font-size: 11px;
  padding-top: var(--space-2);
}

.nav-item.active { color: var(--color-accent); }
.nav-item:active { opacity: 0.6; }

/* ============================================================
   Startbildschirm: App-Raster
   ============================================================ */
.app-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-3);
  padding: var(--space-5) var(--space-4) var(--space-4);
}

.app-tile {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  min-height: 120px;
  transition: transform 0.12s ease;
}

.app-tile:active { transform: scale(0.96); }

.app-tile.is-soon { opacity: 0.55; }

.tile-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
}

.tile-name {
  font-size: 15px;
  font-weight: 600;
}

.tile-sub {
  font-size: 12px;
  color: var(--color-text-muted);
  margin-top: -6px;
}

.tile-badge {
  align-self: flex-start;
  font-size: 10px;
  color: var(--color-text-muted);
  background: var(--color-surface-raised);
  padding: 3px 8px;
  border-radius: 100px;
}

/* ============================================================
   Platzhalter für Apps, die noch nicht gebaut sind
   ============================================================ */
.placeholder {
  padding: var(--space-6) var(--space-4);
  text-align: center;
  color: var(--color-text-muted);
}

.placeholder strong {
  display: block;
  color: var(--color-text);
  font-size: 16px;
  margin-bottom: var(--space-2);
}

/* ============================================================
   Mobile-First Breakpoints: größere Ansichten ergänzen,
   nie ersetzen.
   ============================================================ */
@media (min-width: 600px) {
  .app-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (min-width: 900px) {
  .app-content { max-width: 760px; margin: 0 auto; }
  .app-header, .bottom-nav { max-width: 760px; margin: 0 auto; left: 0; right: 0; }
}
