/* App shell: header sus, conținut cu scroll, bottom-nav pe mobil → sidebar pe desktop. */

#app {
  min-height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: var(--z-header);
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 0 var(--sp-4);
  padding-top: env(safe-area-inset-top);
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--border);
}
.app-header .brand {
  display: flex; align-items: center; gap: var(--sp-2);
  font-weight: 800; letter-spacing: -0.01em;
}
.app-header .brand .logo { width: 28px; height: 28px; }

.app-main {
  padding: var(--sp-4);
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + var(--sp-4));
  max-width: var(--content-max);
  width: 100%;
  margin: 0 auto;
}

/* Navigație jos (mobil) */
.bottom-nav {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: var(--z-nav);
  height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: flex;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-top: 1px solid var(--border);
}
.bottom-nav a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: var(--touch);
  color: var(--text-muted);
  text-decoration: none;
  font-size: var(--fs-xs);
  font-weight: 600;
}
.bottom-nav a .ico { width: 24px; height: 24px; }
.bottom-nav a[aria-current="page"] { color: var(--accent-strong); }

/* FAB */
.fab {
  position: fixed;
  right: var(--sp-4);
  bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + var(--sp-3));
  z-index: var(--z-nav);
  width: var(--touch-lg); height: var(--touch-lg);
  border-radius: var(--radius-full);
  background: var(--accent);
  color: var(--on-brand);
  border: none;
  box-shadow: var(--shadow-3);
  display: grid; place-items: center;
  cursor: pointer;
}
.fab .ico { width: 28px; height: 28px; }

/* Desktop ≥1024px: sidebar în loc de bottom-nav */
@media (min-width: 1024px) {
  #app {
    grid-template-columns: 260px 1fr;
    grid-template-rows: auto 1fr;
    grid-template-areas:
      "header header"
      "nav    main";
  }
  .app-header { grid-area: header; }
  .app-main { grid-area: main; max-width: var(--content-max); }
  .bottom-nav {
    grid-area: nav;
    position: sticky;
    top: var(--header-h);
    height: calc(100dvh - var(--header-h));
    flex-direction: column;
    justify-content: flex-start;
    padding: var(--sp-3);
    gap: var(--sp-1);
    border-top: none;
    border-right: 1px solid var(--border);
    backdrop-filter: none;
    background: var(--surface);
  }
  .bottom-nav a {
    flex: none;
    flex-direction: row;
    justify-content: flex-start;
    gap: var(--sp-3);
    padding: 0 var(--sp-3);
    border-radius: var(--radius);
    font-size: var(--fs-md);
  }
  .bottom-nav a[aria-current="page"] { background: var(--brand-50); }
  :root[data-theme="dark"] .bottom-nav a[aria-current="page"],
  .fab { }
  .fab { right: var(--sp-6); bottom: var(--sp-6); }
}

/* Bară offline */
.offline-bar {
  background: var(--warning-bg);
  color: var(--warning);
  text-align: center;
  font-size: var(--fs-sm);
  font-weight: 600;
  padding: var(--sp-1) var(--sp-3);
}

/* Banner actualizare PWA */
.update-banner {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + var(--sp-3));
  z-index: var(--z-toast);
  background: var(--text); color: var(--surface);
  border-radius: var(--radius-full);
  padding: var(--sp-2) var(--sp-3) var(--sp-2) var(--sp-4);
  display: flex; align-items: center; gap: var(--sp-3);
  box-shadow: var(--shadow-3);
  max-width: calc(100vw - 2 * var(--sp-4));
}
.update-banner button {
  background: var(--accent); color: var(--on-brand);
  border: none; border-radius: var(--radius-full);
  padding: var(--sp-1) var(--sp-3); font-weight: 700; cursor: pointer;
}

.page-title { margin-bottom: var(--sp-4); }
.section-title { font-size: var(--fs-md); color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: var(--sp-2); }
