/**
 * Coach Y floating chatbot — Synapse Nursing purple + gold.
 * Collapsed by default (FAB only); panel overlays bottom-right.
 */
#coachy-widget-root {
  position: fixed;
  right: 0;
  bottom: 0;
  z-index: 99990;
  font-family: "Plus Jakarta Sans", "Inter", system-ui, sans-serif;
  pointer-events: none;
}
#coachy-widget-root * {
  pointer-events: auto;
  box-sizing: border-box;
}

/* ---------- Floating robot FAB ---------- */
#coachy-fab {
  position: fixed;
  right: 18px;
  bottom: 18px;
  width: 68px;
  height: 68px;
  padding: 0;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  background: transparent;
  z-index: 99991;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.25s ease, filter 0.25s ease;
  animation: coachy-fab-breathe 3.6s ease-in-out infinite;
  filter: drop-shadow(0 6px 20px rgba(124, 58, 237, 0.55)) drop-shadow(0 2px 8px rgba(245, 158, 11, 0.25));
}
#coachy-fab:hover {
  transform: scale(1.07);
  filter: drop-shadow(0 10px 28px rgba(124, 58, 237, 0.65)) drop-shadow(0 4px 14px rgba(245, 158, 11, 0.35));
}
#coachy-fab:focus-visible {
  outline: 3px solid #a78bfa;
  outline-offset: 3px;
}
#coachy-fab[aria-expanded="true"] {
  transform: scale(0.96);
  filter: drop-shadow(0 4px 16px rgba(124, 58, 237, 0.45));
}

#coachy-fab .coachy-fab-label {
  position: absolute;
  right: 82px;
  bottom: 22px;
  white-space: nowrap;
  background: linear-gradient(135deg, #7c3aed, #5b21b6);
  color: #f4f0ff;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 8px 12px;
  border-radius: 12px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s;
  max-width: min(210px, 52vw);
  overflow: hidden;
  text-overflow: ellipsis;
  border: 1px solid rgba(167, 139, 250, 0.35);
  box-shadow: 0 8px 24px rgba(124, 58, 237, 0.35);
}
#coachy-fab:hover .coachy-fab-label,
#coachy-fab:focus-visible .coachy-fab-label {
  opacity: 1;
}

.coachy-bot-wrap {
  display: block;
  width: 62px;
  height: 62px;
}

.coachy-bubble-icon {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  object-position: top center;
  border: 1px solid rgba(124, 58, 237, 0.4);
  background: #0a0516;
  animation: coachy-bubble-pulse 3s ease-in-out infinite;
}

@keyframes coachy-bubble-pulse {
  0%,
  88%,
  100% {
    transform: scale(1);
    filter: drop-shadow(0 4px 14px rgba(124, 58, 237, 0.4));
  }
  94% {
    transform: scale(1.06);
    filter: drop-shadow(0 6px 20px rgba(245, 158, 11, 0.45));
  }
}

@keyframes coachy-fab-breathe {
  0%,
  100% {
    filter: drop-shadow(0 6px 18px rgba(124, 58, 237, 0.45)) drop-shadow(0 0 10px rgba(124, 58, 237, 0.25));
  }
  50% {
    filter: drop-shadow(0 8px 28px rgba(124, 58, 237, 0.65)) drop-shadow(0 0 22px rgba(245, 158, 11, 0.35));
  }
}
@media (prefers-reduced-motion: reduce) {
  #coachy-fab {
    animation: none;
  }
  .coachy-bubble-icon {
    animation: none;
  }
}

@keyframes coachy-float {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-5px);
  }
}

.coachy-bot-svg {
  display: block;
  width: 72px;
  height: 72px;
}

/* Eye layers — mood states */
.coachy-eye-layer {
  transition: opacity 0.35s ease;
}
#coachy-fab.coachy-mood-neutral .coachy-eyes-neutral,
#coachy-header-bot-inner.coachy-mood-neutral .coachy-eyes-neutral {
  opacity: 1;
}
#coachy-fab.coachy-mood-neutral .coachy-eyes-love,
#coachy-fab.coachy-mood-neutral .coachy-eyes-alert,
#coachy-header-bot-inner.coachy-mood-neutral .coachy-eyes-love,
#coachy-header-bot-inner.coachy-mood-neutral .coachy-eyes-alert {
  opacity: 0;
}
#coachy-fab.coachy-mood-love .coachy-eyes-love,
#coachy-header-bot-inner.coachy-mood-love .coachy-eyes-love {
  opacity: 1;
}
#coachy-fab.coachy-mood-love .coachy-eyes-neutral,
#coachy-fab.coachy-mood-love .coachy-eyes-alert,
#coachy-header-bot-inner.coachy-mood-love .coachy-eyes-neutral,
#coachy-header-bot-inner.coachy-mood-love .coachy-eyes-alert {
  opacity: 0;
}
#coachy-fab.coachy-mood-alert .coachy-eyes-alert,
#coachy-header-bot-inner.coachy-mood-alert .coachy-eyes-alert {
  opacity: 1;
}
#coachy-fab.coachy-mood-alert .coachy-eyes-neutral,
#coachy-fab.coachy-mood-alert .coachy-eyes-love,
#coachy-header-bot-inner.coachy-mood-alert .coachy-eyes-neutral,
#coachy-header-bot-inner.coachy-mood-alert .coachy-eyes-love {
  opacity: 0;
}

