/* ─────────────────────────────────────────────────────────────────────────
   Football Intelligence — Components
   Faza 1, redesign v2.

   Bazowe komponenty z REDESIGN_AUDIT.md §3 + addendum §10:
     Button, Card, Chip, Tabs, OddsPill, MatchRow, SkeletonLoader, Toast,
     ChatInput, Input, Select, PitchMap (stub — pełna implementacja w Fazie 4).

   Wymaga design-system.css załadowanego pierwszego (zależność od tokenów).
   ───────────────────────────────────────────────────────────────────────── */


/* === Button =============================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  padding: 0.625rem 1rem;
  min-height: 2.5rem;
  background: var(--surface-2);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: var(--text-body);
  font-weight: var(--weight-semibold);
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  transition: background-color var(--duration-fast) var(--easing-out),
              border-color var(--duration-fast) var(--easing-out),
              color var(--duration-fast) var(--easing-out),
              transform 0.1s var(--easing-out);
  user-select: none;
  white-space: nowrap;
}

.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

.btn:active:not(:disabled) { transform: translateY(1px); }

/* Primary CTA — crafted accent fill, not a flat block.
   Inspiracja: Linear / Vercel primary buttons + 21st.dev component polish.
   F5.18 refine — owner "zbyt zielono": full neon --accent fill read too loud on
   a large button, so the fill now sits on the DEEPER, desaturated accent band
   (--accent-muted → --accent-muted-strong). Still single-accent, just disciplined.
   The textured depth (top highlight, bottom inset, drop shadow) is preserved —
   only the hue is calmed and the accent glow toned right down.
   Layers (all single-accent, no rainbow):
     1. top-down muted-accent gradient gives subtle vertical depth
     2. inset 1px highlight on top edge = catches light like a real surface
     3. inset bottom shadow = grounds the fill (concave sheen)
     4. restrained accent-tinted drop shadow = lifts off the dark bg (no neon halo)
   Hover lifts the band one step + a touch more glow; :active flattens it (pressed). */
.btn--primary {
  background-image: linear-gradient(180deg, var(--accent-muted) 0%, var(--accent-muted-strong) 100%);
  color: var(--accent-fg);
  border-color: transparent;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.20),
    inset 0 -1px 0 rgba(0, 0, 0, 0.18),
    0 1px 2px rgba(0, 0, 0, 0.30),
    0 4px 14px -6px rgba(0, 184, 122, 0.28);
  transition: background-color var(--duration-fast) var(--easing-out),
              box-shadow var(--duration-fast) var(--easing-out),
              filter var(--duration-fast) var(--easing-out),
              transform 0.1s var(--easing-out);
}
.btn--primary:hover:not(:disabled) {
  background-image: linear-gradient(180deg, var(--accent-strong) 0%, var(--accent-muted) 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.24),
    inset 0 -1px 0 rgba(0, 0, 0, 0.18),
    0 2px 4px rgba(0, 0, 0, 0.32),
    0 6px 20px -6px rgba(0, 184, 122, 0.36);
}
.btn--primary:active:not(:disabled) {
  background-image: linear-gradient(180deg, var(--accent-muted-strong) 0%, var(--accent-muted) 100%);
  box-shadow:
    inset 0 1px 2px rgba(0, 0, 0, 0.24),
    0 1px 2px rgba(0, 0, 0, 0.28);
}

.btn--secondary {
  background: var(--surface-2);
  color: var(--text-primary);
  border-color: var(--border);
}
.btn--secondary:hover:not(:disabled) { background: var(--surface-3); border-color: var(--border-strong); }

.btn--ghost {
  background: transparent;
  color: var(--text-primary);
  border-color: var(--border);
}
.btn--ghost:hover:not(:disabled) {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

.btn--destructive {
  background: var(--system-red);
  color: var(--white);
}
.btn--destructive:hover:not(:disabled) { background: #d62845; }

.btn--sm { padding: 0.4rem 0.75rem; min-height: 2rem; font-size: var(--text-small); }
.btn--lg { padding: 0.85rem 1.5rem; min-height: 3rem; font-size: 1rem; }

.btn--block { width: 100%; }


/* === Card ================================================================= */

.card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-2);
  box-shadow: var(--shadow-sm);
}

