/*
 * Page shell: desktop sidebar (>= 992px), mobile app bar + bottom tab bar + "Daugiau" sheet (< 992px).
 * Markup: views/header.php, views/sidebar.php, views/footer.php. Tokens: theme.css.
 */

:root {
  --sidebar-w: 240px;
  --tabbar-h: 60px;
}

.brand {
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: -0.03em;
  color: var(--c-text);
  text-decoration: none;
}
.brand em { font-style: normal; color: var(--c-brand); }
.brand:hover { color: var(--c-text); }

.app-main { min-width: 0; }
.app-banner { padding: 16px 16px 0; }
.app-banner .alert { max-width: 1120px; margin: 0 auto; }

/* Page content wrapper used by every view */
.page-content { padding: 20px 0 32px; }
.page-content > .container { max-width: 1120px; padding-left: 16px; padding-right: 16px; }

/* ---------- Desktop sidebar ---------- */
.app-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  background: var(--c-surface);
  border-right: 1px solid var(--c-line);
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 20px 12px 16px;
  overflow-y: auto;
  z-index: 1020;
}
.app-sidebar > .brand { padding: 0 12px 10px; }
.side-nav { display: flex; flex-direction: column; gap: 14px; }
.side-group { display: flex; flex-direction: column; gap: 2px; }
.side-label {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--c-text-2);
  padding: 0 12px 4px;
}
.side-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-ctl);
  color: var(--c-text);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.9375rem;
  transition: background-color 150ms ease-out, color 150ms ease-out;
}
.side-link .ic { color: var(--c-text-2); }
.side-link:hover { background: var(--c-surface-2); color: var(--c-text); }
.side-link.is-active { background: #e3efe3; color: var(--c-brand); font-weight: 700; }
.side-link.is-active .ic { color: var(--c-brand); }
.sidebar-balance {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 4px;
  padding: 10px 12px;
  border-radius: var(--radius-card);
  background: var(--c-surface-2);
  color: var(--c-text-2);
  text-decoration: none;
  font-size: 0.8125rem;
}
.sidebar-balance strong { color: var(--c-brand); font-size: 0.9375rem; font-weight: 800; }
.sidebar-balance:hover { color: var(--c-text-2); background: #e6e3da; }

/* ---------- Mobile app bar + tab bar ---------- */
.app-bar {
  position: sticky;
  top: 0;
  z-index: 1030;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(10px + env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) 10px max(16px, env(safe-area-inset-left, 0px));
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--c-line);
}
.credit-chip {
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--c-brand);
  background: #e3efe3;
  border-radius: 999px;
  padding: 4px 12px;
  text-decoration: none;
  white-space: nowrap;
}
.credit-chip:hover { color: var(--c-brand); background: #d6e8d7; }

.tab-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1030;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding: 6px max(4px, env(safe-area-inset-right, 0px)) calc(6px + env(safe-area-inset-bottom, 0px)) max(4px, env(safe-area-inset-left, 0px));
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: saturate(1.4) blur(10px);
  border-top: 1px solid var(--c-line);
}
.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-height: 48px;
  justify-content: center;
  color: var(--c-text-2);
  text-decoration: none;
  font-size: 0.6875rem;
  font-weight: 600;
  -webkit-tap-highlight-color: transparent;
  transition: transform var(--dur-press) var(--ease-out);
}
.tab:active { transform: scale(0.95); }
.tab-icon { display: grid; place-items: center; padding: 3px 16px; border-radius: 999px; transition: background-color 150ms ease-out; }
.tab-icon .ic { width: 22px; height: 22px; }
.tab.is-active { color: var(--c-brand); font-weight: 800; }
.tab.is-active .tab-icon { background: #e3efe3; }
.tab:hover { color: var(--c-text); }
.tab.is-active:hover { color: var(--c-brand); }

/* ---------- "Daugiau" sheet ---------- */
.more-sheet.offcanvas-bottom {
  height: auto;
  max-height: 85vh;
  border-radius: 20px 20px 0 0;
  border-top: 0;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.sheet-grab { width: 40px; height: 4px; border-radius: 4px; background: var(--c-line-strong); margin: 8px auto 0; }
.more-sheet .offcanvas-header { padding: 8px 20px 4px; }
.more-sheet .offcanvas-title { font-size: 1.125rem; font-weight: 800; }
.more-sheet .offcanvas-body { padding: 4px 12px 16px; display: flex; flex-direction: column; gap: 10px; }
.sheet-balance {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 12px 14px;
  border-radius: var(--radius-card);
  background: var(--c-surface-2);
  color: var(--c-text-2);
  text-decoration: none;
  font-size: 0.875rem;
}
.sheet-balance strong { color: var(--c-brand); font-weight: 800; }
.sheet-group { display: flex; flex-direction: column; }
.sheet-link {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 8px 12px;
  border-radius: var(--radius-ctl);
  color: var(--c-text);
  text-decoration: none;
  font-weight: 600;
}
.sheet-link > span { flex: 1; }
.sheet-link .ic { color: var(--c-text-2); }
.sheet-link .sheet-chev { width: 18px; height: 18px; color: var(--c-line-strong); }
.sheet-link:active, .sheet-link:hover { background: var(--c-surface-2); color: var(--c-text); }
.sheet-link.is-active { color: var(--c-brand); }
.sheet-link.is-active .ic { color: var(--c-brand); }

/* ---------- Breakpoints ---------- */
@media (min-width: 992px) {
  .app-bar, .tab-bar, .more-sheet { display: none !important; }
  .app-main { margin-left: var(--sidebar-w); }
  .page-content { padding: 32px 0 48px; }
  .page-content > .container { padding-left: 32px; padding-right: 32px; }
  .app-banner { padding: 24px 32px 0; }
}
@media (max-width: 991.98px) {
  .app-sidebar { display: none; }
  .app-main { padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px) + 16px); }
}

@media (prefers-reduced-motion: reduce) {
  .tab, .side-link, .tab-icon { transition: none; }
  .tab:active { transform: none; }
}

/* Count badge in navigation (pending sender requests) */
.nav-badge {
  margin-left: auto;
  min-width: 22px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--c-warn);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 800;
  text-align: center;
  line-height: 1.5;
}
.sheet-link .nav-badge { margin-left: 0; }