.coachy-eyes-neutral,
.coachy-eyes-love,
.coachy-eyes-alert {
  pointer-events: none;
}

/* Panel header mini avatar */
.coachy-panel-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}
.coachy-header-mini {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border-radius: 50%;
  overflow: hidden;
  box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.4);
}
.coachy-header-mini svg {
  width: 40px;
  height: 40px;
  display: block;
}
#coachy-panel-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
#coachy-panel-title {
  font-size: 0.95rem;
  font-weight: 800;
  margin: 0;
  line-height: 1.2;
}
#coachy-panel-sub {
  font-size: 0.68rem;
  font-weight: 600;
  color: #fcd34d;
  opacity: 0.95;
  margin: 0;
  letter-spacing: 0.02em;
}

#coachy-panel {
  position: fixed;
  right: 20px;
  bottom: 96px;
  width: min(100vw - 32px, 380px);
  height: min(52vh, 420px);
  max-height: calc(100vh - 130px);
  background: #0f0a1e;
  border-radius: 18px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(124, 58, 237, 0.28);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(calc(100% + 120px));
  opacity: 0;
  visibility: hidden;
  transition: transform 0.32s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.22s ease, visibility 0.22s;
}
#coachy-widget-root.coachy-open #coachy-panel {
  transform: translateY(0);
  opacity: 1;
  visibility: visible;
}

.coachy-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: linear-gradient(135deg, #7c3aed 0%, #5b21b6 55%, #4c1d95 100%);
  color: #f4f0ff;
  border-bottom: 1px solid rgba(167, 139, 250, 0.2);
}
.coachy-panel-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}
.coachy-panel-actions button {
  background: rgba(255, 255, 255, 0.14);
  border: none;
  color: #fff;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 1.05rem;
  line-height: 1;
  transition: background 0.15s;
}
.coachy-panel-actions button:hover {
  background: rgba(255, 255, 255, 0.26);
}
#coachy-btn-clear {
  width: auto;
  padding: 0 12px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

#coachy-module-badge {
  font-size: 0.72rem;
  padding: 6px 12px;
  background: rgba(124, 58, 237, 0.15);
  color: #fcd34d;
  border-bottom: 1px solid rgba(124, 58, 237, 0.22);
  font-weight: 600;
}

#coachy-module-badge[hidden] {
  display: none;
}

#coachy-widget-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  background: rgba(10, 5, 22, 0.65);
  color: #f4f0ff;
}

.coachy-bubble {
  max-width: 92%;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 0.86rem;
  line-height: 1.45;
  word-break: break-word;
  color: #f4f0ff;
}
.coachy-bubble .coachy-ts {
  font-size: 0.68rem;
  color: #8b7aa8;
  margin-bottom: 5px;
  font-variant-numeric: tabular-nums;
}
.coachy-bubble .coachy-body {
  color: inherit;
}
.coachy-bubble.user {
  align-self: flex-end;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.95), #d97706);
  border: 1px solid rgba(252, 211, 77, 0.45);
  margin-left: 24px;
  color: #1c1240;
}
.coachy-bubble.user .coachy-ts {
  color: rgba(28, 18, 64, 0.7);
}
.coachy-bubble-img {
  display: block;
  max-width: min(200px, 100%);
  max-height: 140px;
  object-fit: contain;
  border-radius: 8px;
  margin-bottom: 6px;
  border: 1px solid rgba(28, 18, 64, 0.2);
}
.coachy-bubble.coach {
  align-self: flex-start;
  background: rgba(124, 58, 237, 0.2);
  border: 1px solid rgba(167, 139, 250, 0.35);
  color: #f4f0ff;
}

