/* Stones Collection — design system w stylu shadcn/ui (motyw violet) + font Inter.
   WCAG 2.1 AA: kontrasty, widoczny focus, pełna obsługa klawiaturą. */

/* ---- Font: Inter (self-hosted, wariant zmienny 400-700) ---- */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('/assets/fonts/inter-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('/assets/fonts/inter-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ---- Tokeny shadcn (motyw violet) ---- */
:root {
  --background: 0 0% 100%;
  --foreground: 224 71.4% 4.1%;
  --card: 0 0% 100%;
  --card-foreground: 224 71.4% 4.1%;
  --primary: 262.1 83.3% 57.8%;
  --primary-foreground: 210 20% 98%;
  --secondary: 220 14.3% 95.9%;
  --secondary-foreground: 220.9 39.3% 11%;
  --muted: 220 14.3% 95.9%;
  --muted-foreground: 220 8.9% 41%;
  --accent: 220 14.3% 95.9%;
  --accent-foreground: 220.9 39.3% 11%;
  --destructive: 0 72.2% 50.6%;
  --destructive-foreground: 210 20% 98%;
  --success: 142.1 70.2% 29.3%;
  --success-foreground: 210 20% 98%;
  --border: 220 13% 91%;
  --input: 220 13% 87%;
  --ring: 262.1 83.3% 57.8%;
  --star: 32 95% 38%;
  --radius: 0.625rem;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.07), 0 2px 4px -2px rgb(0 0 0 / 0.07);
}
@media (prefers-color-scheme: dark) {
  :root {
    --background: 224 71.4% 4.1%;
    --foreground: 210 20% 98%;
    --card: 222 47% 7%;
    --card-foreground: 210 20% 98%;
    --primary: 263.4 80% 66%;
    --primary-foreground: 224 71.4% 4.1%;
    --secondary: 215 27.9% 16.9%;
    --secondary-foreground: 210 20% 98%;
    --muted: 215 27.9% 16.9%;
    --muted-foreground: 217.9 10.6% 68%;
    --accent: 215 27.9% 16.9%;
    --accent-foreground: 210 20% 98%;
    --destructive: 0 72% 61%;
    --destructive-foreground: 224 71.4% 4.1%;
    --success: 142.1 60% 45%;
    --success-foreground: 224 71.4% 4.1%;
    --border: 215 27.9% 16.9%;
    --input: 215 27.9% 22%;
    --ring: 263.4 80% 66%;
    --star: 38 92% 55%;
  }
}

* { box-sizing: border-box; border-color: hsl(var(--border)); }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---- Ikony (Font Awesome Free, inline SVG) ---- */
.icon { width: 1em; height: 1em; flex-shrink: 0; vertical-align: -0.125em; }
.icon-lg { width: 1.4em; height: 1.4em; }
h1 .icon { width: .85em; height: .85em; color: hsl(var(--primary)); margin-right: .15em; }

/* ---- Lekki motion ---- */
@keyframes fade-up {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}
@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
main > * { animation: fade-up .45s cubic-bezier(.21,.61,.35,1) both; }
main > *:nth-child(2) { animation-delay: .05s; }
main > *:nth-child(3) { animation-delay: .1s; }
main > *:nth-child(4) { animation-delay: .15s; }
main > *:nth-child(n+5) { animation-delay: .2s; }
.grid > li { animation: fade-up .5s cubic-bezier(.21,.61,.35,1) both; }
.grid > li:nth-child(1) { animation-delay: .05s; }
.grid > li:nth-child(2) { animation-delay: .1s; }
.grid > li:nth-child(3) { animation-delay: .15s; }
.grid > li:nth-child(4) { animation-delay: .2s; }
.grid > li:nth-child(n+5) { animation-delay: .25s; }

body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-size: 1rem;
  line-height: 1.65;
  color: hsl(var(--foreground));
  background: hsl(var(--background));
  -webkit-font-smoothing: antialiased;
  font-feature-settings: 'cv11';
}

img, svg { max-width: 100%; height: auto; }
.wrap { max-width: 1100px; margin: 0 auto; padding: 0 1rem; }