.card--interactive {
  cursor: pointer;
  transition: transform var(--duration-fast) var(--easing-out),
              box-shadow var(--duration-fast) var(--easing-out),
              border-color var(--duration-fast) var(--easing-out);
}
.card--interactive:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: var(--border-strong);
}

.card--accent {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), var(--shadow-sm);
}

.card--flat { box-shadow: none; }

.card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-1);
  margin-bottom: var(--space-1);
}

.card__title {
  font-size: var(--text-h2);
  font-weight: var(--weight-semibold);
  line-height: var(--leading-snug);
  color: var(--text-primary);
  margin: 0;
}

.card__subtitle {
  font-size: var(--text-small);
  color: var(--text-secondary);
  margin: 0;
}


/* === Chip / Badge ========================================================= */

.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0.25rem 0.5rem;
  background: var(--surface-2);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  font-size: var(--text-small);
  font-weight: var(--weight-bold);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  line-height: 1;
}

.chip--neutral { background: var(--surface-2); color: var(--text-secondary); }
.chip--accent  { background: var(--accent-soft); color: var(--accent); }

.chip--low     { background: var(--risk-low-bg);    color: var(--risk-low-fg); }
.chip--medium  { background: var(--risk-medium-bg); color: var(--risk-medium-fg); }
.chip--high    { background: var(--risk-high-bg);   color: var(--risk-high-fg); }

.chip--success { background: rgba(29, 187, 121, 0.12); color: var(--system-green); }
.chip--danger  { background: rgba(255, 47, 84, 0.12);  color: var(--system-red); }
.chip--warning { background: rgba(217, 178, 122, 0.15); color: var(--risk-medium-fg); }

.chip--lg { padding: 0.35rem 0.7rem; font-size: 0.7rem; }


/* === Tabs (segmented control) ============================================= */

.tabs {
  display: inline-flex;
  gap: 2px;
  padding: 4px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.tabs__btn {
  padding: 0.5rem 1rem;
  background: transparent;
  border: none;
  border-radius: calc(var(--radius-md) - 4px);
  color: var(--text-tertiary);
  font-family: inherit;
  font-size: var(--text-body);
  font-weight: var(--weight-semibold);
  cursor: pointer;
  transition: background-color var(--duration-fast) var(--easing-out),
              color var(--duration-fast) var(--easing-out);
  white-space: nowrap;
}
.tabs__btn:hover:not([aria-selected="true"]) { color: var(--text-primary); }
.tabs__btn[aria-selected="true"] {
  background: var(--surface-3);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}
.tabs__btn:disabled { opacity: 0.4; cursor: not-allowed; }


/* === OddsPill ============================================================= */

.odds-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  position: relative;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  cursor: pointer;
  transition: border-color var(--duration-fast) var(--easing-out),
              background-color var(--duration-fast) var(--easing-out);
}
.odds-pill:hover { border-color: var(--border-strong); background: var(--surface-3); }

.odds-pill__bookmaker {
  font-size: 0.65rem;
  color: var(--text-tertiary);
  font-weight: var(--weight-bold);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  line-height: 1;
}

.odds-pill__odds {
  font-size: 1rem;
  font-weight: var(--weight-bold);
  color: var(--text-primary);
  line-height: 1;
}

.odds-pill__value {
  position: absolute;
  top: -8px;
  right: -8px;
  background: var(--accent);
  color: var(--accent-fg);
  font-size: 0.65rem;
  font-weight: var(--weight-bold);
  padding: 2px 6px;
  border-radius: var(--radius-pill);
  line-height: 1.2;
  white-space: nowrap;
}

.odds-pill--best { border-color: var(--accent); background: var(--accent-soft); }
.odds-pill--best .odds-pill__odds { color: var(--accent); }


/* === MatchRow ============================================================= */

.match-row {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto minmax(0, 1fr) 28px 18px;
  gap: var(--space-1);
  align-items: center;
  /* P1.16 audit fix: bumped from 0.7rem to 0.85rem to clear the 44px WCAG
     touch-target minimum on mobile match lists. */
  padding: 0.85rem var(--space-2);
  border-bottom: 1px solid var(--divider);
  cursor: pointer;
  transition: background-color var(--duration-fast) var(--easing-out);
  background: transparent;
}
.match-row:hover { background: var(--surface-2); }
.match-row:last-child { border-bottom: none; }