.coachy-panel-footer {
  padding: 10px 12px 12px;
  border-top: 1px solid rgba(124, 58, 237, 0.22);
  background: #0a0516;
}
.coachy-attach-preview {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(124, 58, 237, 0.12);
  border: 1px solid rgba(124, 58, 237, 0.28);
}
.coachy-attach-preview[hidden] {
  display: none !important;
}
.coachy-attach-preview__thumb {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid rgba(252, 211, 77, 0.35);
  flex-shrink: 0;
}
.coachy-attach-preview__label {
  flex: 1;
  min-width: 0;
  font-size: 0.72rem;
  color: #a78bfa;
  line-height: 1.35;
}
.coachy-attach-preview__remove {
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid rgba(248, 113, 113, 0.45);
  background: rgba(127, 29, 29, 0.25);
  color: #fecaca;
  font-size: 0.68rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  flex-shrink: 0;
}
.coachy-attach-input {
  display: none;
}
.coachy-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.coachy-attach-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid rgba(124, 58, 237, 0.35);
  border-radius: 10px;
  background: rgba(10, 5, 22, 0.65);
  color: #a78bfa;
  cursor: pointer;
  font-family: inherit;
  flex-shrink: 0;
}
.coachy-attach-btn:hover {
  border-color: rgba(167, 139, 250, 0.55);
  color: #fcd34d;
}
.coachy-attach-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.coachy-attach-btn--active {
  border-color: rgba(252, 211, 77, 0.55);
  color: #fcd34d;
  background: rgba(245, 158, 11, 0.12);
}
.coachy-attach-btn__icon {
  display: block;
}
#coachy-widget-input {
  flex: 1;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(124, 58, 237, 0.28);
  font-size: 0.88rem;
  font-family: inherit;
  color: #f4f0ff;
  background: rgba(10, 5, 22, 0.65);
}
#coachy-widget-input::placeholder {
  color: #8b7aa8;
}
#coachy-widget-input:disabled {
  background: rgba(15, 10, 30, 0.5);
  color: #8b7aa8;
  cursor: not-allowed;
}
#coachy-widget-send {
  padding: 10px 14px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #1c1240;
  font-weight: 700;
  cursor: pointer;
  font-size: 0.85rem;
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.35);
  flex-shrink: 0;
}
#coachy-widget-send:hover {
  filter: brightness(1.06);
}
#coachy-widget-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.coachy-widget-foot {
  font-size: 11px;
  color: #6b5f8a;
  margin-top: 8px;
  line-height: 1.6;
}

.coachy-widget-foot .coachy-wellness-disclaimer {
  font-style: italic;
}

.coachy-widget-foot a {
  color: #fcd34d;
  font-weight: 700;
}

.coachy-widget-root--landing .coachy-input-row {
  gap: 8px;
}

.coachy-widget-root--landing .coachy-attach-btn,
.coachy-widget-root--landing .coachy-attach-input,
.coachy-widget-root--landing .coachy-attach-preview {
  display: none !important;
}

.coachy-widget-root--landing .coachy-widget-foot {
  display: none;
}

.coachy-landing-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  padding: 0 0.85rem 0.65rem;
}

.coachy-landing-chips[hidden] {
  display: none !important;
}

.coachy-landing-chip {
  font: 500 0.72rem/1.3 "DM Sans", system-ui, sans-serif;
  color: #e9e0ff;
  background: rgba(124, 58, 237, 0.22);
  border: 1px solid rgba(167, 139, 250, 0.35);
  border-radius: 999px;
  padding: 0.4rem 0.7rem;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.coachy-landing-chip:hover,
.coachy-landing-chip:focus-visible {
  background: rgba(124, 58, 237, 0.38);
  border-color: rgba(245, 158, 11, 0.55);
  color: #fff;
  outline: none;
}

.coachy-bubble.coach .coachy-inline-link {
  color: #fcd34d;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.coachy-bubble.coachy-typing {
  opacity: 0.85;
  font-style: italic;
}

.coachy-suggest-prompt {
  margin: 0 0 8px;
  font-size: 0.75rem;
  font-weight: 500;
  color: #a78bfa;
  line-height: 1.45;
}

.coachy-suggest-actions {
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px solid rgba(124, 58, 237, 0.2);
}

.coachy-suggest-btn {
  display: inline-block;
  padding: 5px 11px;
  border: 1px solid rgba(124, 58, 237, 0.45);
  border-radius: 8px;
  background: linear-gradient(135deg, #7c3aed, #5b21b6);
  color: #f4f0ff;
  font-size: 0.72rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  line-height: 1.3;
  box-shadow: none;
  transition: filter 0.15s ease;
}

.coachy-suggest-btn:hover {
  filter: brightness(1.08);
}

.coachy-suggest-thanks {
  margin: 6px 0 0;
  font-size: 0.75rem;
  font-weight: 500;
  color: #fcd34d;
  line-height: 1.45;
}

.coachy-suggest-error {
  margin: 6px 0 0;
  font-size: 0.75rem;
  color: #b45309;
  line-height: 1.35;
}

@media (max-width: 480px) {
  #coachy-panel {
    right: 12px;
    left: 12px;
    width: auto;
    bottom: 88px;
  }
  #coachy-fab {
    right: 14px;
    bottom: 14px;
  }
}
