/* =====================================================================
   Navrhni — pin-based feedback widget
   ===================================================================== */

#fw-root {
  --fw-primary: #1e5fa3;
  --fw-primary-deep: #0f3d6e;
  --fw-bg: #ffffff;
  --fw-ink: #0f1e36;
  --fw-ink-muted: #5b6577;
  --fw-line: #e1e6ed;
  --fw-bg-soft: #f5f7fb;
  --fw-success: #1e7e34;
  --fw-warn: #b8860b;
  --fw-danger: #c5325f;
  --fw-shadow: 0 14px 32px -10px rgba(15, 30, 54, 0.22);
  --fw-radius: 14px;
  font-family: -apple-system, BlinkMacSystemFont, 'Inter', sans-serif;
  font-size: 14px;
  color: var(--fw-ink);
  line-height: 1.4;
}

#fw-root * { box-sizing: border-box; }
#fw-root button { font-family: inherit; }

/* ============== Floating launcher (pravý dolní roh) ============== */
.fw-launcher {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 999990;
  background: linear-gradient(135deg, var(--fw-primary), var(--fw-primary-deep));
  color: white;
  border: none;
  border-radius: 100px;
  padding: 12px 18px 12px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 8px 24px rgba(30, 95, 163, 0.32);
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.fw-launcher:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(30, 95, 163, 0.42);
}
.fw-launcher-badge {
  background: white;
  color: var(--fw-primary);
  min-width: 22px;
  height: 22px;
  border-radius: 100px;
  padding: 0 6px;
  font-size: 12px;
  font-weight: 700;
  display: inline-grid;
  place-items: center;
}
.fw-launcher-badge.fw-hidden { display: none; }

/* ============== Mini menu (po kliku na launcher) ============== */
.fw-menu {
  position: fixed;
  right: 20px;
  bottom: 70px;
  z-index: 999991;
  background: var(--fw-bg);
  border-radius: var(--fw-radius);
  box-shadow: var(--fw-shadow);
  padding: 10px;
  min-width: 240px;
  display: none;
  flex-direction: column;
  gap: 2px;
  border: 1px solid var(--fw-line);
}
.fw-menu.fw-open { display: flex; }
.fw-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  background: transparent;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13.5px;
  color: var(--fw-ink);
  text-align: left;
  width: 100%;
}
.fw-menu-item:hover { background: var(--fw-bg-soft); }
.fw-menu-item.fw-active {
  background: rgba(30, 95, 163, 0.08);
  color: var(--fw-primary);
  font-weight: 600;
}
.fw-toggle {
  margin-left: auto;
  width: 32px;
  height: 18px;
  background: #cbd2dc;
  border-radius: 100px;
  position: relative;
  transition: background 0.2s;
}
.fw-toggle::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 14px; height: 14px;
  background: white;
  border-radius: 50%;
  transition: transform 0.2s;
}
.fw-toggle.fw-on { background: var(--fw-success); }
.fw-toggle.fw-on::after { transform: translateX(14px); }

/* ============== Top banner (annotation mode) ============== */
.fw-banner {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 999988;
  background: linear-gradient(90deg, var(--fw-primary), var(--fw-primary-deep));
  color: white;
  padding: 10px 18px;
  font-weight: 600;
  font-size: 13.5px;
  text-align: center;
  display: none;
  align-items: center;
  justify-content: center;
  gap: 16px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.12);
}
.fw-banner.fw-visible { display: flex; }
.fw-banner-cancel {
  background: rgba(255,255,255,0.18);
  border: none;
  color: white;
  padding: 4px 12px;
  border-radius: 100px;
  font-size: 12.5px;
  cursor: pointer;
}
.fw-banner-cancel:hover { background: rgba(255,255,255,0.28); }

/* Overlay (chytá click v annotation módu) */
.fw-annotation-overlay {
  position: fixed;
  inset: 0;
  z-index: 999985;
  cursor: crosshair;
  background: transparent;
  display: none;
}
.fw-annotation-overlay.fw-visible { display: block; }

/* Highlight outline na elementu pod kurzorem */
.fw-hover-highlight {
  position: absolute;
  z-index: 999987;
  pointer-events: none;
  border: 2px dashed var(--fw-primary);
  background: rgba(30, 95, 163, 0.06);
  border-radius: 4px;
  transition: all 0.06s ease-out;
  display: none;
}
.fw-hover-highlight.fw-visible { display: block; }

