/* ── Chat Widget Container ─────────────────────────────────────── */

.noschat-root {
  --noschat-primary: #0a6eb4;
  --noschat-primary-hover: #064a7a;
  --noschat-bg: #ffffff;
  --noschat-text: #1f2937;
  --noschat-muted: #6b7280;
  --noschat-border: #e5e7eb;
  --noschat-system: #f3f4f6;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  z-index: 999999;
}

/* ── Floating Bubble ──────────────────────────────────────────── */

.noschat-bubble {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--noschat-primary);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transition: transform 0.2s, box-shadow 0.2s;
  z-index: 999999;
}

.noschat-bubble:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.noschat-bubble svg {
  width: 28px;
  height: 28px;
  fill: currentColor;
}

/* ── Chat Panel ───────────────────────────────────────────────── */

.noschat-panel {
  position: fixed;
  bottom: 96px;
  right: 24px;
  width: 380px;
  max-height: 520px;
  background: var(--noschat-bg);
  border-radius: 16px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 999999;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
}

.noschat-panel.open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* ── Header ───────────────────────────────────────────────────── */

.noschat-header {
  background: var(--noschat-primary);
  color: #fff;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.noschat-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: #ffffff;
}

.noschat-header-status {
  font-size: 12px;
  opacity: 0.85;
}

.noschat-close {
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  padding: 4px;
  opacity: 0.8;
}

.noschat-close:hover { opacity: 1; }

/* ── Pre-chat Form (name entry) ───────────────────────────────── */

.noschat-prechat {
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.noschat-prechat p {
  margin: 0;
  color: var(--noschat-muted);
  font-size: 13px;
}

.noschat-prechat input {
  padding: 10px 12px;
  border: 1px solid var(--noschat-border);
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
  width: 100%;
  box-sizing: border-box;
}

.noschat-prechat input:focus {
  border-color: var(--noschat-primary);
}

.noschat-prechat button {
  padding: 10px 16px;
  background: var(--noschat-primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
}

.noschat-prechat button:hover {
  background: var(--noschat-primary-hover);
}

.noschat-prechat button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.noschat-call-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 12px;
  color: var(--noschat-primary);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: color 0.2s;
}
.noschat-call-link:hover {
  color: var(--noschat-primary-hover);
  text-decoration: underline;
}
.noschat-call-link svg {
  flex-shrink: 0;
}

/* ── Waiting state (knock) ─────────────────────────────────────── */

.noschat-waiting {
  padding: 32px 20px;
  text-align: center;
  color: var(--noschat-muted);
}

.noschat-waiting .spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--noschat-border);
  border-top-color: var(--noschat-primary);
  border-radius: 50%;
  animation: noschat-spin 0.8s linear infinite;
  margin: 0 auto 12px;
}

@keyframes noschat-spin {
  to { transform: rotate(360deg); }
}

/* ── Messages ─────────────────────────────────────────────────── */

.noschat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 200px;
  max-height: 320px;
}

.noschat-msg {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 14px;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.noschat-msg.visitor {
  align-self: flex-end;
  background: var(--noschat-primary);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.noschat-msg.operator,
.noschat-msg.ai {
  align-self: flex-start;
  background: var(--noschat-system);
  color: var(--noschat-text);
  border-bottom-left-radius: 4px;
}

.noschat-msg.system {
  align-self: center;
  background: transparent;
  color: var(--noschat-muted);
  font-size: 12px;
  font-style: italic;
  text-align: center;
}

.noschat-msg-meta {
  font-size: 11px;
  margin-top: 4px;
  opacity: 0.7;
}

/* ── Attachment ───────────────────────────────────────────────── */

.noschat-attachment {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: rgba(0, 0, 0, 0.05);
  border-radius: 8px;
  margin-top: 6px;
  font-size: 13px;
  text-decoration: none;
  color: inherit;
}

.noschat-attachment:hover {
  background: rgba(0, 0, 0, 0.08);
}

.noschat-attachment-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

/* ── Input ────────────────────────────────────────────────────── */

.noschat-input-area {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--noschat-border);
  flex-shrink: 0;
}

.noschat-input-area input[type="text"] {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid var(--noschat-border);
  border-radius: 20px;
  font-size: 14px;
  outline: none;
  min-width: 0;
}

.noschat-input-area input[type="text"]:focus {
  border-color: var(--noschat-primary);
}

.noschat-send-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--noschat-primary);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.noschat-send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.noschat-file-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: transparent;
  color: var(--noschat-muted);
  border: 1px solid var(--noschat-border);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 0;
}

.noschat-file-btn svg {
  width: 22px;
  height: 22px;
}

.noschat-file-btn:hover {
  color: var(--noschat-primary);
  border-color: var(--noschat-primary);
  background: rgba(10, 110, 180, 0.05);
}

/* ── Leave Message Form (after decline) ──────────────────────── */

.noschat-leave-msg {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.noschat-leave-msg p {
  margin: 0;
  color: var(--noschat-muted);
  font-size: 13px;
}

.noschat-leave-msg input,
.noschat-leave-msg textarea {
  padding: 10px 12px;
  border: 1px solid var(--noschat-border);
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  font-family: inherit;
  width: 100%;
  box-sizing: border-box;
}

.noschat-leave-msg input:focus,
.noschat-leave-msg textarea:focus {
  border-color: var(--noschat-primary);
}

.noschat-leave-msg textarea {
  min-height: 80px;
  resize: vertical;
}

.noschat-leave-msg button {
  padding: 10px 16px;
  background: var(--noschat-primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
}

.noschat-leave-msg button:hover {
  background: var(--noschat-primary-hover);
}

/* ── Responsive ───────────────────────────────────────────────── */

@media (max-width: 440px) {
  .noschat-panel {
    width: calc(100vw - 32px);
    bottom: 80px;
    right: 16px !important;
    left: 16px !important;
    max-height: 70vh;
  }

  .noschat-bubble {
    bottom: 16px;
    right: 16px;
  }
}
