/*
 * Simhsync AI — global floating assistant
 * The assistant name is a protected product identity and is not configurable.
 */

.simh-ai-sr-only,
.simh-ai-widget .sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.simh-ai-widget-launcher {
  position: fixed;
  right: 18px;
  bottom: max(18px, env(safe-area-inset-bottom));
  z-index: 96;

  width: 56px;
  height: 56px;
  min-width: 56px;
  min-height: 56px;
  display: inline-flex;
  align-items: center;
  justify-content: center;

  padding: 0;
  color: #ffffff;
  background: linear-gradient(145deg, #0f9d92, #075e67);
  border: 0;
  border-radius: 50%;
  box-shadow:
    0 16px 34px rgba(4, 20, 31, 0.26),
    0 0 0 5px rgba(183, 216, 61, 0.14);

  cursor: pointer;
  font: inherit;
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    opacity 0.18s ease;
}

.simh-ai-widget-launcher:hover {
  transform: translateY(-2px);
  box-shadow:
    0 20px 40px rgba(4, 20, 31, 0.31),
    0 0 0 6px rgba(183, 216, 61, 0.17);
}

.simh-ai-widget-launcher:focus-visible {
  outline: 3px solid rgba(47, 128, 237, 0.35);
  outline-offset: 4px;
}

.simh-ai-launcher-icon {
  position: relative;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
}

.simh-ai-launcher-icon svg {
  width: 27px;
  height: 27px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.simh-ai-launcher-badge {
  position: absolute;
  right: -8px;
  top: -7px;
  min-width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  padding: 0 4px;
  color: #04141f;
  background: #b7d83d;
  border: 2px solid #ffffff;
  border-radius: 999px;
  font-size: 8px;
  font-weight: 950;
  letter-spacing: 0.02em;
}

.simh-ai-launcher-tooltip {
  position: absolute;
  right: calc(100% + 12px);
  bottom: 8px;
  width: max-content;
  max-width: 190px;
  padding: 8px 10px;
  color: #ffffff;
  background: #04141f;
  border-radius: 7px;
  box-shadow: 0 10px 24px rgba(4, 20, 31, 0.22);
  opacity: 0;
  transform: translateX(5px);
  pointer-events: none;
  font-size: 11px;
  font-weight: 850;
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.simh-ai-widget-launcher:hover .simh-ai-launcher-tooltip,
.simh-ai-widget-launcher:focus-visible .simh-ai-launcher-tooltip {
  opacity: 1;
  transform: translateX(0);
}

body.simh-ai-widget-open .simh-ai-widget-launcher {
  opacity: 0;
  transform: scale(0.88);
  pointer-events: none;
}

.simh-ai-widget {
  position: fixed;
  right: 18px;
  bottom: 84px;
  z-index: 98;

  width: min(352px, calc(100vw - 24px));
  height: min(490px, calc(100vh - 190px));
  min-height: 350px;
  max-height: 490px;

  display: flex;
  flex-direction: column;
  overflow: hidden;

  visibility: hidden;
  opacity: 0;
  transform: translateY(14px) scale(0.975);
  transform-origin: bottom right;
  pointer-events: none;

  color: #17344a;
  background: #ffffff;
  border: 1px solid #d8e3e7;
  border-radius: 14px;
  box-shadow: 0 26px 66px rgba(4, 20, 31, 0.29);

  transition:
    opacity 0.18s ease,
    transform 0.18s ease,
    visibility 0.18s ease;
}

.simh-ai-widget.is-open {
  visibility: visible;
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.simh-ai-widget-head {
  min-height: 64px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 13px;
  color: #ffffff;
  background:
    radial-gradient(circle at 88% 15%, rgba(183, 216, 61, 0.18), transparent 28%),
    linear-gradient(90deg, #04141f, #0b2d42 58%, #0b6b73);
}

.simh-ai-widget-avatar {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  display: grid;
  place-items: center;
  color: #04141f;
  background: #b7d83d;
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(183, 216, 61, 0.13);
  font-size: 10px;
  font-weight: 950;
}

.simh-ai-widget-head > div {
  min-width: 0;
}

.simh-ai-widget-head strong,
.simh-ai-widget-head small {
  display: block;
}

.simh-ai-widget-head strong {
  font-size: 13px;
  line-height: 1.2;
}

.simh-ai-widget-head small {
  margin-top: 2px;
  color: #c9dde5;
  font-size: 9.5px;
  line-height: 1.25;
}

.simh-ai-widget-close {
  width: 32px;
  height: 32px;
  margin-left: auto;
  flex: 0 0 32px;
  display: grid;
  place-items: center;
  padding: 0;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.11);
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  font-size: 19px;
  line-height: 1;
}

.simh-ai-widget-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

.simh-ai-widget-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 12px;
  background:
    radial-gradient(circle at 15% 0%, rgba(15, 157, 146, 0.05), transparent 24%),
    #f5fafb;
}

.simh-ai-widget .simh-ai-message {
  display: flex;
  margin-bottom: 10px;
}

.simh-ai-widget .simh-ai-message.user {
  justify-content: flex-end;
}

.simh-ai-widget .simh-ai-message.assistant {
  justify-content: flex-start;
}

.simh-ai-widget .simh-ai-bubble {
  max-width: 88%;
  padding: 9px 11px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: #244354;
  background: #ffffff;
  border: 1px solid #dce8eb;
  border-radius: 4px 12px 12px 12px;
  box-shadow: 0 5px 14px rgba(7, 30, 43, 0.04);
  font-size: 11.5px;
  line-height: 1.5;
}

.simh-ai-widget .simh-ai-message.user .simh-ai-bubble {
  color: #ffffff;
  background: linear-gradient(135deg, #0f9d92, #0b6b73);
  border-color: transparent;
  border-radius: 12px 4px 12px 12px;
}

.simh-ai-widget .simh-ai-answer-meta {
  margin-top: 7px;
  padding-top: 6px;
  color: #6c8290;
  border-top: 1px solid #edf2f4;
  font-size: 9px;
}

.simh-ai-widget .simh-ai-feedback {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 7px;
}

.simh-ai-widget .simh-ai-feedback span {
  color: #718594;
  font-size: 9px;
}

.simh-ai-widget .simh-ai-feedback button {
  min-height: 24px;
  padding: 3px 8px;
  color: #365363;
  background: #ffffff;
  border: 1px solid #dbe7ea;
  border-radius: 999px;
  cursor: pointer;
  font-size: 9px;
  font-weight: 850;
}

.simh-ai-widget .simh-ai-feedback button.is-selected {
  color: #ffffff;
  background: #0b6b73;
  border-color: #0b6b73;
}

.simh-ai-widget-suggestions {
  max-height: 72px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  overflow-y: auto;
  padding: 8px 10px;
  background: #ffffff;
  border-top: 1px solid #edf2f4;
}

.simh-ai-widget-suggestions:empty {
  display: none;
}

.simh-ai-widget-suggestions button {
  min-height: 28px;
  max-width: 100%;
  flex: 0 1 auto;
  padding: 5px 9px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #0b6b73;
  background: #eef9f8;
  border: 1px solid #cce9e6;
  border-radius: 999px;
  cursor: pointer;
  font-size: 9.5px;
  font-weight: 850;
}

.simh-ai-widget-form {
  display: flex !important;
  align-items: flex-end !important;
  gap: 8px !important;
  width: 100%;
  padding: 9px 10px 10px;
  margin: 0;
  background: #ffffff;
  border-top: 1px solid #e1eaed;
}

.simh-ai-widget-form textarea {
  width: auto !important;
  min-width: 0 !important;
  flex: 1 1 auto !important;
  min-height: 42px !important;
  height: 42px;
  max-height: 78px !important;
  margin: 0 !important;
  padding: 10px 12px !important;
  resize: none !important;
  overflow-y: auto;
  color: #17344a;
  background: #f8fbfc;
  border: 1px solid #cfdde2 !important;
  border-radius: 10px !important;
  outline: 0;
  font: inherit;
  font-size: 11.5px !important;
  line-height: 1.35;
}

.simh-ai-widget-form textarea:focus {
  background: #ffffff;
  border-color: #0f9d92 !important;
  box-shadow: 0 0 0 3px rgba(15, 157, 146, 0.12);
}

.simh-ai-widget-form button[type="submit"] {
  width: 42px !important;
  height: 42px !important;
  min-width: 42px !important;
  min-height: 42px !important;
  flex: 0 0 42px !important;
  display: grid !important;
  place-items: center;
  padding: 0 !important;
  margin: 0 !important;
  color: #ffffff;
  background: linear-gradient(145deg, #0f9d92, #075e67);
  border: 0 !important;
  border-radius: 10px !important;
  box-shadow: 0 8px 18px rgba(11, 107, 115, 0.2);
  cursor: pointer;
}

.simh-ai-widget-form button[type="submit"] svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.simh-ai-widget-form button[type="submit"]:disabled {
  opacity: 0.58;
  cursor: wait;
}

.simh-ai-widget-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 10px 8px;
  color: #718594;
  background: #ffffff;
  border-top: 1px solid #edf2f4;
  font-size: 8.5px;
}

.simh-ai-widget-footer a {
  color: #0b6b73;
  font-weight: 900;
  white-space: nowrap;
}

.page-simhsycn_ai .simh-ai-widget-launcher,
.page-simhsycn_ai .simh-ai-widget {
  display: none !important;
}

@media (max-width: 760px) {
  .simh-ai-widget-launcher {
    right: 12px;
    bottom: max(12px, env(safe-area-inset-bottom));
    width: 52px;
    height: 52px;
    min-width: 52px;
    min-height: 52px;
  }

  .simh-ai-launcher-tooltip {
    display: none;
  }

  .simh-ai-widget {
    right: 10px;
    bottom: 74px;
    width: calc(100vw - 20px);
    height: min(500px, calc(100dvh - 150px));
    min-height: 320px;
    max-height: 500px;
    border-radius: 13px;
  }

  .simh-ai-widget-suggestions {
    max-height: 66px;
  }
}

@media (max-height: 620px) {
  .simh-ai-widget {
    height: calc(100vh - 130px);
    min-height: 280px;
    bottom: 70px;
  }

  .simh-ai-widget-suggestions {
    max-height: 52px;
  }
}

/* Dark-mode support. */
html[data-theme="dark"] .simh-ai-widget {
  color: var(--simh-text, #e5edf8);
  background: var(--simh-surface, #111b2d);
  border-color: var(--simh-border, #26354b);
}

html[data-theme="dark"] .simh-ai-widget-messages {
  background: var(--simh-bg-elevated, #0e1728);
}

html[data-theme="dark"] .simh-ai-widget .simh-ai-bubble,
html[data-theme="dark"] .simh-ai-widget-suggestions,
html[data-theme="dark"] .simh-ai-widget-form,
html[data-theme="dark"] .simh-ai-widget-footer {
  color: var(--simh-text, #e5edf8);
  background: var(--simh-surface, #111b2d);
  border-color: var(--simh-border, #26354b);
}

html[data-theme="dark"] .simh-ai-widget .simh-ai-message.user .simh-ai-bubble {
  color: #ffffff;
  background: #0b6b73;
  border-color: #0b6b73;
}

html[data-theme="dark"] .simh-ai-widget-suggestions button,
html[data-theme="dark"] .simh-ai-widget .simh-ai-feedback button {
  color: #8de7dd;
  background: #123634;
  border-color: #25534f;
}

html[data-theme="dark"] .simh-ai-widget-form textarea {
  color: var(--simh-text-strong, #f8fafc);
  background: var(--simh-surface-muted, #152136);
  border-color: var(--simh-border, #26354b) !important;
}

/* Stage 3: prominent sidebar prompt beside the permanent Simhsync AI link. */
.simh-ai-nav-link {
  position: relative;
}

.simh-ai-nav-alert {
  margin-left: auto;
  min-width: 34px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 7px;
  color: #ffffff;
  background: #dc2626;
  border: 1px solid rgba(255, 255, 255, 0.75);
  border-radius: 999px;
  box-shadow: 0 5px 12px rgba(185, 28, 28, 0.24);
  font-size: 8px;
  font-style: normal;
  font-weight: 950;
  line-height: 1;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  animation: simh-ai-nav-alert-pulse 2.2s ease-in-out infinite;
}

.simh-ai-nav-link:hover .simh-ai-nav-alert,
.simh-ai-nav-link.active .simh-ai-nav-alert {
  color: #ffffff;
  background: #b91c1c;
}

@keyframes simh-ai-nav-alert-pulse {
  0%, 100% { transform: scale(1); box-shadow: 0 5px 12px rgba(185, 28, 28, 0.24); }
  50% { transform: scale(1.07); box-shadow: 0 6px 16px rgba(220, 38, 38, 0.38); }
}

@media (prefers-reduced-motion: reduce) {
  .simh-ai-nav-alert { animation: none; }
}


/* Stage 5: working answer feedback */
.simh-ai-widget .simh-ai-feedback {
  align-items: flex-start;
}

.simh-ai-widget .simh-ai-feedback-label {
  padding-top: 4px;
}

.simh-ai-widget .simh-ai-feedback-actions {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.simh-ai-widget .simh-ai-feedback-status {
  width: 100%;
  min-height: 13px;
  color: #537180;
  font-size: 8.5px;
  line-height: 1.35;
}

.simh-ai-widget .simh-ai-feedback-comment {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
  margin-top: 2px;
}

.simh-ai-widget .simh-ai-feedback-comment[hidden] {
  display: none !important;
}

.simh-ai-widget .simh-ai-feedback-comment textarea {
  width: 100%;
  min-height: 42px;
  max-height: 72px;
  padding: 7px 8px;
  resize: vertical;
  color: #17344a;
  background: #ffffff;
  border: 1px solid #dbe7ea;
  border-radius: 7px;
  font: inherit;
  font-size: 9px;
  line-height: 1.35;
}

.simh-ai-widget .simh-ai-feedback-comment button {
  align-self: end;
  min-height: 32px;
  border-radius: 7px;
}

.simh-ai-widget .simh-ai-feedback button:disabled {
  cursor: wait;
  opacity: .62;
}

html[data-theme="dark"] .simh-ai-widget .simh-ai-feedback-comment textarea {
  color: #e7f3f6;
  background: #102b38;
  border-color: #284958;
}