/* ============== Pin marker ============== */
.fw-pin {
  position: absolute;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--fw-primary);
  color: white;
  border: 3px solid white;
  box-shadow: 0 4px 10px rgba(0,0,0,0.25), 0 0 0 1px rgba(0,0,0,0.06);
  cursor: pointer;
  z-index: 999980;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
  transition: transform 0.15s;
  transform: translate(-50%, -100%);
}
.fw-pin:hover { transform: translate(-50%, -100%) scale(1.15); z-index: 999981; }
.fw-pin[data-priority="high"] { background: var(--fw-danger); }
.fw-pin[data-priority="low"] { background: #9aa3ad; }
.fw-pin[data-status="progress"] { background: var(--fw-warn); }
.fw-pin[data-status="done"] { background: var(--fw-success); }
.fw-pin[data-status="rejected"] { background: #9aa3ad; opacity: 0.5; }
.fw-pin.fw-orphan { border-style: dashed; opacity: 0.6; }
.fw-pins-hidden .fw-pin { display: none; }

/* ============== Nová poznámka — popup formulář ============== */
.fw-form-popup {
  position: absolute;
  z-index: 999989;
  width: 320px;
  background: var(--fw-bg);
  border-radius: var(--fw-radius);
  box-shadow: var(--fw-shadow);
  padding: 14px;
  border: 1px solid var(--fw-line);
  display: none;
}
.fw-form-popup.fw-visible { display: block; }
.fw-form-popup h4 {
  margin: 0 0 10px;
  font-size: 14px;
  font-weight: 700;
  color: var(--fw-ink);
}
.fw-form-popup label {
  display: block;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--fw-ink-muted);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.fw-form-popup textarea,
.fw-form-popup select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--fw-line);
  border-radius: 6px;
  font-family: inherit;
  font-size: 13px;
  background: white;
  color: var(--fw-ink);
  margin-bottom: 10px;
}
.fw-form-popup textarea:focus,
.fw-form-popup select:focus {
  outline: 2px solid var(--fw-primary);
  outline-offset: -2px;
}
.fw-form-popup textarea { resize: vertical; min-height: 70px; }
.fw-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.fw-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 6px;
}
.fw-btn {
  padding: 7px 14px;
  border-radius: 6px;
  border: none;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.fw-btn-primary { background: var(--fw-primary); color: white; }
.fw-btn-primary:hover { background: var(--fw-primary-deep); }
.fw-btn-ghost { background: transparent; color: var(--fw-ink-muted); }
.fw-btn-ghost:hover { background: var(--fw-bg-soft); }

/* ============== Side panel (správa všech poznámek) ============== */
.fw-panel {
  position: fixed;
  top: 0; right: -440px;
  width: 420px;
  height: 100vh;
  background: var(--fw-bg);
  z-index: 999992;
  box-shadow: -10px 0 30px -10px rgba(15, 30, 54, 0.18);
  transition: right 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--fw-line);
}
.fw-panel.fw-open { right: 0; }
.fw-panel-header {
  padding: 16px 18px;
  border-bottom: 1px solid var(--fw-line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--fw-bg-soft);
}
.fw-panel-header h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
}
.fw-panel-close {
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--fw-ink-muted);
  font-size: 22px;
  line-height: 1;
  padding: 0 4px;
}
.fw-panel-close:hover { color: var(--fw-ink); }

.fw-filters {
  display: flex;
  gap: 4px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--fw-line);
  overflow-x: auto;
}
.fw-filter {
  padding: 4px 10px;
  border-radius: 100px;
  border: 1px solid var(--fw-line);
  background: white;
  font-size: 12px;
  cursor: pointer;
  color: var(--fw-ink-muted);
  white-space: nowrap;
}
.fw-filter.fw-active {
  background: var(--fw-primary);
  color: white;
  border-color: var(--fw-primary);
}

