/* Public Emma - aligned with staff dashboard Emma (pill FAB + overlay panel) */

.emma-public-fab {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 9000;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.65rem 1.1rem;
  border-radius: 999px;
  border: none;
  background: linear-gradient(135deg, #59c593 0%, #2a9d8f 100%);
  color: #fff;
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
}

.emma-public-fab:hover {
  filter: brightness(1.05);
}

.emma-public-fab svg {
  flex-shrink: 0;
}

.emma-public-fab[hidden] {
  display: none !important;
}

.emma-public-overlay {
  position: fixed;
  inset: 0;
  z-index: 9001;
  background: rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  padding: 1rem;
  font-family: "DM Sans", system-ui, sans-serif;
}

.emma-public-overlay[hidden] {
  display: none !important;
}

.emma-public-panel {
  width: min(420px, 100%);
  max-height: min(580px, 85vh);
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.18);
  border: 1px solid #e5e7eb;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.emma-public-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #e5e7eb;
  background: linear-gradient(90deg, rgba(89, 197, 147, 0.12), transparent);
}

.emma-public-head-title {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  color: #333;
}

.emma-public-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
}

.emma-public-close {
  background: none;
  border: none;
  cursor: pointer;
  color: #666;
  font-size: 1.35rem;
  line-height: 1;
  padding: 0.2rem 0.4rem;
  border-radius: 8px;
}

.emma-public-close:hover {
  color: #333;
  background: rgba(0, 0, 0, 0.04);
}

.emma-public-body {
  padding: 1rem;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.emma-public-messages {
  flex: 1;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  min-height: 180px;
  max-height: 320px;
  margin-bottom: 0.75rem;
}

.emma-public-msg-meta {
  font-size: 0.75rem;
  color: #666;
  margin-bottom: 0.2rem;
}

.emma-public-msg-body {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.92rem;
  line-height: 1.4;
  color: #333;
}

.emma-public-msg--user .emma-public-msg-body {
  background: rgba(89, 197, 147, 0.12);
  border-radius: 12px;
  padding: 0.55rem 0.75rem;
}

.emma-public-msg--assistant .emma-public-msg-body {
  background: #f7f8f9;
  border-radius: 12px;
  padding: 0.55rem 0.75rem;
  border-left: 2px solid #59c593;
}

.emma-public-msg-body p {
  margin: 0 0 0.35rem;
  white-space: normal;
}

.emma-public-msg-body p:last-child {
  margin-bottom: 0;
}

.emma-public-msg-body a {
  color: #59c593;
  text-decoration: underline;
}

.emma-public-typing {
  margin: 0;
  font-size: 0.85rem;
  color: #666;
}

.emma-public-reply {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: auto;
}

.emma-public-reply-row {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.emma-public-input {
  width: 100%;
  box-sizing: border-box;
  border-radius: 12px;
  border: 1px solid #d1d5db;
  padding: 0.55rem 0.75rem;
  resize: vertical;
  min-height: 56px;
  font: inherit;
  color: #333;
  background: #fff;
}

.emma-public-input:focus {
  outline: 2px solid rgba(89, 197, 147, 0.35);
  border-color: #59c593;
}

.emma-public-send {
  align-self: flex-end;
  border: none;
  border-radius: 12px;
  padding: 0.5rem 1rem;
  background: linear-gradient(135deg, #59c593 0%, #2a9d8f 100%);
  color: #fff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.emma-public-send:hover:not(:disabled) {
  filter: brightness(1.05);
}

.emma-public-send:disabled,
.emma-public-input:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.emma-public-disclaimer {
  margin: 0;
  font-size: 0.72rem;
  line-height: 1.3;
  color: #888;
  text-align: center;
}

.emma-public-error {
  margin: 0 0 0.75rem;
  padding: 0.55rem 0.75rem;
  border-radius: 12px;
  background: #fff2f0;
  border: 1px solid #ffccc7;
  color: #a8071a;
  font-size: 0.85rem;
}

@media (max-width: 480px) {
  .emma-public-fab {
    right: 0.75rem;
    bottom: 0.75rem;
  }

  .emma-public-overlay {
    padding: 0.75rem;
  }

  .emma-public-panel {
    width: 100%;
    max-height: min(70vh, 580px);
  }
}
