/* HorseAI Layout — mobile-first, responsive up to desktop. */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
}

/* ---------------------------------------------------------------------------
   App shell
   ------------------------------------------------------------------------- */

#app {
  display: flex;
  flex-direction: column;
  height: 100dvh;         /* dynamic viewport height — handles mobile browser chrome */
}

/* ---------------------------------------------------------------------------
   Side nav — hidden on mobile/tablet, shown on desktop
   ------------------------------------------------------------------------- */

#side-nav {
  display: none;          /* hidden below 1024px */
}

/* ---------------------------------------------------------------------------
   View container — scrollable content area above the nav
   ------------------------------------------------------------------------- */

#view-container {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
}

/* View slots — only the active one is shown */
.view {
  display: none;
}

.view.active {
  display: block;
}

/* ---------------------------------------------------------------------------
   Bottom tab navigation
   ------------------------------------------------------------------------- */

#bottom-nav {
  display: flex;
  border-top: 0.5px solid var(--border-strong);
  background: var(--bg);
  /* Respect iPhone home indicator */
  padding-bottom: env(safe-area-inset-bottom);
}

/* ---------------------------------------------------------------------------
   Tablet (640px–1023px) — wider content, centred, bottom nav stays
   ------------------------------------------------------------------------- */

@media (min-width: 640px) {
  #view-container {
    padding: 24px 24px calc(24px + env(safe-area-inset-bottom));
  }

  #view-container > * {
    max-width: 720px;
    margin-left: auto;
    margin-right: auto;
  }
}

/* ---------------------------------------------------------------------------
   Desktop (≥ 1024px) — side nav rail, wider content, bottom nav hidden
   ------------------------------------------------------------------------- */

@media (min-width: 1024px) {
  #app {
    flex-direction: row;
  }

  /* Side nav rail */
  #side-nav {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: fixed;
    top: 0;
    left: 0;
    width: 64px;
    height: 100dvh;
    background: var(--bg-surface);
    border-right: 0.5px solid var(--border);
    z-index: 100;
    padding: 0 0 16px;
  }

  /* Main content pushed right of the side nav */
  #view-container {
    margin-left: 64px;
    padding: 32px 32px calc(32px + env(safe-area-inset-bottom));
  }

  #view-container > * {
    max-width: 1100px;
    margin-left: auto;
    margin-right: auto;
  }

  /* Hide bottom nav on desktop */
  #bottom-nav {
    display: none;
  }
}
