/*
 * ps-ai-details-accordions.css
 *
 * Styl karty "AI Details przy pinie" (KASAMUKA / ANUNAKI).
 * AI renderuje się w karcie Leaflet popup NAD pinem:
 *   .ps-ai-pin-popup (wrapper popupu, jasny)
 *     .ps-ai-pin-card > .ps-ai-details-container
 *       .ps-ai-card  (render z window.PointAccordions.render)
 *         .ps-ai-status.<color>  (pill: .ps-ai-status-dot + .ps-ai-status-txt)
 *         .ps-ai-warn
 *         .ps-ai-facts > .ps-ai-fact[data-sec] >
 *             .ps-ai-fact-ic (SVG) + .ps-ai-fact-main >
 *               .ps-ai-fact-ttl + (.ps-ai-fact-text | .ps-ai-chips | .ps-ai-fact-map)
 *         .ps-ai-lang-hint
 *         .ps-ai-footer (.ps-ai-disclaimer + .ps-ai-report-bug)
 *
 * KONTRAKT: klasy MUSZĄ zgadzać się z renderem w ps-ai-details-accordions.js.
 * Zachowane bez zmian: .ps-sv-modal* (Street View modal), dymek .ps-ai-tt-*,
 * skeleton/error, legacy akordeony (.ps-accordion*) dla starej ścieżki w panelu.
 *
 * Design: jasne karty (jak place-card w Google/Apple Maps) — fiolet #7c3aed,
 * pomarańcz #ea580c, zielone statusy, miękkie cienie, zaokrąglenia 12–18px.
 */

/* ════════════════════════════════════════════════════════════════
 * TOKENY DESIGN-SYSTEMU
 * Deklarowane na :root (globalne) ORAZ na .ps-ai-card (samowystarczalne,
 * gdy karta trafia do izolowanego kontekstu). Reszta pliku używa tokenów.
 * ════════════════════════════════════════════════════════════════ */
:root,
.ps-ai-card {
  --ps-accent:    #7c3aed;   /* fiolet — akcent główny */
  --ps-accent-d:  #6d28d9;   /* fiolet ciemniejszy (hover/gradient) */
  --ps-accent2:   #ea580c;   /* pomarańcz — akcent drugorzędny */
  --ps-accent2-d: #c2410c;
  --ps-surface:   #ffffff;   /* tło karty */
  --ps-surface2:  #f8fafc;   /* tło wtórne (chip, ikona) */
  --ps-tint:      #f5f3ff;   /* fioletowy odcień (hover/ikona map) */
  --ps-line:      #eef1f6;   /* linie / obwódki */
  --ps-line2:     #e2e8f0;   /* obwódki mocniejsze */
  --ps-text:      #1e293b;   /* tekst główny */
  --ps-text2:     #475569;   /* tekst wtórny */
  --ps-text3:     #334155;   /* tekst faktów */
  --ps-muted:     #94a3b8;   /* etykiety / disclaimer */
  --ps-radius:    14px;      /* promień bazowy */
  --ps-radius-lg: 18px;      /* promień karty popupu */
  --ps-radius-sm: 10px;      /* promień drobnych elementów */
  --ps-radius-pill: 999px;
  /* skala odstępów (4pt) */
  --ps-sp-1: 4px;
  --ps-sp-2: 8px;
  --ps-sp-3: 12px;
  --ps-sp-4: 16px;
  --ps-sp-5: 20px;
  /* cienie warstwowe */
  --ps-shadow-card: 0 20px 52px rgba(124, 58, 237, 0.18), 0 6px 18px rgba(15, 23, 42, 0.10);
  --ps-shadow-1: 0 1px 3px rgba(15, 23, 42, 0.09);
  --ps-shadow-2: 0 3px 10px rgba(124, 58, 237, 0.22);
  --ps-shadow-3: 0 6px 18px rgba(124, 58, 237, 0.30);
}

/* ─── Panel scroll guard (legacy KASAMUKA #ankDetailPanel) ──────────
 * .ank-detail-panel rośnie w górę poza ekran po rozwinięciu akordeonów.
 * Cap wysokości + wewnętrzny scroll. Reguła ładowana tylko z AI Details. */
#ankDetailPanel {
  max-height: calc(100vh - 20px);
  max-height: calc(100% - 20px);
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
}
#ankDetailPanel::-webkit-scrollbar { width: 8px; }
#ankDetailPanel::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.18); border-radius: 8px; }
#ankDetailPanel::-webkit-scrollbar-track { background: transparent; }