a { color: hsl(var(--primary)); text-underline-offset: 3px; }
a:hover { opacity: .85; }
:focus-visible {
  outline: 2px solid hsl(var(--ring));
  outline-offset: 2px;
  border-radius: calc(var(--radius) - 4px);
}

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: hsl(var(--primary)); color: hsl(var(--primary-foreground));
  padding: .6rem 1rem; border-radius: 0 0 var(--radius) 0; text-decoration: none;
}
.skip-link:focus { left: 0; }

/* ---- Nagłówek ---- */
.site-header {
  background: hsl(var(--background) / .95);
  border-bottom: 1px solid hsl(var(--border));
  padding: 1rem 0;
  position: sticky; top: 0; z-index: 40;
  backdrop-filter: blur(8px);
}
.header-inner {
  display: flex; flex-wrap: wrap; gap: .75rem 1.5rem;
  align-items: center; justify-content: space-between;
}
.brand {
  display: flex; align-items: center; gap: .6rem;
  color: hsl(var(--primary)); text-decoration: none;
  transition: opacity .15s;
}
.brand:hover { opacity: .8; }
.brand-logo { width: 34px; height: 34px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
/* subtelniejszy dopisek przy logo */
.brand-name {
  font-size: .95rem; font-weight: 600; letter-spacing: -0.01em;
  color: hsl(var(--foreground));
}
.brand-tag { font-size: .7rem; font-weight: 400; color: hsl(var(--muted-foreground) / .85); letter-spacing: .01em; }

/* menu jak na stronie shadcn: stonowane linki, foreground po najechaniu */
.main-nav ul {
  display: flex; flex-wrap: wrap; gap: .1rem;
  list-style: none; margin: 0; padding: 0; align-items: center;
}
.main-nav a, .main-nav .linklike {
  display: inline-flex; align-items: center; gap: .45rem; height: 2.25rem;
  padding: 0 .7rem; border-radius: calc(var(--radius) - 2px);
  text-decoration: none; color: hsl(var(--muted-foreground));
  font-weight: 500; font-size: .875rem;
  background: none; border: 0; cursor: pointer; font-family: inherit;
  transition: background-color .15s, color .15s;
}
.main-nav a:hover, .main-nav .linklike:hover {
  background: hsl(var(--accent) / .7); color: hsl(var(--foreground)); opacity: 1;
}
.main-nav .icon { width: .95em; height: .95em; opacity: .9; }
.main-nav .nav-cta {
  background: hsl(var(--primary)); color: hsl(var(--primary-foreground));
  font-weight: 600; box-shadow: var(--shadow-sm); margin-left: .35rem;
  transition: background-color .15s, transform .15s;
}
.main-nav .nav-cta:hover { background: hsl(var(--primary) / .9); color: hsl(var(--primary-foreground)); transform: translateY(-1px); }
.main-nav .nav-admin { color: hsl(var(--primary)); font-weight: 600; }
.inline-form { display: inline; }

main { padding: 2.75rem 1rem 5rem; }

/* ---- Hierarchia typograficzna (jak w blokach shadcn) ---- */
h1 { font-size: clamp(1.8rem, 4vw, 2.4rem); line-height: 1.15; letter-spacing: -0.035em; font-weight: 700; margin: .5rem 0 1rem; }
h2 { font-size: 1.35rem; line-height: 1.3; letter-spacing: -0.02em; font-weight: 600; margin: 3rem 0 1.1rem; }
.lead { color: hsl(var(--muted-foreground)); font-size: 1.1rem; line-height: 1.7; max-width: 62ch; margin: 0 0 1.5rem; }

/* Nagłówek strony: tytuł + opis, oddzielone separatorem od treści */
.page-header { margin-bottom: 2.5rem; padding-bottom: 1.9rem; border-bottom: 1px solid hsl(var(--border)); }
.page-header h1 { margin: .25rem 0 .5rem; }
.page-header .lead { margin: 0; }

/* Okruszki nad tytułem */
nav[aria-label="Okruszki"] { font-size: .875rem; }
nav[aria-label="Okruszki"] a {
  display: inline-flex; align-items: center; gap: .4rem;
  color: hsl(var(--muted-foreground)); text-decoration: none; font-weight: 500;
  transition: color .15s, gap .15s;
}
nav[aria-label="Okruszki"] a:hover { color: hsl(var(--foreground)); opacity: 1; gap: .55rem; }
nav[aria-label="Okruszki"] .icon { width: .8em; height: .8em; }

/* ---- Alert (komunikaty flash jako pływający toast — widoczny
       niezależnie od pozycji przewinięcia strony) ---- */
.flash-stack {
  position: fixed; top: 4.5rem; left: 50%; transform: translateX(-50%);
  z-index: 60; width: min(92vw, 30rem);
  display: flex; flex-direction: column; gap: .5rem;
}
.flash {
  padding: .85rem 1.05rem; border-radius: var(--radius);
  margin: 0; font-weight: 500; font-size: .925rem;
  border: 1px solid hsl(var(--border)); background: hsl(var(--card));
  box-shadow: var(--shadow-md); cursor: pointer;
  animation: fade-up .4s cubic-bezier(.21,.61,.35,1) both;
  transition: opacity .4s, transform .4s;
}
.flash.flash-out { opacity: 0; transform: translateY(-8px); }
.flash-ok    { border-color: hsl(var(--success) / .45); color: hsl(var(--success)); background: hsl(var(--success) / .08); }
.flash-error { border-color: hsl(var(--destructive) / .45); color: hsl(var(--destructive)); background: hsl(var(--destructive) / .08); }
.flash-info  { border-color: hsl(var(--primary) / .45); color: hsl(var(--primary)); background: hsl(var(--primary) / .08); }

/* ---- Karta filtrów ---- */
.filters {
  display: flex; flex-wrap: wrap; gap: 1.1rem 1.25rem; align-items: end;
  background: hsl(var(--card)); border: 1px solid hsl(var(--border));
  border-radius: var(--radius); padding: 1.4rem 1.5rem; margin: 0 0 1.25rem;
  box-shadow: var(--shadow-sm);
}
/* przyklejone filtry pod nagłówkiem (tylko desktop — na telefonie zasłaniałyby treść);
   --header-h / --filters-h ustawia app.js po zmierzeniu rzeczywistych wysokości */
@media (min-width: 760px) {
  .filters {
    position: sticky; top: calc(var(--header-h, 69px) + .6rem); z-index: 30;
  }
}
.filters .field { margin: 0; }
.filters input[type="search"], .filters select { min-width: 10.5rem; }

/* ---- Galeria: shadcn Card ---- */
.grid {
  display: grid; gap: 1.5rem;
  grid-template-columns: repeat(auto-fill, minmax(min(250px, 100%), 1fr));
  padding: 0; margin: 1.75rem 0 0; list-style: none;
}
.card {
  background: hsl(var(--card)); color: hsl(var(--card-foreground));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; position: relative;
  transition: box-shadow .2s ease, border-color .2s ease, transform .2s ease;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: hsl(var(--ring) / .45); }
.card-media { position: relative; overflow: hidden; }
.card-img {
  aspect-ratio: 4 / 3; object-fit: cover; width: 100%; display: block;
  background: hsl(var(--muted));
  transition: transform .35s cubic-bezier(.21,.61,.35,1);
}
.card:hover .card-img { transform: scale(1.045); }
/* pływająca pigułka ulubionych (styl Vinted) — nad zdjęciem, prawy dolny róg */
.card-media .fav-pill-form, .card-media .fav-pill-link {
  position: absolute; bottom: .6rem; right: .6rem; z-index: 2; margin: 0;
}
.card-body { padding: 1.2rem 1.3rem 1.35rem; display: flex; flex-direction: column; gap: .55rem; flex: 1; }
.card h2, .card h3 { margin: 0; font-size: 1.15rem; font-weight: 600; letter-spacing: -0.015em; line-height: 1.35; }
.card .col-group { padding-top: .25rem; }
.card .col-group .fav-form { padding: 0; }
.mineral-facts .col-group { margin-top: .6rem; }
.card a.card-link { text-decoration: none; color: hsl(var(--card-foreground)); }
.card a.card-link:hover { color: hsl(var(--primary)); opacity: 1; }
.card a.card-link::after { content: ""; position: absolute; inset: 0; } /* cała karta klikalna */
.card-meta { display: flex; flex-wrap: wrap; gap: .35rem; margin: 0; }
.card-short { font-size: .875rem; color: hsl(var(--muted-foreground)); margin: 0; }

/* ---- Badge (shadcn) ---- */
.badge {
  display: inline-flex; align-items: center;
  border: 1px solid transparent; border-radius: 9999px;
  padding: .125rem .65rem; font-weight: 600; font-size: .74rem; line-height: 1.35;
  white-space: nowrap;
}
.badge-mineral { background: hsl(var(--primary) / .12); color: hsl(var(--primary)); border-color: hsl(var(--primary) / .25); }
.badge-skala   { background: hsl(173 80% 40% / .12); color: hsl(174 84% 25%); border-color: hsl(173 80% 40% / .3); }
.badge-rarity  { background: hsl(32 95% 44% / .12); color: hsl(26 90% 32%); border-color: hsl(32 95% 44% / .3); }
.badge-pending { background: hsl(var(--destructive) / .12); color: hsl(var(--destructive)); border-color: hsl(var(--destructive) / .3); }
.badge-top {
  background: hsl(var(--primary)); color: hsl(var(--primary-foreground));
  border-color: transparent; gap: .45rem; box-shadow: var(--shadow-md);
  padding: .2rem .7rem; font-size: .78rem;
}
.badge-top .icon { width: .9em; height: .9em; }
/* odznaka TOP nad zdjęciem — prawy górny róg, 20px od góry i brzegu */
.card-media .badge-top, .mineral-media .badge-top {
  position: absolute; top: 20px; right: 20px; z-index: 2;
}
@media (prefers-color-scheme: dark) {
  .badge-skala  { color: hsl(172 66% 60%); }
  .badge-rarity { color: hsl(38 92% 60%); }
}

/* licznik polubień przy serduszku */
.fav-count {
  display: inline-flex; align-items: center; gap: .45rem;
  color: hsl(var(--destructive)); font-weight: 600; font-size: .9rem;
}
.fav-count .icon { width: .95em; height: .95em; }
.fav-count-num { color: hsl(var(--foreground)); margin-left: .05rem; }
.text-ok { color: hsl(var(--success)); }
.text-warn { color: hsl(var(--star)); }

.fav-form { position: relative; z-index: 2; margin-top: auto; }
/* przycisk-serduszko = shadcn Button outline (sm, pill) */
.fav-btn {
  display: inline-flex; align-items: center; gap: .35rem; height: 2.1rem;
  background: hsl(var(--background)); color: hsl(var(--foreground));
  border: 1px solid hsl(var(--input)); border-radius: 9999px;
  padding: 0 .85rem; cursor: pointer; font-size: .84rem; font-weight: 500; font-family: inherit;
  transition: background-color .15s, border-color .15s;
}
.fav-btn:hover { background: hsl(var(--accent)); }
.fav-btn[aria-pressed="true"] {
  background: hsl(var(--destructive) / .1); border-color: hsl(var(--destructive) / .4);
  color: hsl(var(--destructive)); font-weight: 600;
}

/* pigułka ulubionych w stylu Vinted: serce + licznik */
.fav-pill {
  display: inline-flex; align-items: center; gap: .4rem; height: 2.1rem;
  padding: 0 .85rem; border-radius: 9999px; cursor: pointer;
  background: hsl(var(--card)); color: hsl(var(--foreground));
  border: 1px solid hsl(var(--input)); box-shadow: var(--shadow-sm);
  font: inherit; font-size: .9rem; font-weight: 600; text-decoration: none;
  transition: background-color .15s, border-color .15s, transform .1s;
}
.fav-pill:hover { background: hsl(var(--accent)); opacity: 1; }
.fav-pill:active { transform: scale(.94); }
.fav-pill .icon { width: 1.05em; height: 1.05em; color: hsl(var(--destructive)); }
.fav-pill .fav-count-num { color: hsl(var(--foreground)); }
.fav-pill[aria-pressed="true"] { border-color: hsl(var(--destructive) / .4); }

/* serduszko pełne/kontur sterowane stanem przycisku (przycisk i pigułka) */
.fav-btn .icon-on, .fav-pill .icon-on { display: none; }
.fav-btn[aria-pressed="true"] .icon-on,
.fav-pill[aria-pressed="true"] .icon-on { display: inline-block; }
.fav-btn[aria-pressed="true"] .icon-off,
.fav-pill[aria-pressed="true"] .icon-off { display: none; }

/* przyciski kolekcji: „mam” (zielony) i „poszukuję” (bursztynowy) */
.col-group { display: flex; flex-wrap: wrap; gap: .4rem; }
.col-group .fav-form { margin: 0; padding: 0; }
.col-btn.col-mam[aria-pressed="true"] {
  background: hsl(var(--success) / .12); border-color: hsl(var(--success) / .45);
  color: hsl(var(--success)); font-weight: 600;
}
.col-btn.col-szukam[aria-pressed="true"] {
  background: hsl(var(--star) / .12); border-color: hsl(var(--star) / .5);
  color: hsl(var(--star)); font-weight: 600;
}

/* chipy z licznikami kolekcji pod tytułem */
.collection-stats { display: flex; flex-wrap: wrap; gap: .5rem; margin: 1.1rem 0 0; }
.collection-stats a, .collection-stats span {
  display: inline-flex; align-items: center; gap: .45rem;
  border: 1px solid hsl(var(--input)); border-radius: 9999px;
  padding: .3rem .85rem; font-size: .84rem; font-weight: 500;
  color: hsl(var(--foreground)); text-decoration: none; background: hsl(var(--background));
  transition: background-color .15s, border-color .15s;
}
.collection-stats a:hover { background: hsl(var(--accent)); opacity: 1; }
.collection-stats a[aria-current="page"] {
  background: hsl(var(--primary) / .1); border-color: hsl(var(--primary)); color: hsl(var(--primary));
}
.collection-stats .icon { width: .9em; height: .9em; }

/* potwierdzenie zapisu przy formularzu (AJAX) */
.form-status {
  color: hsl(var(--success)); font-size: .85rem; font-weight: 600;
  margin: .6rem 0 0; animation: fade-up .3s ease-out both;
}

/* powroty z kotwicą nie mogą chować się pod przyklejonym nagłówkiem */
.mineral-facts, .note-box, tr[id] { scroll-margin-top: calc(var(--header-h, 69px) + 1.25rem); }
/* karty w galerii dodatkowo muszą ominąć przyklejone filtry */
.card { scroll-margin-top: calc(var(--header-h, 69px) + var(--filters-h, 0px) + 1.5rem); }
/* delikatne podświetlenie wiersza, do którego wróciliśmy po akcji */
tr[id]:target td { background: hsl(var(--primary) / .07); }

/* ---- Strona minerału ---- */
.mineral-page { display: grid; gap: 2.75rem; grid-template-columns: 1fr; }
@media (min-width: 760px) { .mineral-page { grid-template-columns: minmax(0, 5fr) minmax(0, 4fr); align-items: start; } }
.mineral-media { position: relative; }
.mineral-photo { border-radius: var(--radius); border: 1px solid hsl(var(--border)); box-shadow: var(--shadow-md); width: 100%; display: block; }
.mineral-facts {
  background: hsl(var(--card)); border: 1px solid hsl(var(--border));
  border-radius: var(--radius); padding: 1.5rem 1.6rem; box-shadow: var(--shadow-sm);
}
.mineral-facts dl { margin: 0; }
/* wyraźny odstęp między kategoriami (z subtelnym separatorem) */
.mineral-facts dt {
  font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .05em;
  color: hsl(var(--muted-foreground)); margin-top: 1.4rem;
  padding-top: 1.4rem; border-top: 1px solid hsl(var(--border));
}
.mineral-facts dt:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.mineral-facts dd { margin: .4rem 0 0; }
.mineral-facts .fav-form { margin-top: 1.4rem; }
.mineral-desc p { max-width: 65ch; margin: 0 0 1.15rem; }
.mineral-desc .rich-text { max-width: 65ch; }
.mineral-desc .rich-text p { margin: 0 0 1.15rem; }
.mineral-desc .rich-text br { display: block; content: ""; margin-top: .5rem; }

/* ---- Panel / formularze (shadcn Card + Input) ---- */
form.panel, .panel {
  background: hsl(var(--card)); color: hsl(var(--card-foreground));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius); padding: 2rem; max-width: 34rem; box-shadow: var(--shadow-sm);
}
.panel-wide { max-width: none; }
.field { margin-bottom: 1.35rem; }
label { display: block; font-weight: 500; font-size: .875rem; margin-bottom: .5rem; }
input[type="text"], input[type="email"], input[type="password"], input[type="search"],
input[type="file"], select, textarea {
  width: 100%; height: 2.5rem; padding: 0 .75rem;
  font-family: inherit; font-size: .925rem; color: hsl(var(--foreground));
  border: 1px solid hsl(var(--input)); border-radius: calc(var(--radius) - 2px);
  background: hsl(var(--background));
  transition: border-color .15s, box-shadow .15s;
}
textarea { min-height: 8rem; height: auto; padding: .6rem .75rem; resize: vertical; line-height: 1.55; }
input[type="file"] { padding: .45rem .75rem; font-size: .85rem; }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: hsl(var(--ring));
  box-shadow: 0 0 0 3px hsl(var(--ring) / .25);
}
input::placeholder, textarea::placeholder { color: hsl(var(--muted-foreground) / .8); }
.hint { font-size: .82rem; color: hsl(var(--muted-foreground)); margin-top: .35rem; }
.checks { display: flex; flex-wrap: wrap; gap: .4rem .9rem; }
.checks label { font-weight: 400; font-size: .9rem; display: flex; align-items: center; gap: .4rem; margin: 0; }
.checks input[type="checkbox"], input[type="radio"] { accent-color: hsl(var(--primary)); width: 1rem; height: 1rem; }