.match-row__league img {
  width: 24px; height: 24px;
  object-fit: contain;
  border-radius: var(--radius-sm);
}

.match-row__team {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: var(--text-body);
  font-weight: var(--weight-medium);
  color: var(--text-primary);
  min-width: 0;
}
.match-row__team--away { flex-direction: row-reverse; text-align: right; }

.match-row__team-logo {
  width: 22px; height: 22px;
  object-fit: contain;
  flex-shrink: 0;
}
/* 5.6.1: real badge img variant — same dimensions, ale bez circular crop
   (placeholder team-initial discy są round; real badges są full-shape jak
   transparent PNG z apifootball CDN). object-fit: contain zapewnia że tarcza
   nie jest squishowana gdy aspect != 1:1. */
.match-row__team-logo--img {
  border-radius: var(--radius-sm);
  background: transparent;
  border: none;
}

.match-row__team-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.match-row__center {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  font-size: var(--text-small);
  font-weight: var(--weight-bold);
  color: var(--text-secondary);
  text-align: center;
  min-width: 60px;
}
.match-row__center--score { color: var(--text-primary); font-size: var(--text-body); }
.match-row__center--live {
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  font-size: var(--text-body);
  /* 5.6.1: live mecze pokazują score (np. "1 — 0") zamiast clock-only.
     Chcemy żeby wyglądały jak score państwo o accent color, nie sub-text. */
}
.match-row__center--live::before {
  content: '';
  width: 7px; height: 7px;
  background: var(--system-red);
  border-radius: 50%;
  animation: live-pulse 1.4s ease-in-out infinite;
  flex-shrink: 0;
  /* prefers-reduced-motion globalny override w design-system.css:326 — animacja
     redukowana do 0.01ms iteration:1 → effectively static dot. */
}
/* 5.6.1: inner content box dla --live wariantu. Dot ::before zostaje inline
   na lewo, score i clock-sub stackują kolumnowo na prawo od dota. */
.match-row__center-content {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  line-height: 1;
}
/* 5.6.1: clock minute "67'" pod score gdy oba dostępne. Fallback do clock-only
   gdy score jeszcze nie nadszedł (kick-off second). Mała linia, mniejszy
   font-size, ostro tabular nums żeby nie "tańczyła" co minutę. */
.match-row__center-sub {
  display: block;
  font-size: 0.65rem;
  font-weight: var(--weight-medium);
  color: var(--text-tertiary);
  margin-top: 1px;
  letter-spacing: 0.02em;
}

.match-row__chevron {
  color: var(--text-tertiary);
  transition: color var(--duration-fast), transform var(--duration-fast);
  font-size: 1.1rem;
  line-height: 1;
}
.match-row:hover .match-row__chevron {
  color: var(--accent);
  transform: translateX(2px);
}


/* === SkeletonLoader ======================================================= */

.skeleton {
  background: linear-gradient(
    90deg,
    var(--surface-1) 25%,
    var(--surface-3) 50%,
    var(--surface-1) 75%
  );
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.4s ease-in-out infinite;
  border-radius: var(--radius-sm);
  display: block;
}

@keyframes skeleton-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton--row  { height: 56px; }
.skeleton--card { height: 200px; border-radius: var(--radius-md); }
.skeleton--hero { height: 320px; border-radius: var(--radius-md); }
.skeleton--text { height: 0.875em; width: 80%; }
.skeleton--avatar { width: 32px; height: 32px; border-radius: 50%; }


/* === Toast / Alert ======================================================== */

.toast {
  display: inline-flex;
  align-items: flex-start;
  gap: var(--space-1);
  padding: 0.75rem 1rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-left-width: 3px;
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: var(--text-body);
  line-height: var(--leading-snug);
  max-width: 400px;
  box-shadow: var(--shadow-lg);
}

.toast__icon {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  margin-top: 2px;
}

.toast__body { flex: 1; min-width: 0; }
.toast__title { font-weight: var(--weight-semibold); margin-bottom: 2px; }
.toast__desc  { color: var(--text-secondary); font-size: var(--text-small); }

