/* ============================================================
   WORK HUB · FEEDBACK-WIDGET
   En och samma widget på alla undersidor till Hubben.
   Använder tokens från work-hub.css (--midnight, --gold, …).
   ============================================================ */

@keyframes whfb-slidein { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }
@keyframes whfb-fadeout { from { opacity: 1; } to { opacity: 0; } }
@keyframes whfb-pulse { 0% { box-shadow: 0 0 0 0 rgba(232,168,56,0.6); } 70% { box-shadow: 0 0 0 12px rgba(232,168,56,0); } 100% { box-shadow: 0 0 0 0 rgba(232,168,56,0); } }

.wh-fb-fab {
  position: fixed; bottom: 22px; right: 22px; z-index: 900;
  background: var(--midnight); color: #fff;
  border: none; border-radius: 999px;
  padding: 0.7rem 1.1rem;
  font-size: 0.8rem; font-weight: 600;
  cursor: pointer;
  box-shadow: 0 8px 28px rgba(20,18,14,0.28);
  display: inline-flex; align-items: center; gap: 0.5rem;
  transition: all 0.2s ease;
  font-family: var(--font-ui, 'Inter', sans-serif);
}
.wh-fb-fab:hover { background: var(--gold); color: var(--midnight); transform: translateY(-2px); box-shadow: 0 12px 36px rgba(20,18,14,0.35); }
.wh-fb-fab .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--gold); animation: whfb-pulse 2.4s infinite; }

