/* ui.css — wspólne style bazowe i tokeny dla całego serwisu */

/* Reset i elementy bazowe */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, "Cantarell", "Noto Sans", sans-serif;
  background: var(--bg-0, #0c0f10);
  color: var(--text, #e7f0ec);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }

/* Design tokens (wspólne) */
:root {
  /* Tła */
  --bg-0: #0c0f10;
  --bg-1: #101416;
  --bg-2: #141b1e;
  --bg-3: #1a2327;
  /* Teksty i akcenty */
  --text: #e7f0ec;
  --muted: #92a19a; /* ujednolicone */
  --divider: #25343b;
  --accent: #74f0b3;
  --accent-2: #57d794;
  --accent-strong: #46c889;
  /* Promienie i cienie */
  --radius-sm: 12px;
  --radius-md: 18px;
  --radius-lg: 26px;
  --radius: 18px; /* alias */
  --shadow: 0 32px 80px rgba(0, 0, 0, 0.55);
  /* Animacje */
  --ease: cubic-bezier(.4,.18,.25,1);
}

/* Wspólny shell: layout, sidebar, header, nav */
.app {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 100dvh;
  width: min(1400px, 100%);
  margin: 0 auto;
  background: var(--bg-0);
}

.sidebar {
  background: var(--bg-1);
  padding: 24px;
  border-right: 1px solid var(--divider);
  position: sticky;
  top: 0;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  gap: 24px;
  overflow: hidden;
}
.sidebar-scroll { overflow-y: auto; padding-right: 8px; display: flex; flex-direction: column; gap: 24px; }
.brand { display: flex; align-items: center; gap: 14px; }
.brand-logo {
  width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center;
  background: linear-gradient(180deg, #2c3f37, #16211d); color: var(--accent);
  border: 1px solid #1e2b26; box-shadow: inset 0 0 0 2px rgba(116,240,179,.15);
}
.brand-text { display: flex; flex-direction: column; }
.brand-text strong { font-weight: 600; color: var(--text); }
.brand-text small { color: var(--muted); }

.nav-header { margin: 6px 0; color: #7f8b86; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; font-weight: 600; }
.nav { display: flex; flex-direction: column; gap: 8px; }
.nav a.menu-item {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px;
  color: var(--text); transition: background .25s var(--ease), color .25s var(--ease), transform .25s var(--ease);
}
.nav a.menu-item svg { width: 18px; height: 18px; opacity: .85; }
.nav a.menu-item:hover { background: #161d1f; color: var(--accent); transform: translateX(4px); }
.nav a.menu-item.active {
  background: linear-gradient(90deg, rgba(116,240,179,.18), transparent);
  outline: 1px solid rgba(116,240,179,.25);
  color: var(--accent);
}

.header {
  display: flex; align-items: center; gap: 14px; padding: 22px 26px;
  border-bottom: 1px solid rgba(37,52,59,.75);
  background: linear-gradient(180deg, rgba(21,28,30,.78), rgba(16,22,24,.55));
  backdrop-filter: blur(9px);
  position: sticky; top: 0; z-index: 30;
}
.hamburger { display: none; place-items: center; width: 38px; height: 38px; border-radius: 12px; background: #151b1d; border: 1px solid var(--divider); color: var(--text); }
.page-title { font-weight: 700; font-size: 18px; color: var(--accent); }
.back-button {
  margin-left: auto; display: inline-flex; align-items: center; gap: .6rem; padding: .78rem 1.2rem;
  border-radius: 14px; border: 1px solid rgba(116,240,179,.26); background: rgba(18,26,29,.72);
  color: var(--accent); font-weight: 600; font-size: .92rem; letter-spacing: .02em;
  transition: transform .2s var(--ease), box-shadow .2s var(--ease), border-color .2s var(--ease);
}
.back-button:hover, .back-button:focus-visible {
  transform: translateY(-2px);
  border-color: rgba(116,240,179,.45);
  box-shadow: 0 16px 36px rgba(16,24,26,.45);
  outline: none;
}

.sidebar-backdrop { position: fixed; inset: 0; background: rgba(8,12,13,.7); backdrop-filter: blur(6px); opacity: 0; pointer-events: none; transition: opacity .25s var(--ease); z-index: 40; }
.sidebar-backdrop.show { opacity: 1; pointer-events: auto; }

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; width: 100%; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 280px; transform: translateX(-110%); transition: transform .3s var(--ease); z-index: 60; box-shadow: 20px 0 45px rgba(0,0,0,.45); }
  .sidebar.open { transform: translateX(0); }
  .hamburger { display: grid; }
}

/* Link pomijania do treści (skip-link) */
.skip-link {
  position: absolute;
  left: -10000px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}
.skip-link:focus {
  left: 1rem;
  top: 1rem;
  width: auto;
  height: auto;
  padding: 0.75rem 1rem;
  background: var(--bg-3);
  border-radius: 12px;
  border: 1px solid var(--divider);
  z-index: 1000;
}

/* Globalny focus ring (preferowana metoda: :focus-visible) */
:where(a, button, [role="button"], input, select, textarea, summary, [tabindex]:not([tabindex="-1"])):focus-visible {
  outline: 2px solid color-mix(in oklab, var(--accent), white 10%);
  outline-offset: 2px;
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--accent), transparent 70%);
  border-radius: 10px; /* bezpieczny, nie nachodzi na okrągłe przyciski */
}

/* Zmniejszenie ruchu: animacje i przejścia */
@media (prefers-reduced-motion: reduce) {
  :root {
    scroll-behavior: auto;
  }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* Dostępne skróty/utility (niskie ryzyko) */
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0);
  white-space: nowrap; border: 0;
}

/* Alias dla spójności z istniejącymi elementami dostępności */
.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0);
  white-space: nowrap; border: 0;
}