.toast__close {
  background: transparent;
  border: none;
  color: var(--text-tertiary);
  padding: 0;
  margin-left: var(--space-1);
  font-size: 1rem;
  line-height: 1;
}
.toast__close:hover { color: var(--text-primary); }

.toast--success { border-left-color: var(--system-green); }
.toast--success .toast__icon { color: var(--system-green); }

.toast--error { border-left-color: var(--system-red); }
.toast--error   .toast__icon { color: var(--system-red); }

.toast--info { border-left-color: var(--accent); }
.toast--info    .toast__icon { color: var(--accent); }

.toast--warning { border-left-color: var(--risk-medium-fg); }
.toast--warning .toast__icon { color: var(--risk-medium-fg); }


/* === ChatInput ============================================================ */

.chat-input {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.75rem 0.875rem;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 1.25rem;
  transition: border-color var(--duration-fast) var(--easing-out),
              background-color var(--duration-fast) var(--easing-out);
}
.chat-input:focus-within {
  border-color: var(--accent);
  background: var(--surface-1);
}

.chat-input__textarea {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  line-height: var(--leading-snug);
  width: 100%;
  resize: none;
  min-height: 1.5rem;
  max-height: 200px;
  padding: 0;
}
.chat-input__textarea::placeholder { color: var(--text-tertiary); }

.chat-input__toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-1);
}

.chat-input__pills {
  display: flex;
  gap: 0.25rem;
  flex-wrap: wrap;
  align-items: center;
}

.chat-input__pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0.3rem 0.7rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  color: var(--text-secondary);
  font-size: var(--text-small);
  font-weight: var(--weight-medium);
  cursor: pointer;
  transition: background-color var(--duration-fast),
              border-color var(--duration-fast),
              color var(--duration-fast);
}
.chat-input__pill:hover { border-color: var(--accent); color: var(--accent); }
.chat-input__pill--active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

.chat-input__send {
  width: 32px; height: 32px;
  background: var(--accent);
  color: var(--accent-fg);
  border: none;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color var(--duration-fast), transform 0.1s;
  flex-shrink: 0;
}
.chat-input__send:hover:not(:disabled) { background: var(--accent-strong); }
.chat-input__send:active:not(:disabled) { transform: scale(0.95); }
.chat-input__send:disabled { opacity: 0.4; cursor: not-allowed; }


/* === Input ================================================================ */

.input {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.input__label {
  font-size: var(--text-small);
  font-weight: var(--weight-semibold);
  color: var(--text-secondary);
  letter-spacing: 0.025em;
}

.input__field {
  width: 100%;
  padding: 0.625rem 0.75rem;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: var(--text-body);
  line-height: var(--leading-normal);
  outline: none;
  transition: border-color var(--duration-fast) var(--easing-out),
              background-color var(--duration-fast) var(--easing-out);
}
.input__field::placeholder { color: var(--text-tertiary); }
.input__field:focus { border-color: var(--accent); }
.input__field:disabled { opacity: 0.5; cursor: not-allowed; background: var(--surface-2); }

.input__hint {
  font-size: var(--text-small);
  color: var(--text-tertiary);
}

.input--error .input__field { border-color: var(--system-red); }
.input--error .input__hint  { color: var(--system-red); }

.input--code .input__field {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  text-align: center;
  letter-spacing: 0.5em;
  padding-left: 1.25rem;
  font-variant-numeric: tabular-nums;
}


/* === Select =============================================================== */

.select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  width: 100%;
  padding: 0.625rem 2.25rem 0.625rem 0.75rem;
  background-color: var(--surface-1);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none'><path d='M3 4.5L6 7.5L9 4.5' stroke='%237a96a8' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: var(--text-body);
  cursor: pointer;
  outline: none;
  transition: border-color var(--duration-fast) var(--easing-out);
}
.select:focus { border-color: var(--accent); }
.select:disabled { opacity: 0.5; cursor: not-allowed; background-color: var(--surface-2); }


/* === PitchMap (stub — pełna implementacja w Fazie 4) ====================== */

