#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, #7c3aed, #6366f1);
  color: #e9e9ff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 30px rgba(99, 102, 241, 0.35);
  cursor: pointer;
  position: relative;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.chat-widget-bubble:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 32px rgba(99, 102, 241, 0.45);
}

.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;
  height: 520px;
  max-height: calc(100vh - 120px);
  background: #0f111a;
  border-radius: 16px;
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.03);
  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, #141725, #0f111a);
  color: #f5f7ff;
  padding: 18px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.chat-widget-title h3 {
  margin: 2px 0 0;
  font-size: 17px;
  letter-spacing: 0.01em;
}

.chat-widget-title .eyebrow {
  margin: 0;
  font-size: 12px;
  text-transform: uppercase;
  color: #9ca3af;
  letter-spacing: 0.1em;
}

.chat-widget-title .subtitle {
  margin: 2px 0 0;
  font-size: 13px;
  color: #c7d2fe;
}

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

.chat-widget-body {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: linear-gradient(180deg, #0f111a 0%, #0b0d14 100%);
  min-height: 0;
}

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

.chat-widget-message {
  max-width: 80%;
  padding: 12px 14px;
  border-radius: 14px;
  background: #141826;
  color: #e5e7eb;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
  position: relative;
  word-break: break-word;
}

.chat-widget-message.user {
  align-self: flex-end;
  background: linear-gradient(135deg, #6366f1, #7c3aed);
  color: #fdfdff;
}

.chat-widget-message.admin {
  align-self: flex-start;
  border: 1px solid rgba(255, 255, 255, 0.04);
}

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

.chat-widget-input-area {
  padding: 14px 16px 16px;
  background: #0f111a;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
  display: flex;
  gap: 8px;
}

.chat-widget-input-area textarea {
  flex: 1;
  resize: none;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: #0b0d14;
  color: #e5e7eb;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  min-height: 46px;
  max-height: 120px;
}

.chat-widget-input-area button {
  background: linear-gradient(135deg, #7c3aed, #6366f1);
  border: none;
  color: #fdfdff;
  padding: 0 18px;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 700;
  letter-spacing: 0.01em;
  transition: opacity 0.2s ease, transform 0.1s ease;
}

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

.chat-widget-name-form {
  padding: 22px 20px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.chat-widget-form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.chat-widget-name-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: #e5e7eb;
  font-size: 13px;
}

.chat-widget-name-form input {
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: #0b0d14;
  color: #f3f4f6;
  font-size: 14px;
}

.chat-widget-name-form button {
  background: linear-gradient(135deg, #7c3aed, #6366f1);
  border: none;
  color: #fdfdff;
  padding: 12px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;
  box-shadow: 0 12px 28px rgba(99, 102, 241, 0.22);
}

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

.chat-widget-typing {
  font-size: 12px;
  color: #cbd5f5;
  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;
  }
}

@media (min-width: 481px) {
  .chat-widget-form-grid {
    grid-template-columns: 1fr 1fr;
  }
}
