/* HDFZ Layout & Navigation - Mobile TabBar + Desktop Sidebar */

.app-shell {
  display: flex;
  width: 100vw;
  height: 100vh;
  position: relative;
  overflow: hidden;
  background-color: var(--hdfz-bg);
}

/* Main Viewport Container */
.main-viewport {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  position: relative;
  overflow: hidden;
}

/* 1. App Top Navigation Bar */
.app-topbar {
  width: 100%;
  height: 52px;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--hdfz-glass-bg);
  backdrop-filter: var(--hdfz-glass-blur);
  -webkit-backdrop-filter: var(--hdfz-glass-blur);
  border-bottom: 1px solid var(--hdfz-line);
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar-brand {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--hdfz-ink);
  display: flex;
  align-items: center;
  gap: 8px;
}
.brand-badge {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: var(--hdfz-accent);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 800;
}

/* Sticky Compact Calorie Summary */
.compact-summary {
  display: flex;
  flex-direction: column;
  align-items: center;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.compact-summary.is-active {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}
.compact-title {
  font-size: 0.72rem;
  color: var(--hdfz-muted);
}
.compact-status {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--hdfz-accent-strong);
}
.compact-status.is-over {
  color: var(--hdfz-over);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* 2. Mobile Bottom TabBar */
.tab-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(env(safe-area-inset-bottom, 0px) + 60px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--hdfz-glass-bg);
  backdrop-filter: var(--hdfz-glass-blur);
  -webkit-backdrop-filter: var(--hdfz-glass-blur);
  border-top: 1px solid var(--hdfz-line);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 900;
}

.tab-item {
  flex: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: transparent;
  border: none;
  color: var(--hdfz-muted);
  cursor: pointer;
  transition: color var(--hdfz-duration-feedback) var(--hdfz-ease-feedback),
              transform var(--hdfz-duration-feedback) var(--hdfz-ease-feedback);
}
.tab-item:active {
  transform: scale(0.92);
}
.tab-item.is-active {
  color: var(--hdfz-accent-strong);
}

.tab-icon {
  font-size: 1.35rem;
  line-height: 1;
}
.tab-label {
  font-size: 0.72rem;
  font-weight: 600;
}

/* 3. iPad / Desktop Sidebar (Wide Layout) */
.sidebar-nav {
  display: none;
  width: 250px;
  height: 100%;
  background: var(--hdfz-surface);
  border-right: 1px solid var(--hdfz-line);
  flex-direction: column;
  padding: 24px 16px;
  gap: 24px;
  flex-shrink: 0;
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px;
}
.sidebar-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--hdfz-ink);
}

.sidebar-menu {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  border-radius: var(--hdfz-radius-md);
  border: none;
  background: transparent;
  color: var(--hdfz-ink);
  font-size: 0.98rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--hdfz-duration-feedback) var(--hdfz-ease-feedback),
              color var(--hdfz-duration-feedback) var(--hdfz-ease-feedback);
  text-align: left;
}
.sidebar-item:hover {
  background: var(--hdfz-surface-muted);
}
.sidebar-item.is-active {
  background: var(--hdfz-accent-soft);
  color: var(--hdfz-accent-strong);
}
.sidebar-item .item-icon {
  font-size: 1.25rem;
}

/* Wide screen media query */
@media (min-width: 900px) {
  .tab-bar {
    display: none;
  }
  .sidebar-nav {
    display: flex;
  }
  .app-topbar {
    display: none; /* Desktop uses content titles */
  }
}