.pitch-map {
  position: relative;
  width: 100%;
  max-width: 360px;
  aspect-ratio: 100 / 150;
  margin: 0 auto;
  background:
    radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.04), transparent 50%),
    linear-gradient(135deg, #0d2818 0%, #0a1f12 50%, #0d2818 100%);
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border);
}

.pitch-map__svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.pitch-map__svg path,
.pitch-map__svg line,
.pitch-map__svg circle,
.pitch-map__svg rect {
  fill: none;
  stroke: rgba(255, 255, 255, 0.18);
  stroke-width: 0.4;
  vector-effect: non-scaling-stroke;
}

.pitch-map__player {
  position: absolute;
  width: 12%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  cursor: pointer;
  transition: transform var(--duration-fast) var(--easing-pop);
}
.pitch-map__player:hover { transform: translate(-50%, -54%) scale(1.06); z-index: 1; }

.pitch-map__player-avatar {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--surface-3);
  border: 2px solid var(--accent);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: var(--weight-bold);
  color: var(--text-primary);
}
.pitch-map__player-avatar img { width: 100%; height: 100%; object-fit: cover; }

.pitch-map__player-name {
  font-size: 0.55rem;
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
  white-space: nowrap;
  max-width: 8rem;
  overflow: hidden;
  text-overflow: ellipsis;
}


/* === Side panel (modal alternative — §5.5 audytu) ========================= */

.side-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 480px;
  max-width: 100vw;
  height: 100vh;
  background: var(--surface-1);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  z-index: var(--z-modal);
  transform: translateX(100%);
  transition: transform var(--duration-base) var(--easing-out);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}
.side-panel--open { transform: translateX(0); }

.side-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-2);
  border-bottom: 1px solid var(--divider);
  position: sticky;
  top: 0;
  background: var(--surface-1);
  z-index: 1;
}
.side-panel__title {
  font-size: var(--text-h2);
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
  margin: 0;
}
.side-panel__close {
  background: transparent;
  border: none;
  color: var(--text-tertiary);
  font-size: 1.25rem;
  padding: 0.25rem 0.5rem;
}
.side-panel__close:hover { color: var(--text-primary); }
.side-panel__body { padding: var(--space-2); flex: 1; }


/* P4.3.5: optional team fanart background (set via JS w openSidePanel({ bgImage })).
   Custom property --side-panel-bg-image holds url('...'). Gradient overlay
   zapewnia text legibility — pełny dark u góry (header), miękki tonal fade
   z fanart przebija się minimalnie u dołu. */
.side-panel--with-bg {
  background-color: var(--surface-1);
  background-image:
    linear-gradient(180deg, rgba(11, 17, 24, 0.97) 0%, rgba(11, 17, 24, 0.94) 50%, rgba(11, 17, 24, 0.85) 100%),
    var(--side-panel-bg-image);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: local;
}


/* === Mobile breakpoints =================================================== */

@media (max-width: 640px) {
  .match-row {
    grid-template-columns: 24px minmax(0, 1fr) auto minmax(0, 1fr) 24px;
    gap: 0.5rem;
    padding: 0.6rem var(--space-1);
  }
  .match-row__chevron { display: none; }
  .side-panel { width: 100vw; }
  .tabs__btn { padding: 0.4rem 0.7rem; }
}


/* === Auth modal (Faza 5.4.1) ============================================ */

.auth-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 999;
  opacity: 0;
  transition: opacity 0.2s var(--easing-pop, ease);
}
.auth-modal-backdrop--visible {
  opacity: 1;
}

.auth-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -48%);
  width: calc(100% - 32px);
  max-width: 420px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  /* Karol: same diagonal-hatch texture as the main page (.app-shell::before
     in bg-paths.css) so the login panel reads as a "window" into the same
     atmosphere. Hatch SVG + two faint accent-tinted corner glows on top of
     the standard surface-1 base. Stroke opacity 0.022 / glow 0.07-0.05 —
     bumped slightly above the main-page values because the panel is smaller
     so the texture needs more presence to read at all. */
  background-color: var(--surface-1);
  background-image:
    radial-gradient(45% 35% at 8% -6%,   rgba(0, 229, 160, 0.085) 0%, transparent 65%),
    radial-gradient(50% 40% at 105% 110%, rgba(0, 229, 160, 0.055) 0%, transparent 65%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40'%3E%3Cpath d='M-1 21 L21 -1 M9 41 L41 9' stroke='%23ffffff' stroke-opacity='0.028' stroke-width='1'/%3E%3C/svg%3E");
  background-repeat: no-repeat, no-repeat, repeat;
  background-size: auto, auto, 40px 40px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg, 12px);
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.6);
  padding: var(--space-3);
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.2s var(--easing-pop, ease), transform 0.2s var(--easing-pop, ease);
}
.auth-modal--visible {
  opacity: 1;
  transform: translate(-50%, -50%);
}