/* ════════════════════════════════════════════════════════════════
 * POPUP NAD PINEM — jasna karta, miękki cień, dyskretny close, bez dzióbka
 * className popupu = .ps-ai-pin-popup (ustawiane w integration.js)
 * ════════════════════════════════════════════════════════════════ */
.ps-ai-pin-popup .leaflet-popup-content-wrapper {
  background: var(--ps-surface);
  color: var(--ps-text);
  border-radius: var(--ps-radius-lg);
  box-shadow: var(--ps-shadow-card);
  border: 1px solid #ece7fb;
  padding: 0;
}
.ps-ai-pin-popup .leaflet-popup-content {
  margin: 0;
  padding: 14px 15px 12px;
  width: 320px !important;
  /* Twardy cap, by karta ZAWSZE mieściła się nad/pod pinem (na małych ekranach
   * też). Reszta sekcji dostępna wewnętrznym scrollem (jak place-card). */
  max-height: min(440px, 56vh);
  overflow-y: auto;
  overflow-x: hidden;
}
/* Dzióbek balonika Leaflet — znika (karta "unosi się" jak place-card) */
.ps-ai-pin-popup .leaflet-popup-tip-container { display: none; }
.ps-ai-pin-popup .leaflet-popup-tip { display: none; }
/* Close — dyskretny, w prawym górnym rogu */
.ps-ai-pin-popup a.leaflet-popup-close-button {
  color: #b4a7e6;
  font-size: 20px;
  width: 26px;
  height: 26px;
  padding: 4px 6px 0 0;
  transition: color 0.15s ease, transform 0.15s ease;
}
.ps-ai-pin-popup a.leaflet-popup-close-button:hover {
  color: var(--ps-accent);
  transform: scale(1.1);
}
/* Cienki scroll wewnątrz karty (gdy treść > 62vh) */
.ps-ai-pin-popup .leaflet-popup-content::-webkit-scrollbar { width: 6px; }
.ps-ai-pin-popup .leaflet-popup-content::-webkit-scrollbar-thumb { background: #e6ddfb; border-radius: 6px; }
.ps-ai-pin-popup .leaflet-popup-content::-webkit-scrollbar-track { background: transparent; }

/* Kontener wewnątrz popupu — przezroczysty (karta sama nadaje tło) */
.ps-ai-pin-card .ps-ai-details-container {
  margin: 0;
  padding: 0;
  background: transparent;
  box-shadow: none;
  color: var(--ps-text);
}

/* ════════════════════════════════════════════════════════════════
 * KARTA MIEJSCA (.ps-ai-card) — wszystko widoczne od razu.
 * To jest GŁÓWNY render AI przy pinie. Status pill + wiersze faktów.
 * ════════════════════════════════════════════════════════════════ */
.ps-ai-card {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ps-text);
  animation: psCardIn 0.26s cubic-bezier(0.16, 1, 0.3, 1) both;
}
@keyframes psCardIn {
  from { opacity: 0; transform: translateY(6px) scale(0.985); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
/* Wejście zależne od pozycji karty względem pinu (klasa z computePopupPlacement) */
.ps-ai-pin-popup--below .ps-ai-card { animation-name: psCardInBelow; }
@keyframes psCardInBelow {
  from { opacity: 0; transform: translateY(-6px) scale(0.985); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ─── Akcent marki — cienki pasek u góry karty (kolor per przewoźnik) ─ */
.ps-ai-card::before {
  content: "";
  display: block;
  width: 100%;
  height: 3px;
  border-radius: 3px;
  margin: 0 0 13px;
  background: linear-gradient(90deg, var(--ps-carrier, var(--ps-accent)) 0%, color-mix(in srgb, var(--ps-carrier, var(--ps-accent)) 55%, #ffffff) 100%);
}
.ps-ai-card[data-carrier="inpost"]  { --ps-carrier: #FFCC01; }
.ps-ai-card[data-carrier="dpd"]     { --ps-carrier: #DC0032; }
.ps-ai-card[data-carrier="dhl"]     { --ps-carrier: #FFCC00; }
.ps-ai-card[data-carrier="gls"]     { --ps-carrier: #FFD100; }
.ps-ai-card[data-carrier="orlen"]   { --ps-carrier: #C8102E; }
.ps-ai-card[data-carrier="pocztex"] { --ps-carrier: #E5007D; }
.ps-ai-card[data-carrier="ups"]     { --ps-carrier: #FFB500; }
.ps-ai-card[data-carrier="fedex"]   { --ps-carrier: #4D148C; }

/* ─── Nagłówek place-card (chip przewoźnika + ID + pill klasyfikacji) ─ */
.ps-ai-head { margin-bottom: var(--ps-sp-3); }
.ps-ai-head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--ps-sp-2);
  margin-bottom: 9px;
}
.ps-ai-carrier {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px 4px 7px;
  border-radius: var(--ps-radius-pill);
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: 0.01em;
  line-height: 1.1;
  background: #ffffff;
  color: var(--ps-text);
  border: 1px solid var(--ps-line2);
  white-space: nowrap;
}
.ps-ai-carrier-logo {
  height: 15px;
  width: auto;
  max-width: 54px;
  object-fit: contain;
  display: block;
  flex-shrink: 0;
}
.ps-ai-carrier-dot {
  width: 9px;
  height: 9px;
  border-radius: 3px;
  background: var(--ps-carrier, var(--ps-accent));
  flex-shrink: 0;
}
.ps-ai-head-id {
  font-family: ui-monospace, "SF Mono", "Cascadia Code", Consolas, monospace;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--ps-muted);
  background: var(--ps-surface2);
  border: 1px solid var(--ps-line);
  padding: 3px 8px;
  border-radius: var(--ps-radius-sm);
  white-space: nowrap;
}
.ps-ai-head .ps-ai-status {
  margin-bottom: 0;
  font-size: 12.5px;
  padding: 7px 13px 7px 11px;
}
/* Chip przewoźnika jest neutralny — markę niesie logo (assets/Speditors/) i górna
 * reguła-nagłówek w kolorze marki (var --ps-carrier); brak kolorowego tła chipa. */

/* ─── Choreografia wejścia — fakty wjeżdżają kaskadowo ──────────── */
.ps-ai-facts .ps-ai-fact { animation: psFactIn 0.34s cubic-bezier(0.16, 1, 0.3, 1) both; }
.ps-ai-facts .ps-ai-fact:nth-child(1) { animation-delay: 0.05s; }
.ps-ai-facts .ps-ai-fact:nth-child(2) { animation-delay: 0.10s; }
.ps-ai-facts .ps-ai-fact:nth-child(3) { animation-delay: 0.15s; }
.ps-ai-facts .ps-ai-fact:nth-child(4) { animation-delay: 0.20s; }
.ps-ai-facts .ps-ai-fact:nth-child(5) { animation-delay: 0.25s; }
@keyframes psFactIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ─── Rząd akcji (Nawiguj + Street View) — pod nagłówkiem ───────── */
.ps-ai-actions {
  display: flex;
  gap: var(--ps-sp-2);
  margin: 0 0 10px;
}
.ps-ai-act {
  flex: 1 1 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 12px;
  border-radius: var(--ps-radius-sm);
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1.1;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}
.ps-ai-act svg { width: 15px; height: 15px; flex-shrink: 0; }
.ps-ai-act-primary {
  background: linear-gradient(135deg, var(--ps-accent) 0%, var(--ps-accent-d) 100%);
  color: #fff;
  box-shadow: var(--ps-shadow-2);
}
.ps-ai-act-primary:hover { transform: translateY(-1px); box-shadow: var(--ps-shadow-3); }
.ps-ai-act-primary:active { transform: translateY(0); }
.ps-ai-act-ghost {
  background: var(--ps-surface2);
  color: var(--ps-text2);
  border-color: var(--ps-line2);
}
.ps-ai-act-ghost:hover { background: var(--ps-tint); border-color: #ddd6fe; color: var(--ps-accent-d); }
/* Linki wtórne Google/OSM — drobne, wyśrodkowane (prefiks .ps-ai-card wygrywa nad .ps-sv-links a) */
.ps-ai-card .ps-sv-links--secondary {
  margin: -1px 0 12px;
  justify-content: center;
  gap: 16px;
}
.ps-ai-card .ps-sv-links--secondary a {
  background: transparent;
  border: none;
  padding: 2px;
  color: var(--ps-muted);
  font-size: 11px;
  font-weight: 600;
}
.ps-ai-card .ps-sv-links--secondary a:hover {
  background: transparent;
  color: var(--ps-accent);
  border-color: transparent;
  text-decoration: underline;
}

/* ─── Status pill (klasyfikacja punktu) ─────────────────────────── */
.ps-ai-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px 6px 10px;
  border-radius: var(--ps-radius-pill);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.01em;
  line-height: 1.15;
  margin-bottom: var(--ps-sp-3);
  max-width: 100%;
}
.ps-ai-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
  box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 18%, transparent);
}
.ps-ai-status-txt { min-width: 0; }
.ps-ai-status.color-green   { background: #ecfdf3; color: #15803d; }
.ps-ai-status.color-amber,
.ps-ai-status.color-yellow  { background: #fffbeb; color: #b45309; }
.ps-ai-status.color-red     { background: #fef2f2; color: #b91c1c; }
.ps-ai-status.color-blue    { background: #eff6ff; color: #1d4ed8; }
.ps-ai-status.color-orange  { background: #fff7ed; color: #c2410c; }
.ps-ai-status.color-cyan    { background: #ecfeff; color: #0e7490; }
.ps-ai-status.color-gray    { background: #f1f5f9; color: #475569; }
.ps-ai-status.color-bicolor-green-red {
  background: linear-gradient(90deg, #ecfdf3 0%, #ecfdf3 50%, #fef2f2 50%, #fef2f2 100%);
  color: #6d28d9;
}

/* ─── Ostrzeżenie (subtelne, amber) ─────────────────────────────── */
.ps-ai-warn {
  font-size: 11.5px;
  line-height: 1.45;
  color: #92400e;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: var(--ps-radius-sm);
  padding: 8px 11px;
  margin: -2px 0 var(--ps-sp-3);
}

/* ─── Wiersze faktów — wszystkie widoczne ───────────────────────── */
.ps-ai-facts {
  display: flex;
  flex-direction: column;
}
.ps-ai-fact {
  display: flex;
  gap: var(--ps-sp-3);
  align-items: flex-start;
  padding: 11px 0;
}
.ps-ai-fact + .ps-ai-fact { border-top: 1px solid var(--ps-line); }

/* Ikona w kolorowym kółku (SVG 20px w kółku 36px), kolor per data-sec */
.ps-ai-fact-ic {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 11px;
  background: var(--ps-tint);
  color: var(--ps-accent);
}
.ps-ai-fact-ic svg { width: 20px; height: 20px; display: block; }
.ps-ai-fact[data-sec="location"]         .ps-ai-fact-ic { background: #eff6ff; color: #2563eb; }
.ps-ai-fact[data-sec="car_access"]       .ps-ai-fact-ic { background: #fff7ed; color: #ea580c; }
.ps-ai-fact[data-sec="public_transport"] .ps-ai-fact-ic { background: #ecfdf5; color: #059669; }
.ps-ai-fact[data-sec="night_safety"]     .ps-ai-fact-ic { background: #eef2ff; color: #4f46e5; }
.ps-ai-fact[data-sec="map"]              .ps-ai-fact-ic { background: #f5f3ff; color: #7c3aed; }

.ps-ai-fact-main {
  min-width: 0;
  flex: 1;
  padding-top: 1px;
}
.ps-ai-fact-ttl {
  font-size: 10.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ps-muted);
  margin-bottom: 3px;
}
.ps-ai-fact-body { min-width: 0; }
.ps-ai-fact-text {
  font-size: 13px;
  line-height: 1.5;
  color: var(--ps-text3);
  overflow-wrap: anywhere;
}

/* ─── Chipy (opcjonalna prezentacja faktów jako pigułki) ────────── */
.ps-ai-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 2px;
}
.ps-ai-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  background: var(--ps-surface2);
  border: 1px solid var(--ps-line2);
  border-radius: var(--ps-radius-pill);
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--ps-text2);
  white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}
.ps-ai-chip:hover {
  background: var(--ps-tint);
  border-color: #ddd6fe;
  transform: translateY(-1px);
}
.ps-ai-chip-ic {
  display: inline-flex;
  flex-shrink: 0;
  color: var(--ps-accent);
}
.ps-ai-chip-ic svg { width: 13px; height: 13px; display: block; }

/* ─── Sekcja "map" — blok przycisków (Street View + linki) ──────── */
.ps-ai-fact-map { margin-top: 5px; }

/* ════════════════════════════════════════════════════════════════
 * DYMEK NAD PINEM (hover) — skrót AI w .ank-tooltip
 * ════════════════════════════════════════════════════════════════ */
.ank-tooltip .ps-ai-tt-summary {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid rgba(0, 0, 0, 0.12);
  max-width: 240px;
  white-space: normal;
  text-align: left;
}
.ps-ai-tt-badge { font-weight: 800; font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.03em; color: #15803d; margin-bottom: 2px; }
.ps-ai-tt-loc { font-size: 12px; line-height: 1.35; color: #1f2937; }
.ps-ai-tt-warn { font-size: 11px; line-height: 1.3; color: #b45309; margin-top: 3px; }
.ps-ai-tt-hint { font-size: 10px; color: #ea580c; margin-top: 4px; font-weight: 700; }

/* ════════════════════════════════════════════════════════════════
 * STREET VIEW — przycisk (fiolet) + linki (jasne) w sekcji map
 * ════════════════════════════════════════════════════════════════ */
.ps-sv-trigger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 14px;
  background: linear-gradient(135deg, var(--ps-accent) 0%, var(--ps-accent-d) 100%);
  color: #fff;
  border: none;
  border-radius: var(--ps-radius-sm);
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 700;
  margin: 2px 0 4px;
  box-shadow: var(--ps-shadow-2);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.ps-sv-trigger:hover {
  transform: translateY(-1px);
  box-shadow: var(--ps-shadow-3);
}
.ps-sv-trigger:active { transform: translateY(0); }

.ps-sv-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.ps-sv-links a {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 11px;
  background: var(--ps-surface2);
  color: var(--ps-text2);
  border: 1px solid var(--ps-line2);
  border-radius: var(--ps-radius-sm);
  font-size: 11.5px;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.ps-sv-links a:hover {
  background: #ede9fe;
  color: var(--ps-accent-d);
  border-color: #ddd6fe;
}

/* ════════════════════════════════════════════════════════════════
 * STOPKA — dyskretny disclaimer + zgłoś błąd (pomarańcz)
 * Render emituje .ps-ai-footer (zgodność z renderFooter()).
 * ════════════════════════════════════════════════════════════════ */
.ps-ai-card .ps-ai-footer {
  margin-top: var(--ps-sp-3);
  padding: 9px 0 2px;
  border-top: 1px dashed var(--ps-line2);
  font-size: 11px;
  line-height: 1.45;
  color: var(--ps-muted);
}
.ps-ai-card .ps-ai-disclaimer { font-style: normal; color: var(--ps-muted); }
.ps-ai-card .ps-ai-report-bug {
  color: var(--ps-accent2);
  text-decoration: none;
  white-space: nowrap;
  font-weight: 600;
}
.ps-ai-card .ps-ai-report-bug:hover,
.ps-ai-card .ps-ai-report-bug:focus {
  color: var(--ps-accent2-d);
  text-decoration: underline;
}

/* ─── Hint językowy (gdy locale użytkownika ≠ język treści) ──────── */
.ps-ai-card .ps-ai-lang-hint {
  margin: 10px 0 0;
  padding: 6px 10px;
  background: var(--ps-tint);
  border-left: 3px solid #a78bfa;
  border-radius: var(--ps-radius-sm);
  font-size: 11px;
  color: var(--ps-accent-d);
  line-height: 1.4;
  font-style: normal;
}

/* ════════════════════════════════════════════════════════════════
 * STREET VIEW MODAL — ZACHOWANE (działa, nie ruszać struktury)
 * ════════════════════════════════════════════════════════════════ */
.ps-sv-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(92vw, 1080px);
  height: min(82vh, 780px);
  padding: 0;
  border: none;
  border-radius: 12px;
  box-shadow: 0 18px 56px rgba(0, 0, 0, 0.55);
  overflow: hidden;
  background: #111;
  z-index: 10000;
}

.ps-sv-modal::backdrop {
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
}

.ps-sv-modal-close {
  position: absolute;
  top: 10px;
  right: 10px;  /* PRAWY górny róg */
  z-index: 10001;
  width: 42px;
  height: 42px;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 50%;
  color: #111;
  font-size: 22px;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  transition: transform 0.15s ease, background 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  padding: 0;
}

.ps-sv-modal-close:hover {
  background: #fff;
  transform: scale(1.08);
}

.ps-sv-modal-close:active {
  transform: scale(0.96);
}

.ps-sv-iframe-container {
  width: 100%;
  height: calc(100% - 44px);
  background: #000;
}

.ps-sv-iframe-container iframe {
  width: 100%;
  height: 100%;
  border: 0;
}

.ps-sv-modal-footer {
  padding: 10px 16px;
  background: #f8f9fa;
  border-top: 1px solid #e5e7eb;
  text-align: center;
  font-size: 12px;
}

.ps-sv-modal-footer a {
  color: #2563eb;
  text-decoration: none;
  font-weight: 500;
}

.ps-sv-modal-footer a:hover {
  text-decoration: underline;
}

/* ════════════════════════════════════════════════════════════════
 * LOADING SKELETON (shimmer) — jasny wariant pod kartę popupu
 * ════════════════════════════════════════════════════════════════ */
.ps-ai-loading { padding: 4px 0; }
.ps-skel-badge,
.ps-skel-bar,
.ps-skel-icon {
  background: linear-gradient(90deg,
    rgba(124, 58, 237, 0.06) 0%,
    rgba(124, 58, 237, 0.14) 50%,
    rgba(124, 58, 237, 0.06) 100%);
  background-size: 200% 100%;
  animation: psSkelShimmer 1.4s linear infinite;
  border-radius: 8px;
}
.ps-skel-badge {
  height: 26px;
  width: 70%;
  margin: 6px 0 12px;
}
.ps-skel-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  border-top: 1px solid var(--ps-line);
}
.ps-skel-icon {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  flex-shrink: 0;
}
.ps-skel-bar {
  height: 14px;
  flex: 1;
}
@keyframes psSkelShimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ════════════════════════════════════════════════════════════════
 * ERROR FALLBACK — jasny wariant (amber)
 * ════════════════════════════════════════════════════════════════ */
.ps-ai-error {
  padding: 12px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: var(--ps-radius-sm);
  margin: 8px 0;
}
.ps-ai-error-title {
  margin: 0 0 10px;
  color: #92400e;
  font-size: 13px;
  line-height: 1.4;
}
.ps-ai-retry-btn {
  background: #fff;
  color: #b45309;
  border: 1px solid #fcd34d;
  padding: 7px 14px;
  border-radius: var(--ps-radius-sm);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.ps-ai-retry-btn:hover,
.ps-ai-retry-btn:focus {
  background: #fffbeb;
  border-color: #f59e0b;
  outline: 2px solid rgba(245, 158, 11, 0.5);
  outline-offset: 1px;
}

/* ════════════════════════════════════════════════════════════════
 * EMPTY STATE
 * ════════════════════════════════════════════════════════════════ */
.ps-ai-empty { padding: 12px 0 4px; }

/* ════════════════════════════════════════════════════════════════
 * A11Y — focus visibility (na jasnym tle)
 * ════════════════════════════════════════════════════════════════ */
.ps-sv-trigger:focus-visible,
.ps-sv-modal-close:focus-visible,
.ps-sv-links a:focus-visible,
.ps-ai-retry-btn:focus-visible,
.ps-ai-card a:focus-visible {
  outline: 2px solid var(--ps-accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ════════════════════════════════════════════════════════════════
 * RESPONSYWNOŚĆ
 * ════════════════════════════════════════════════════════════════ */
@media (max-width: 640px) {
  .ps-ai-pin-popup .leaflet-popup-content {
    width: min(92vw, 320px) !important;
  }
  .ps-ai-fact-text { font-size: 13.5px; }
  .ps-sv-trigger,
  .ps-sv-links a,
  .ps-ai-retry-btn {
    min-height: 40px;
  }
  .ps-sv-modal {
    max-width: 96vw !important;
    max-height: 90vh !important;
    margin: auto;
  }
}
@media (max-width: 480px) {
  .ps-sv-modal {
    width: 100vw;
    height: 100vh;
    border-radius: 0;
    top: 0;
    left: 0;
    transform: none;
  }
  .ps-sv-modal-close {
    width: 48px;
    height: 48px;
    font-size: 26px;
  }
}

/* ════════════════════════════════════════════════════════════════
 * REDUCED MOTION — pełne wyłączenie animacji
 * ════════════════════════════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
  .ps-ai-card,
  .ps-ai-facts .ps-ai-fact,
  .ps-ai-act,
  .ps-ai-chip,
  .ps-sv-trigger,
  .ps-sv-modal-close,
  .ps-skel-badge,
  .ps-skel-bar,
  .ps-skel-icon,
  .ps-accordion,
  .ps-accordion summary,
  .ps-accordion .ps-acc-chevron,
  .ps-accordion[open] .ps-acc-body {
    animation: none !important;
    transition: none !important;
  }
}

/* ════════════════════════════════════════════════════════════════
 * LEGACY — akordeony w panelu KASAMUKA (.ps-accordion*).
 * Stara ścieżka (render w #ankDetailPanel). Zostawione działające,
 * bo PointAccordions.render może być wywołane też tam. Ciemny motyw
 * panelu — NIE dotyka jasnej karty .ps-ai-card przy pinie.
 * ════════════════════════════════════════════════════════════════ */
.ps-ai-accordions {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.ps-accordion {
  margin-bottom: 6px;
  background: rgba(0, 0, 0, 0.18);
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: background 0.2s ease, border-color 0.2s ease;
  overflow: hidden;
}
.ps-accordion:hover {
  background: rgba(0, 0, 0, 0.28);
  border-color: rgba(255, 255, 255, 0.16);
}
.ps-accordion[open] {
  background: rgba(0, 0, 0, 0.22);
  border-color: rgba(255, 255, 255, 0.14);
}

.ps-accordion summary {
  cursor: pointer;
  padding: 11px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 500;
  color: #fff;
  list-style: none;
  user-select: none;
  outline: none;
  transition: background 0.18s ease;
}
.ps-accordion summary::-webkit-details-marker { display: none; }
.ps-accordion summary::marker { display: none; }
.ps-accordion summary:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.5);
  outline-offset: -2px;
}
.ps-accordion[open] summary { border-bottom: 1px solid rgba(255, 255, 255, 0.08); }

.ps-acc-icon {
  font-size: 18px;
  line-height: 1;
  flex-shrink: 0;
  width: 24px;
  text-align: center;
}
.ps-acc-title {
  flex: 1;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.ps-acc-chevron {
  margin-left: auto;
  transition: transform 0.22s ease;
  opacity: 0.55;
  font-size: 11px;
  flex-shrink: 0;
  display: inline-block;
}
.ps-accordion[open] .ps-acc-chevron {
  transform: rotate(180deg);
  opacity: 0.9;
}

.ps-acc-body {
  padding: 0 14px 13px 14px;
  font-size: 12px;
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.88);
}
.ps-acc-body p { margin: 0 0 8px 0; }
.ps-acc-body p:last-child { margin-bottom: 0; }
.ps-accordion[open] .ps-acc-body { animation: psAccFadeIn 0.28s ease; }
@keyframes psAccFadeIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Modern browsers — content height transition */
@supports (interpolate-size: allow-keywords) {
  html { interpolate-size: allow-keywords; }
  .ps-accordion {
    transition: height 0.25s ease;
    height: auto;
  }
  .ps-accordion::details-content {
    opacity: 0;
    transition: opacity 0.2s ease, content-visibility 0.25s allow-discrete;
  }
  .ps-accordion[open]::details-content { opacity: 1; }
}

/* Legacy classification badge (panel) */
.ps-classification-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  margin-bottom: 10px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.02em;
}
.ps-classification-badge-icon { font-size: 18px; flex-shrink: 0; }
.ps-classification-badge-text { flex: 1; }
.ps-classification-badge.color-green   { background: linear-gradient(135deg, #16a34a 0%, #15803d 100%); box-shadow: 0 2px 8px rgba(22, 163, 74, 0.3); }
.ps-classification-badge.color-amber   { background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%); box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3); }
.ps-classification-badge.color-red     { background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%); box-shadow: 0 2px 8px rgba(220, 38, 38, 0.3); }
.ps-classification-badge.color-blue    { background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%); box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3); }
.ps-classification-badge.color-orange  { background: linear-gradient(135deg, #ea580c 0%, #c2410c 100%); box-shadow: 0 2px 8px rgba(234, 88, 12, 0.3); }
.ps-classification-badge.color-cyan    { background: linear-gradient(135deg, #0891b2 0%, #0e7490 100%); box-shadow: 0 2px 8px rgba(8, 145, 178, 0.3); }
.ps-classification-badge.color-yellow  { background: linear-gradient(135deg, #eab308 0%, #ca8a04 100%); color: #111; }
.ps-classification-badge.color-gray    { background: linear-gradient(135deg, #6b7280 0%, #4b5563 100%); }
.ps-classification-badge.color-bicolor-green-red { background: linear-gradient(90deg, #16a34a 50%, #dc2626 50%); }

.ps-classification-warning {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.7);
  padding: 0 12px 6px 12px;
  margin-top: -6px;
  margin-bottom: 10px;
  line-height: 1.45;
  font-style: italic;
}

/* Legacy footer/lang-hint colors (dark panel context only) */
.ps-ai-footer {
  margin-top: 10px;
  padding: 8px 4px 4px;
  border-top: 1px dashed rgba(255, 255, 255, 0.12);
  font-size: 11px;
  line-height: 1.4;
  color: rgba(255, 255, 255, 0.55);
}
.ps-ai-disclaimer { font-style: italic; }
.ps-ai-report-bug {
  color: rgba(255, 200, 100, 0.85);
  text-decoration: none;
  white-space: nowrap;
}
.ps-ai-report-bug:hover,
.ps-ai-report-bug:focus {
  color: #ffc864;
  text-decoration: underline;
}
.ps-ai-lang-hint {
  margin: 6px 0 10px;
  padding: 6px 10px;
  background: rgba(100, 180, 255, 0.08);
  border-left: 3px solid rgba(100, 180, 255, 0.5);
  border-radius: 3px;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.75);
  line-height: 1.4;
  font-style: italic;
}

/* ─── Standalone test page (frontend/test.html) ──────────────────── */
.ps-standalone-demo {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  color: #fff;
  border-radius: 12px;
  padding: 20px;
  max-width: 420px;
  margin: 40px auto;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  position: relative;
}
.ps-standalone-demo-header h3 { margin: 0; font-size: 18px; font-weight: 700; }
.ps-standalone-demo-address { margin: 4px 0 12px 0; font-size: 13px; color: rgba(255, 255, 255, 0.82); line-height: 1.4; }

/* Admin preview (already dark bg) — no double-card */
.ps-ai-preview-container .ps-ai-details-container {
  margin: 0;
  background: transparent;
  box-shadow: none;
  padding: 0;
}

/* ════════════════════════════════════════════════════════════════
 * DYMKI KOMIKSOWE — L.popup z className="ps-comic-popup ps-comic-popup--N"
 * Treść: .ps-cb-hd (ikona + tytuł) + .ps-cb-body (tekst)
 * ════════════════════════════════════════════════════════════════ */

/* Wrapper Leaflet popupu — styl komiksu */
.ps-comic-popup .leaflet-popup-content-wrapper {
  background: #ffffff;
  border: 2.5px solid #1e1e2e;
  border-radius: 14px;
  box-shadow: 3px 3px 0 #1e1e2e, 0 4px 16px rgba(30,30,46,0.15);
  padding: 0;
}
.ps-comic-popup .leaflet-popup-content {
  margin: 0;
  padding: 10px 28px 10px 10px;
  width: 175px !important;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 12px;
  color: #1e293b;
  line-height: 1.4;
}

/* Ogon Leaflet — komiksowy, czarna obwódka */
.ps-comic-popup .leaflet-popup-tip-container {
  display: block !important;
}
.ps-comic-popup .leaflet-popup-tip {
  background: #ffffff;
  box-shadow: none;
  border: 2.5px solid #1e1e2e;
  width: 16px;
  height: 16px;
}

/* Close button Leaflet */
.ps-comic-popup a.leaflet-popup-close-button {
  color: #94a3b8;
  font-size: 16px;
  top: 4px;
  right: 5px;
  width: 20px;
  height: 20px;
  line-height: 20px;
  padding: 0;
  text-align: center;
  border-radius: 50%;
  transition: color 0.12s, background 0.12s;
}
.ps-comic-popup a.leaflet-popup-close-button:hover {
  color: #1e293b;
  background: #f1f5f9;
}

/* Sekwencyjna animacja — każdy popup z innym delay */
.ps-comic-popup--0 .leaflet-popup-content-wrapper { animation: psBubbleIn 0.28s cubic-bezier(0.16,1,0.3,1) both 0ms; }
.ps-comic-popup--1 .leaflet-popup-content-wrapper { animation: psBubbleIn 0.28s cubic-bezier(0.16,1,0.3,1) both 180ms; }
.ps-comic-popup--2 .leaflet-popup-content-wrapper { animation: psBubbleIn 0.28s cubic-bezier(0.16,1,0.3,1) both 360ms; }

@keyframes psBubbleIn {
  from { opacity: 0; transform: scale(0.65) translateY(8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

/* Nagłówek dymka: emoji + tytuł caps */
.ps-cb-hd {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 6px;
  padding-bottom: 5px;
  border-bottom: 1px solid #e2e8f0;
}
.ps-cb-ico {
  font-size: 14px;
  line-height: 1;
  flex-shrink: 0;
}
.ps-cb-ttl {
  font-weight: 700;
  font-size: 10.5px;
  color: #1e1e2e;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  line-height: 1.2;
}

/* Treść */
.ps-cb-body {
  margin: 0;
  font-size: 11.5px;
  color: #334155;
  line-height: 1.45;
  max-height: 88px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #c4b5fd transparent;
}
.ps-cb-body::-webkit-scrollbar { width: 3px; }
.ps-cb-body::-webkit-scrollbar-thumb { background: #c4b5fd; border-radius: 3px; }

@media (prefers-reduced-motion: reduce) {
  .ps-comic-popup--0 .leaflet-popup-content-wrapper,
  .ps-comic-popup--1 .leaflet-popup-content-wrapper,
  .ps-comic-popup--2 .leaflet-popup-content-wrapper {
    animation: none !important;
  }
}
