/* SVOI — Chat Widget v1 styles */

.sv-chat {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 10000;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.sv-chat__toggle {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  background: #2563eb;
  color: #fff;
  font-size: 24px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  transition: transform 0.2s;
}
.sv-chat__toggle:hover {
  transform: scale(1.08);
}

.sv-chat__window {
  display: none;
  position: absolute;
  bottom: 68px;
  right: 0;
  width: 360px;
  height: 520px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.12);
  flex-direction: column;
  overflow: hidden;
}
.sv-chat__window--open {
  display: flex;
}
.sv-chat__window--minimized {
  display: none;
}

.sv-chat__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: #2563eb;
  color: #fff;
  font-weight: 600;
  font-size: 15px;
}
.sv-chat__close {
  background: none;
  border: none;
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}

.sv-chat__messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sv-chat__message {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.45;
  word-wrap: break-word;
  white-space: pre-wrap;
}
.sv-chat__message--user {
  align-self: flex-end;
  background: #2563eb;
  color: #fff;
  border-bottom-right-radius: 4px;
}
.sv-chat__message--agent {
  align-self: flex-start;
  background: #f1f5f9;
  color: #1e293b;
  border-bottom-left-radius: 4px;
}
.sv-chat__message-author {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.7rem;
  font-weight: 500;
  color: #64748b;
  margin-bottom: 3px;
  padding: 0 2px;
  line-height: 1;
}
.sv-chat__message-author-avatar {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.sv-chat__message-bubble {
  /* bubble content inside message — inherits parent layout */
}
.sv-chat__message--stub {
  align-self: flex-start;
  background: #fef3c7;
  color: #92400e;
  font-style: italic;
  border-bottom-left-radius: 4px;
}

.sv-chat__input-area {
  display: flex;
  padding: 10px 12px;
  gap: 8px;
  border-top: 1px solid #e2e8f0;
}
.sv-chat__input {
  flex: 1;
  resize: none;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
}
.sv-chat__input:focus {
  border-color: #2563eb;
}
.sv-chat__send {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: #2563eb;
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  flex-shrink: 0;
}
.sv-chat__send:disabled {
  background: #94a3b8;
  cursor: default;
}

/* Credentials panel */
.sv-credentials-panel {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 10001;
  width: 260px;
  padding: 14px 16px;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.10);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
.sv-credentials-panel__title {
  font-size: 13px;
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 8px;
}
.sv-credentials-panel__input {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: 13px;
  outline: none;
  box-sizing: border-box;
  margin-bottom: 8px;
}
.sv-credentials-panel__input:focus {
  border-color: #2563eb;
}
.sv-credentials-panel__save {
  width: 100%;
  padding: 7px;
  border: none;
  border-radius: 6px;
  background: #2563eb;
  color: #fff;
  font-size: 13px;
  cursor: pointer;
}
.sv-credentials-panel__save:disabled {
  background: #94a3b8;
  cursor: default;
}
.sv-credentials-panel__status {
  font-size: 12px;
  margin-top: 6px;
  color: #64748b;
}
.sv-credentials-panel__status--ok {
  color: #16a34a;
}
.sv-credentials-panel__status--err {
  color: #dc2626;
}

/* Mic button */
.sv-chat__mic {
  width: 40px;
  height: 40px;
  border: 2px solid #e2e8f0;
  border-radius: 50%;
  background: #fff;
  font-size: 18px;
  cursor: pointer;
  flex-shrink: 0;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}
.sv-chat__mic--armed {
  border-color: #2563eb;
  background: #eff6ff;
  animation: sv-mic-pulse 1.5s infinite;
}
.sv-chat__mic--active {
  border-color: #dc2626;
  background: #fef2f2;
}
@keyframes sv-mic-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(37,99,235,0.4); }
  50% { box-shadow: 0 0 0 8px rgba(37,99,235,0); }
}

/* Voice status */
.sv-chat__voice-status {
  padding: 4px 12px 8px;
  font-size: 12px;
  color: #64748b;
  text-align: center;
  min-height: 20px;
}
.sv-chat__voice-status--recording { color: #dc2626; }
.sv-chat__voice-status--processing { color: #d97706; }
.sv-chat__voice-status--ok { color: #16a34a; }
.sv-chat__voice-status--err { color: #dc2626; }
.sv-chat__voice-status--armed { color: #2563eb; }