/* ---- Button (shadcn) ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  height: 2.5rem; padding: 0 1.1rem;
  background: hsl(var(--primary)); color: hsl(var(--primary-foreground));
  border: 1px solid transparent; border-radius: calc(var(--radius) - 2px);
  font-family: inherit; font-size: .875rem; font-weight: 600;
  cursor: pointer; text-decoration: none; white-space: nowrap;
  box-shadow: var(--shadow-sm);
  transition: background-color .15s, opacity .15s, transform .1s;
}
.btn:active { transform: scale(.97); }
.btn:hover { background: hsl(var(--primary) / .88); color: hsl(var(--primary-foreground)); opacity: 1; }
.btn-secondary {
  background: hsl(var(--background)); color: hsl(var(--foreground));
  border-color: hsl(var(--input));
}
.btn-secondary:hover { background: hsl(var(--accent)); color: hsl(var(--accent-foreground)); }
.btn-danger { background: hsl(var(--destructive)); color: hsl(var(--destructive-foreground)); }
.btn-danger:hover { background: hsl(var(--destructive) / .88); color: hsl(var(--destructive-foreground)); }
.btn-ok { background: hsl(var(--success)); color: hsl(var(--success-foreground)); }
.btn-ok:hover { background: hsl(var(--success) / .88); color: hsl(var(--success-foreground)); }
.btn-small { height: 2.25rem; padding: 0 .85rem; font-size: .84rem; }

/* Pole-pułapka na boty — niewidoczne dla ludzi */
.hp-field { position: absolute; left: -9999px; top: -9999px; }