.fw-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px 18px;
}
.fw-list-empty {
  text-align: center;
  padding: 32px 16px;
  color: var(--fw-ink-muted);
  font-size: 13px;
}
.fw-note-card {
  background: white;
  border: 1px solid var(--fw-line);
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: all 0.18s;
  display: grid;
  grid-template-columns: 4px 1fr;
  gap: 10px;
}
.fw-note-card:hover {
  border-color: var(--fw-primary);
  box-shadow: 0 4px 10px rgba(15, 30, 54, 0.06);
}
.fw-note-marker { width: 4px; border-radius: 4px; background: var(--fw-primary); }
.fw-note-card[data-priority="high"] .fw-note-marker { background: var(--fw-danger); }
.fw-note-card[data-priority="low"] .fw-note-marker { background: #9aa3ad; }
.fw-note-meta {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 11px;
  color: var(--fw-ink-muted);
  margin-bottom: 4px;
  flex-wrap: wrap;
}
.fw-note-time { font-family: 'JetBrains Mono', monospace; }
.fw-note-status {
  padding: 1px 7px;
  border-radius: 100px;
  font-weight: 700;
  font-size: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.fw-status-new { background: rgba(30, 95, 163, 0.12); color: var(--fw-primary); }
.fw-status-progress { background: rgba(184, 134, 11, 0.15); color: var(--fw-warn); }
.fw-status-done { background: rgba(30, 126, 52, 0.12); color: var(--fw-success); }
.fw-status-rejected { background: rgba(154, 163, 173, 0.18); color: var(--fw-ink-muted); }
.fw-note-desc {
  font-size: 13px;
  color: var(--fw-ink);
  white-space: pre-wrap;
  overflow-wrap: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.fw-note-loc {
  font-size: 11px;
  color: var(--fw-ink-muted);
  margin-top: 4px;
  font-family: 'JetBrains Mono', monospace;
  opacity: 0.7;
}

/* ============== Detail (vlákno komentářů) ============== */
.fw-detail {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.fw-detail-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--fw-line);
  background: var(--fw-bg-soft);
}
.fw-detail-back {
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--fw-primary);
  font-size: 12px;
  font-weight: 600;
  padding: 0;
  margin-bottom: 8px;
}
.fw-detail-desc {
  font-size: 14px;
  white-space: pre-wrap;
  margin-bottom: 10px;
}
.fw-detail-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}
.fw-detail-actions select {
  flex: 1;
  padding: 5px 10px;
  border: 1px solid var(--fw-line);
  border-radius: 6px;
  background: white;
  font-size: 12.5px;
}
.fw-detail-delete {
  background: transparent;
  border: 1px solid var(--fw-line);
  color: var(--fw-danger);
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 12px;
  cursor: pointer;
}

.fw-comments {
  flex: 1;
  overflow-y: auto;
  padding: 14px 18px;
}
.fw-comment {
  margin-bottom: 12px;
}
.fw-comment-author {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--fw-ink-muted);
  margin-bottom: 3px;
}
.fw-comment-author .fw-comment-time {
  font-weight: 400;
  margin-left: 8px;
  font-family: 'JetBrains Mono', monospace;
}
.fw-comment-body {
  background: var(--fw-bg-soft);
  padding: 9px 12px;
  border-radius: 10px;
  font-size: 13px;
  white-space: pre-wrap;
}
.fw-reply-form {
  border-top: 1px solid var(--fw-line);
  padding: 12px 18px;
  background: white;
}
.fw-reply-form textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--fw-line);
  border-radius: 6px;
  font-family: inherit;
  font-size: 13px;
  resize: vertical;
  min-height: 50px;
  margin-bottom: 8px;
}
.fw-reply-form button { width: 100%; }

@media (max-width: 600px) {
  .fw-panel { width: 100%; right: -100%; }
  .fw-form-popup { width: calc(100vw - 40px); }
}


/* Online indikátor v launcheru */
.fw-launcher::before {
  content: '';
  position: absolute;
  top: -2px; right: -2px;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: #9aa3ad;
  border: 2px solid white;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.06);
  transition: background 0.3s;
}
.fw-launcher { position: fixed; }
.fw-launcher.fw-launcher-online::before { background: #1e7e34; box-shadow: 0 0 8px rgba(30, 126, 52, 0.5); }
.fw-launcher.fw-launcher-offline::before { background: #9aa3ad; }


/* Target info (vybraný prvek ve formuláři i detailu) */
.fw-target-info {
  background: var(--fw-bg-soft);
  border-left: 3px solid var(--fw-primary);
  padding: 8px 12px;
  border-radius: 6px;
  margin-bottom: 12px;
  font-size: 12.5px;
}
.fw-target-tag {
  font-family: 'JetBrains Mono', monospace;
  color: var(--fw-primary);
  font-weight: 600;
  margin-bottom: 3px;
}
.fw-target-text {
  font-family: inherit;
  font-weight: 400;
  color: var(--fw-ink);
  font-style: italic;
}
.fw-target-sel {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  color: var(--fw-ink-muted);
  opacity: 0.85;
  word-break: break-all;
}
.fw-target-locate {
  margin-top: 8px;
  padding: 5px 12px;
  border: 1px solid var(--fw-primary);
  background: white;
  color: var(--fw-primary);
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  font-weight: 500;
}
.fw-target-locate:hover {
  background: var(--fw-primary);
  color: white;
}