/* Mobil: krymp fab till bara ikon så den inte täcker knappar i modaler/pipeline */
@media (max-width: 720px) {
  .wh-fb-fab { padding: 0.55rem 0.7rem; font-size: 0; gap: 0; bottom: 14px; right: 14px; }
  .wh-fb-fab .dot { margin: 0 4px; }
  .wh-fb-fab::after { content: "✎"; font-size: 0.95rem; }
}
/* Göm fab när en modal är öppen (täcker annars Avbryt/Spara-knappar i mobil) */
body:has(.modal-overlay:not([style*="display: none"])) .wh-fb-fab,
body:has(.pj-modal-backdrop) .wh-fb-fab,
body:has(#wde-rec-modal[style*="display: flex"]) .wh-fb-fab,
body:has(.wde-modal-backdrop[style*="display: flex"]) .wh-fb-fab { display: none !important; }

/* Mini-chip: används i löpande text och guider för att hänvisa till Feedback-knappen.
   Ser ut som FAB:en i miniformat så ord och knapp matchar visuellt. */
.wh-fb-chip {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--midnight, #1a1a2e); color: #fff;
  padding: 2px 9px 2px 8px; border-radius: 999px;
  font-size: 0.82em; font-weight: 600; line-height: 1.4;
  vertical-align: 1px; white-space: nowrap;
  font-family: var(--font-ui, 'Inter', sans-serif);
}
.wh-fb-chip::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: var(--gold, #e8a838); display: inline-block;
}

.wh-fb-overlay {
  position: fixed; inset: 0;
  background: rgba(20,18,14,0.55);
  backdrop-filter: blur(2px);
  z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
}
.wh-fb-modal {
  background: #fff; border-radius: 14px;
  box-shadow: 0 24px 80px rgba(0,0,0,0.3);
  max-width: 540px; width: 100%; overflow: hidden;
  max-height: 90vh; display: flex; flex-direction: column;
  font-family: var(--font-ui, 'Inter', sans-serif);
  color: var(--charcoal);
}
.wh-fb-head { padding: 1.1rem 1.3rem 0.9rem; border-bottom: 1px solid var(--light-gray); display: flex; justify-content: space-between; align-items: flex-start; gap: 0.5rem; }
.wh-fb-head h3 { font-family: var(--font-display, 'DM Serif Display', serif); font-size: 1.4rem; color: var(--midnight); font-weight: 400; margin: 0; }
.wh-fb-head p { color: var(--medium-gray); font-size: 0.8rem; margin-top: 0.25rem; }
.wh-fb-close { background: transparent; border: none; color: var(--medium-gray); font-size: 1.1rem; cursor: pointer; padding: 0.25rem; }
.wh-fb-close:hover { color: var(--midnight); }

.wh-fb-body { padding: 1.1rem 1.3rem 1.3rem; overflow-y: auto; }
.wh-fb-type-row { display: flex; gap: 0.3rem; flex-wrap: wrap; margin-bottom: 0.9rem; }
.wh-fb-type {
  padding: 0.38rem 0.75rem;
  font-size: 0.74rem;
  border-radius: 999px;
  border: 1px solid var(--light-gray);
  background: #fff;
  color: var(--charcoal);
  cursor: pointer;
  transition: all 0.2s ease;
  font-weight: 500; font-family: inherit;
}
.wh-fb-type:hover { border-color: var(--medium-gray); color: var(--midnight); }
.wh-fb-type.active { background: var(--midnight); color: #fff; border-color: var(--midnight); }
.wh-fb-text {
  width: 100%; min-height: 120px;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--light-gray); border-radius: 8px;
  font-size: 0.88rem; font-family: inherit;
  resize: vertical; outline: none;
  transition: border-color 160ms, box-shadow 160ms;
  color: var(--charcoal); line-height: 1.5;
}
.wh-fb-text:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(232,168,56,0.15); }
.wh-fb-hint { font-size: 0.72rem; color: var(--medium-gray); margin-top: 0.6rem; }
.wh-fb-hint code { background: var(--cream); padding: 0.05rem 0.35rem; border-radius: 3px; font-family: ui-monospace, monospace; font-size: 0.7rem; }
.wh-fb-actions { display: flex; justify-content: space-between; align-items: center; margin-top: 1rem; gap: 0.5rem; flex-wrap: wrap; }
.wh-fb-toggle-list { font-size: 0.74rem; color: var(--medium-gray); text-decoration: underline; cursor: pointer; background: transparent; border: none; padding: 0; font-family: inherit; }
.wh-fb-toggle-list:hover { color: var(--gold-dark); }
.wh-fb-btn-primary { background: var(--gold); color: var(--midnight); border: none; padding: 0.6rem 1.3rem; border-radius: 8px; font-weight: 600; font-size: 0.84rem; cursor: pointer; transition: all 0.2s ease; font-family: inherit; }
.wh-fb-btn-primary:hover { background: var(--gold-dark); color: #fff; }
.wh-fb-btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.wh-fb-btn-pick { background: transparent; color: var(--midnight); border: 1px dashed var(--light-gray); padding: 0.5rem 0.9rem; border-radius: 8px; font-weight: 500; font-size: 0.78rem; cursor: pointer; transition: all 0.2s ease; display: inline-flex; align-items: center; gap: 0.4rem; font-family: inherit; }
.wh-fb-btn-pick:hover { border-color: var(--gold); color: var(--gold-dark); }
.wh-fb-picked { margin-top: 0.6rem; padding: 0.55rem 0.75rem; background: #fef9ec; border: 1px solid #e9d28b; border-radius: 8px; font-size: 0.76rem; color: #5b4612; display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.wh-fb-picked code { background: #fff5d6; padding: 0.05rem 0.35rem; border-radius: 3px; font-family: ui-monospace, monospace; font-size: 0.7rem; }
.wh-fb-picked-clear { background: transparent; border: none; color: #a07c1f; cursor: pointer; font-size: 0.85rem; padding: 0; }

body.wh-fb-picking, body.wh-fb-picking * { cursor: crosshair !important; }
body.wh-fb-picking .wh-fb-fab, body.wh-fb-picking .wh-fb-pick-banner { cursor: pointer !important; }
.wh-fb-pick-banner { position: fixed; top: 12px; left: 50%; transform: translateX(-50%); z-index: 100000; background: var(--midnight); color: #fff; padding: 0.55rem 1.1rem; border-radius: 999px; font-size: 0.8rem; box-shadow: 0 8px 24px rgba(0,0,0,0.25); display: flex; align-items: center; gap: 0.65rem; font-family: var(--font-ui, 'Inter', sans-serif); }
.wh-fb-pick-banner button { background: var(--gold); color: var(--midnight); border: none; padding: 0.25rem 0.7rem; border-radius: 999px; font-size: 0.74rem; font-weight: 600; cursor: pointer; font-family: inherit; }
.wh-fb-pick-highlight { position: absolute; pointer-events: none; z-index: 99999; border: 2px solid var(--gold); background: rgba(232,168,56,0.12); border-radius: 4px; transition: all 80ms ease-out; box-shadow: 0 0 0 9999px rgba(20,18,14,0.04); }

.wh-fb-list { max-height: 320px; overflow-y: auto; margin-top: 0.8rem; border-top: 1px solid var(--light-gray); padding-top: 0.8rem; }
.wh-fb-item { padding: 0.65rem 0; border-bottom: 1px solid var(--light-gray); display: flex; gap: 0.65rem; }
.wh-fb-item:last-child { border-bottom: none; }
.wh-fb-type-chip { font-size: 0.62rem; padding: 0.12rem 0.55rem; border-radius: 999px; text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; white-space: nowrap; height: fit-content; }
.wh-fb-type-chip.type-bug { background: #fde8ec; color: #b53258; }
.wh-fb-type-chip.type-design { background: #ebe3fb; color: #6b3fbe; }
.wh-fb-type-chip.type-feature { background: #e4ecfb; color: #1e4ab8; }
.wh-fb-type-chip.type-idea { background: #f3ead4; color: #8a6a2a; }
.wh-fb-type-chip.type-other { background: #efece5; color: #5a574f; }
.wh-fb-item-body { flex: 1; min-width: 0; }
.wh-fb-item-meta { display: flex; justify-content: space-between; gap: 0.5rem; margin-bottom: 0.2rem; font-size: 0.72rem; color: var(--medium-gray); }
.wh-fb-item-meta .wh-fb-user { color: var(--midnight); font-weight: 600; }
.wh-fb-item-text { font-size: 0.84rem; color: var(--charcoal); line-height: 1.45; white-space: pre-wrap; word-wrap: break-word; }
.wh-fb-item-footer { margin-top: 0.35rem; display: flex; justify-content: space-between; align-items: center; font-size: 0.7rem; color: var(--medium-gray); gap: 0.5rem; }
.wh-fb-item-footer a { color: var(--medium-gray); text-decoration: underline; }
.wh-fb-item-footer a:hover { color: var(--gold-dark); }
.wh-fb-source { font-size: 0.62rem; padding: 0.05rem 0.4rem; border-radius: 999px; background: var(--cream); color: var(--charcoal); font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
.wh-fb-status-sel { font-size: 0.7rem; padding: 0.15rem 0.4rem; border: 1px solid var(--light-gray); border-radius: 6px; background: #fff; color: var(--charcoal); cursor: pointer; font-family: inherit; }
.wh-fb-status-sel.status-fixed { background: #e6efea; color: #2d5a3d; border-color: #c3e0cd; }
.wh-fb-status-sel.status-wontfix { background: var(--cream); color: var(--medium-gray); }

.wh-fb-toast {
  position: fixed; bottom: 80px; right: 22px; z-index: 1100;
  background: var(--midnight); color: #fff;
  padding: 0.65rem 1rem; border-radius: 8px;
  font-size: 0.82rem; font-family: inherit;
  box-shadow: 0 8px 28px rgba(20,18,14,0.28);
  animation: whfb-slidein 0.28s cubic-bezier(0.2,0.7,0.2,1), whfb-fadeout 0.3s ease 2.7s;
}
.wh-fb-toast.warning { background: var(--rust, #c45c3e); }

@media print {
  .wh-fb-fab, .wh-fb-overlay, .wh-fb-pick-banner, .wh-fb-pick-highlight, .wh-fb-toast { display: none !important; }
}
