#chat-widget-root {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  font-family: "Inter", "Segoe UI", Tahoma, sans-serif;
}

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

.chat-widget-hidden {
  display: none !important;
}

.chat-widget-bubble {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4a5cff, #8249ff);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  cursor: pointer;
  position: relative;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.chat-widget-bubble:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.25);
}

.chat-widget-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 20px;
  height: 20px;
  border-radius: 10px;
  background: #ff4d4f;
  color: #fff;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
}

.chat-widget-panel {
  position: absolute;
  bottom: 70px;
  right: 0;
  width: 340px;
  max-height: 520px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 18px 46px rgba(22, 26, 68, 0.2);
  display: flex;
  flex-direction: column;
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  overflow: hidden;
}

.chat-widget-panel.open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: all;
}

.chat-widget-header {
  background: linear-gradient(135deg, #4a5cff, #8249ff);
  color: #fff;
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chat-widget-header h3 {
  margin: 0;
  font-size: 16px;
}

.chat-widget-close {
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
}

.chat-widget-body {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: #f6f7fb;
}

.chat-widget-messages {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chat-widget-message {
  max-width: 80%;
  padding: 12px 14px;
  border-radius: 14px;
  background: #fff;
  color: #1a1a1a;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  position: relative;
  word-break: break-word;
}

.chat-widget-message.user {
  align-self: flex-end;
  background: #4a5cff;
  color: #fff;
}

.chat-widget-message.admin {
  align-self: flex-start;
}

.chat-widget-timestamp {
  display: block;
  margin-top: 8px;
  font-size: 11px;
  opacity: 0.75;
}

.chat-widget-input-area {
  padding: 12px 16px 16px;
  background: #fff;
  border-top: 1px solid rgba(76, 84, 117, 0.12);
  display: flex;
  gap: 8px;
}

.chat-widget-input-area textarea {
  flex: 1;
  resize: none;
  border: 1px solid rgba(76, 84, 117, 0.2);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  min-height: 46px;
  max-height: 120px;
}

.chat-widget-input-area button {
  background: linear-gradient(135deg, #4a5cff, #8249ff);
  border: none;
  color: #fff;
  padding: 0 18px;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 600;
  transition: opacity 0.2s ease;
}

.chat-widget-input-area button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.chat-widget-name-form {
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chat-widget-name-form input {
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid rgba(76, 84, 117, 0.2);
  font-size: 14px;
}

.chat-widget-name-form button {
  background: linear-gradient(135deg, #4a5cff, #8249ff);
  border: none;
  color: #fff;
  padding: 12px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

.chat-widget-status {
  padding: 8px 16px;
  font-size: 13px;
  color: #5b5f7b;
}

.chat-widget-typing {
  font-size: 12px;
  color: #5b5f7b;
  padding: 0 16px 8px;
}

@media (max-width: 480px) {
  #chat-widget-root {
    right: 12px;
    left: 12px;
  }

  .chat-widget-panel {
    right: 0;
    width: calc(100vw - 24px);
    max-height: 70vh;
  }
}