.auth-modal__close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 32px;
  height: 32px;
  background: transparent;
  border: none;
  color: var(--text-tertiary);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: background-color var(--duration-fast), color var(--duration-fast);
}
.auth-modal__close:hover {
  background: var(--surface-2);
  color: var(--text-primary);
}

.auth-modal__title {
  margin: 0 0 var(--space-2);
  font-size: 1.5rem;
  letter-spacing: -0.01em;
}

.auth-modal__form {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.auth-modal__field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.auth-modal__field input {
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font: inherit;
  font-size: 0.95rem;
  transition: border-color var(--duration-fast);
}
.auth-modal__field input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 0;
  border-color: var(--accent);
}

.auth-modal__checkbox {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  cursor: pointer;
  user-select: none;
  margin-top: 4px;
}
.auth-modal__checkbox input {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  margin-top: 1px;
  cursor: pointer;
}

.auth-modal__error {
  padding: 10px 12px;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: var(--radius-sm);
  color: var(--system-red, #ef4444);
  font-size: 0.85rem;
  font-weight: var(--weight-semibold);
}

.auth-modal__submit {
  margin-top: var(--space-1);
  width: 100%;
}

.auth-modal__footer {
  margin-top: var(--space-2);
  padding-top: var(--space-2);
  border-top: 1px solid var(--border);
  text-align: center;
}

.auth-modal__switch {
  color: var(--accent);
  text-decoration: none;
  font-weight: var(--weight-semibold);
}
.auth-modal__switch:hover {
  text-decoration: underline;
}

/* Demo verification code display (gdy backend zwraca code w response — dev mode bez SMTP) */
.auth-modal__demo-code {
  padding: 12px;
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: var(--radius-sm);
  margin: var(--space-2) 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: center;
}
.auth-modal__demo-code-val {
  font-size: 1.5rem;
  letter-spacing: 0.2em;
  color: var(--system-amber, #f59e0b);
}


/* === Inline tooltip trigger (CSS-only, :hover popover) =================== */
/* Usage: <span class="fi-tooltip-trigger" data-tooltip="Explanation…">Label</span>
   The [data-tooltip] content renders as a floating box above the trigger on
   hover / focus. No JS required. Works in every browser that supports ::before
   + attr(). Safe inside flex / grid — position:relative scopes the pseudo. */

.fi-tooltip-trigger {
  position: relative;
  cursor: help;
  border-bottom: 1px dotted var(--text-tertiary);
  display: inline;
}

.fi-tooltip-trigger::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  white-space: normal;
  width: max-content;
  max-width: min(260px, 80vw);
  background: var(--surface-3, #1e2a24);
  color: var(--text-primary);
  font-size: 0.78rem;
  font-weight: 400;
  line-height: 1.4;
  padding: 7px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
  pointer-events: none;
  opacity: 0;
  transition: opacity 150ms ease;
  z-index: 50;
}

.fi-tooltip-trigger:hover::after,
.fi-tooltip-trigger:focus-visible::after {
  opacity: 1;
}

/* Small down-pointing caret */
.fi-tooltip-trigger::before {
  content: '';
  position: absolute;
  bottom: calc(100% + 1px);
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: var(--border);
  opacity: 0;
  transition: opacity 150ms ease;
  pointer-events: none;
  z-index: 51;
}

.fi-tooltip-trigger:hover::before,
.fi-tooltip-trigger:focus-visible::before {
  opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
  .fi-tooltip-trigger::after,
  .fi-tooltip-trigger::before { transition: none; }
}