/* ---- Tabele (shadcn Table) ---- */
.table-scroll {
  overflow-x: auto; border: 1px solid hsl(var(--border));
  border-radius: var(--radius); background: hsl(var(--card)); box-shadow: var(--shadow-sm);
}
table.list { border-collapse: collapse; width: 100%; font-size: .9rem; }
table.list th, table.list td {
  text-align: left; padding: .85rem 1.1rem;
  border-bottom: 1px solid hsl(var(--border)); vertical-align: middle;
}
table.list th {
  color: hsl(var(--muted-foreground)); font-weight: 500; font-size: .82rem;
  height: 3rem;
}
table.list tbody tr:last-child td { border-bottom: 0; }
table.list tbody tr:hover td { background: hsl(var(--muted) / .5); }

/* ---- Panel admina ---- */
.admin-tiles { display: grid; gap: 1.5rem; grid-template-columns: repeat(auto-fill, minmax(min(230px, 100%), 1fr)); padding: 0; margin: 2rem 0 0; list-style: none; }
.admin-tile {
  display: block; background: hsl(var(--card)); color: hsl(var(--card-foreground));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius); padding: 2.25rem 1.5rem; text-decoration: none;
  text-align: center; box-shadow: var(--shadow-sm); font-weight: 600; font-size: 1.05rem;
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.admin-tile:hover { border-color: hsl(var(--ring)); box-shadow: var(--shadow-md); transform: translateY(-2px); color: hsl(var(--primary)); opacity: 1; }
.admin-tile .tile-icon { display: block; margin-bottom: .85rem; }
.admin-tile .tile-icon .icon { width: 2.4rem; height: 2.4rem; color: hsl(var(--primary)); }
.admin-tile .tile-count {
  display: inline-flex; align-items: center; justify-content: center;
  background: hsl(var(--destructive)); color: hsl(var(--destructive-foreground));
  border-radius: 9999px; min-width: 1.5rem; height: 1.5rem; padding: 0 .45rem;
  font-size: .82rem; margin-left: .4rem;
}
.admin-help {
  background: hsl(48 96% 89% / .55); border: 1px solid hsl(45 93% 47% / .5);
  color: hsl(28 73% 26%);
  border-radius: var(--radius); padding: 1.1rem 1.35rem; margin: 0 0 1.5rem;
  max-width: 62ch; font-size: .925rem; line-height: 1.65;
}
@media (prefers-color-scheme: dark) {
  .admin-help { background: hsl(45 93% 47% / .12); color: hsl(48 96% 76%); }
}

