.eaw-widget-root {
  --eaw-primary: #0B5ED7;
  --eaw-primary-dark: #203566;
  --eaw-navy: #1F315F;
  --eaw-cyan: #00C7B7;
  --eaw-bg: #FFFFFF;
  --eaw-soft-bg: #F4F7FB;
  --eaw-text: #1F2937;
  --eaw-muted: #6B7280;
  --eaw-border: #E5E7EB;
  --eaw-shadow: 0 16px 44px rgba(19, 33, 69, 0.24);

  position: fixed;
  bottom: 20px;
  z-index: 999999;
  font-family: "Segoe UI", "Noto Sans", "DejaVu Sans", "Arial", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  color: var(--eaw-text);
}

.eaw-widget-root.eaw-bottom-right {
  right: 20px;
  left: auto;
}

.eaw-widget-root.eaw-bottom-left {
  left: 20px;
  right: auto;
}

.eaw-widget-root .eaw-toggle,
.eaw-widget-root .eaw-panel,
.eaw-widget-root .eaw-panel * {
  box-sizing: border-box;
}

.eaw-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border: 0;
  border-radius: 999px;
  background: var(--eaw-primary);
  color: #fff;
  cursor: pointer;
  padding: 12px 18px;
  font-size: 14px;
  line-height: 1;
  font-weight: 600;
  box-shadow: 0 10px 24px rgba(11, 94, 215, 0.34);
  transition: transform 0.18s ease, background-color 0.18s ease, box-shadow 0.18s ease;
}

.eaw-toggle:hover {
  background: #0A52BD;
  box-shadow: 0 12px 28px rgba(10, 82, 189, 0.4);
  transform: translateY(-1px);
}

.eaw-toggle:focus-visible,
.eaw-close:focus-visible,
.eaw-send:focus-visible,
.eaw-chip:focus-visible,
.eaw-lang-btn:focus-visible,
.eaw-input:focus-visible {
  outline: 2px solid var(--eaw-cyan);
  outline-offset: 2px;
}

.eaw-toggle-icon {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.4px;
}

.eaw-toggle-label {
  white-space: nowrap;
}

.eaw-panel {
  width: 380px;
  height: 560px;
  display: none;
  flex-direction: column;
  border: 1px solid var(--eaw-border);
  background: var(--eaw-bg);
  border-radius: 16px;
  box-shadow: var(--eaw-shadow);
  overflow: hidden;
}

.eaw-open .eaw-panel {
  display: flex;
  animation: eaw-fade-up 0.2s ease;
}

.eaw-open .eaw-toggle {
  display: none;
}

.eaw-cyan-line {
  height: 3px;
  width: 100%;
  background: linear-gradient(90deg, var(--eaw-cyan), #50d8cc);
}

.eaw-header {
  background: var(--eaw-navy);
  color: #fff;
  padding: 12px 14px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.eaw-header-main {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: start;
}

.eaw-accent-dot {
  margin-top: 5px;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  background: var(--eaw-cyan);
}

.eaw-title-wrap {
  min-width: 0;
}

.eaw-title {
  margin: 0;
  font-size: 16px;
  line-height: 1.25;
  font-weight: 700;
}

.eaw-subtitle {
  margin: 4px 0 6px;
  font-size: 12px;
  line-height: 1.3;
  color: rgba(255, 255, 255, 0.86);
}

.eaw-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.94);
}

.eaw-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22C55E;
}

.eaw-close {
  border: 0;
  background: transparent;
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 24px;
  line-height: 1;
}

.eaw-close:hover {
  background: rgba(255, 255, 255, 0.12);
}

.eaw-lang-switcher {
  margin-top: 10px;
  display: inline-flex;
  gap: 6px;
}

.eaw-lang-btn {
  border: 1px solid rgba(255, 255, 255, 0.32);
  background: transparent;
  color: #fff;
  font-size: 12px;
  line-height: 1;
  font-weight: 700;
  border-radius: 999px;
  padding: 6px 10px;
  cursor: pointer;
}

.eaw-lang-btn.eaw-active {
  background: #fff;
  color: var(--eaw-navy);
  border-color: #fff;
}

.eaw-messages {
  flex: 1;
  overflow-y: auto;
  background: var(--eaw-bg);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.eaw-message {
  display: flex;
}

.eaw-message-bot {
  justify-content: flex-start;
}

.eaw-message-user {
  justify-content: flex-end;
}

.eaw-bubble {
  max-width: 86%;
  border-radius: 14px;
  padding: 10px 12px;
  font-size: 14px;
  line-height: 1.45;
  word-break: break-word;
  white-space: pre-wrap;
}

.eaw-message-bot .eaw-bubble {
  background: var(--eaw-soft-bg);
  border: 1px solid var(--eaw-border);
  color: var(--eaw-text);
}

.eaw-message-user .eaw-bubble {
  background: var(--eaw-primary);
  color: #fff;
  border: 1px solid var(--eaw-primary);
}

.eaw-quick-replies {
  padding: 8px 14px 10px;
  border-top: 1px solid var(--eaw-border);
  background: #fff;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.eaw-chip {
  border: 1px solid var(--eaw-primary);
  background: #fff;
  color: var(--eaw-primary);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 13px;
  line-height: 1.2;
  cursor: pointer;
  transition: background-color 0.18s ease, color 0.18s ease;
}

.eaw-chip:hover {
  background: #EEF4FF;
}

.eaw-footer {
  background: #fff;
  border-top: 1px solid var(--eaw-border);
  padding: 10px 12px 12px;
}

.eaw-form {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--eaw-border);
  border-radius: 12px;
  padding: 6px;
  background: #fff;
}

.eaw-input {
  width: 100%;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--eaw-text);
  font-size: 14px;
  padding: 8px 8px;
}

.eaw-input::placeholder {
  color: var(--eaw-muted);
}

.eaw-input:disabled {
  opacity: 0.6;
}

.eaw-send {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 0;
  background: var(--eaw-primary);
  color: #fff;
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.eaw-send:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.eaw-typing {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.eaw-dots {
  display: inline-flex;
  gap: 4px;
}

.eaw-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--eaw-muted);
  animation: eaw-dot-pulse 1.2s infinite ease-in-out;
}

.eaw-dot:nth-child(2) {
  animation-delay: 0.2s;
}

.eaw-dot:nth-child(3) {
  animation-delay: 0.4s;
}

.eaw-typing-text {
  color: var(--eaw-muted);
  font-size: 13px;
}

@keyframes eaw-dot-pulse {
  0%,
  80%,
  100% {
    transform: scale(0.75);
    opacity: 0.4;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes eaw-fade-up {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 768px) {
  .eaw-widget-root {
    bottom: 12px;
  }

  .eaw-widget-root.eaw-bottom-right {
    right: 12px;
    left: auto;
  }

  .eaw-widget-root.eaw-bottom-left {
    left: 12px;
    right: auto;
  }

  .eaw-panel {
    width: calc(100vw - 24px);
    height: calc(100vh - 24px);
    max-height: calc(100vh - 24px);
  }

  .eaw-toggle {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    padding: 0;
    justify-content: center;
  }

  .eaw-toggle-label {
    display: none;
  }
}

body.admin-bar .eaw-widget-root {
  bottom: 20px;
}