/* ---- Paginacja ---- */
.pagination { display: flex; gap: .4rem; flex-wrap: wrap; margin: 2.5rem 0 .5rem; padding: 0; list-style: none; }
.pagination a, .pagination span {
  display: inline-flex; align-items: center; height: 2.25rem; padding: 0 .8rem;
  border: 1px solid hsl(var(--input)); border-radius: calc(var(--radius) - 2px);
  text-decoration: none; background: hsl(var(--background)); color: hsl(var(--foreground));
  font-size: .875rem; font-weight: 500;
}
.pagination a:hover { background: hsl(var(--accent)); opacity: 1; }
.pagination .current { background: hsl(var(--primary)); color: hsl(var(--primary-foreground)); border-color: transparent; font-weight: 600; }

/* ---- Stopka i cookies ---- */
.site-footer {
  background: hsl(var(--muted) / .5); color: hsl(var(--muted-foreground));
  border-top: 1px solid hsl(var(--border));
  padding: 3rem 0; margin-top: 4.5rem; font-size: .9rem;
}
.site-footer a { color: hsl(var(--foreground)); font-weight: 500; text-decoration: none; }
.site-footer a:hover { color: hsl(var(--primary)); opacity: 1; }
.site-footer ul { display: flex; flex-wrap: wrap; gap: .6rem 1.75rem; list-style: none; margin: 0 0 1.25rem; padding: 0; }
.site-footer p { margin: 0; }

.cookie-banner {
  position: fixed; bottom: 1rem; left: 50%; transform: translateX(-50%);
  width: min(96vw, 44rem); z-index: 50;
  background: hsl(var(--card)); color: hsl(var(--card-foreground));
  border: 1px solid hsl(var(--border)); border-radius: var(--radius);
  padding: .9rem 1.1rem; box-shadow: var(--shadow-md);
  display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; justify-content: space-between;
  animation: cookie-up .5s cubic-bezier(.21,.61,.35,1) .4s both;
}
@keyframes cookie-up {
  from { opacity: 0; transform: translate(-50%, 16px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}
/* atrybut hidden musi wygrywać z display:flex */
.cookie-banner[hidden] { display: none; }
.cookie-banner p { margin: 0; font-size: .875rem; flex: 1 1 22rem; }

.note-box {
  background: hsl(var(--primary) / .06); border: 1px solid hsl(var(--primary) / .3);
  border-radius: var(--radius); padding: 1.4rem 1.5rem; margin-top: 2rem;
}
@media (prefers-color-scheme: dark) { .note-box { background: hsl(var(--primary) / .12); } }
.muted { color: hsl(var(--muted-foreground)); }
.actions-row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.mt-2 { margin-top: 2rem; }

@media (max-width: 620px) {
  .brand-tag { display: none; }
  main { padding: 1.15rem .5rem 2.5rem; }
  .cookie-banner { bottom: .5rem; }
}

/* ---- Edytor WYSIWYG (opis okazu) ---- */
.rich-editor {
  border: 1px solid hsl(var(--input)); border-radius: calc(var(--radius) - 2px);
  background: hsl(var(--background)); overflow: hidden;
}
.rich-editor:focus-within { border-color: hsl(var(--ring)); box-shadow: 0 0 0 3px hsl(var(--ring) / .25); }
.rich-toolbar { display: flex; gap: .25rem; padding: .4rem; border-bottom: 1px solid hsl(var(--border)); background: hsl(var(--muted) / .5); }
.rich-btn {
  min-width: 2rem; height: 2rem; padding: 0 .5rem; cursor: pointer;
  border: 1px solid transparent; border-radius: calc(var(--radius) - 4px);
  background: none; color: hsl(var(--foreground)); font: inherit; font-size: 1rem; line-height: 1;
}
.rich-btn:hover { background: hsl(var(--accent)); }
.rich-btn[aria-pressed="true"] { background: hsl(var(--primary) / .12); border-color: hsl(var(--primary) / .4); color: hsl(var(--primary)); }
.rich-area, .rich-source {
  display: block; width: 100%; min-height: 12rem; padding: .75rem .85rem;
  font: inherit; font-size: .95rem; line-height: 1.6; color: hsl(var(--foreground));
  background: hsl(var(--background)); border: 0; outline: none; resize: vertical;
}
.rich-area:empty::before { content: attr(data-placeholder); color: hsl(var(--muted-foreground) / .8); }
.rich-area p { margin: 0 0 .8rem; }
.rich-area:focus { outline: none; }

/* ---- Filtry: checkboxy kolekcji (kompaktowe, niższy panel) ---- */
.field-checks { border: 0; padding: 0; margin: 0; }
.field-checks legend { font-weight: 500; font-size: .875rem; margin-bottom: .5rem; padding: 0; }
.filter-checks { display: flex; flex-wrap: wrap; gap: .4rem; }
.filter-checks label {
  display: inline-flex; align-items: center; gap: .35rem; height: 2.5rem;
  padding: 0 .75rem; margin: 0; cursor: pointer; font-weight: 500; font-size: .875rem;
  border: 1px solid hsl(var(--input)); border-radius: 9999px; background: hsl(var(--background));
  transition: background-color .15s, border-color .15s;
}
.filter-checks label:hover { background: hsl(var(--accent)); }
.filter-checks label:has(input:checked) {
  background: hsl(var(--primary) / .1); border-color: hsl(var(--primary)); color: hsl(var(--primary));
}
.filter-checks input { position: absolute; opacity: 0; width: 0; height: 0; }
.filter-checks .icon { width: .95em; height: .95em; }
.filter-actions { display: flex; align-items: end; gap: .5rem; }

/* ---- Tooltip przy ikonie „i” ---- */
.tip { position: relative; display: inline-flex; align-items: center; cursor: help; vertical-align: middle; }
.tip > .icon { width: .95em; height: .95em; color: hsl(var(--muted-foreground)); margin-left: .1em; }
.tip:hover > .icon, .tip:focus > .icon { color: hsl(var(--primary)); }
.tip-bubble {
  position: absolute; bottom: calc(100% + .5rem); left: 50%; transform: translateX(-50%) translateY(4px);
  z-index: 50; width: max-content; max-width: 16rem;
  background: hsl(var(--foreground)); color: hsl(var(--background));
  padding: .6rem .75rem; border-radius: calc(var(--radius) - 2px);
  font-size: .8rem; font-weight: 400; line-height: 1.5; letter-spacing: 0;
  text-transform: none; text-align: left;
  box-shadow: var(--shadow-md);
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity .15s, transform .15s, visibility .15s;
}
.tip-bubble strong { color: hsl(var(--background)); font-weight: 700; }
.tip-bubble::after {
  content: ""; position: absolute; top: 100%; left: 50%; transform: translateX(-50%);
  border: 5px solid transparent; border-top-color: hsl(var(--foreground));
}
.tip:hover .tip-bubble, .tip:focus .tip-bubble, .tip:focus-within .tip-bubble {
  opacity: 1; visibility: visible; transform: translateX(-50%) translateY(0);
}
@media (max-width: 620px) { .tip-bubble { max-width: 12rem; } }
