.seodach-chat {
  --sc-primary: #6e24fb;
  --sc-secondary: #5200ee;
  --sc-accent: #ff6948;
  --sc-bg: #071332;
  --sc-bg-deep: #040d25;
  --sc-bg-card: #1f1e40;
  --sc-text: #e2e8f0;
  --sc-muted: #94a3b8;
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 999999;
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

.seodach-chat * { box-sizing: border-box; }

.seodach-chat__fab {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: linear-gradient(135deg, var(--sc-primary) 0%, var(--sc-secondary) 100%);
  box-shadow: 0 4px 20px color-mix(in srgb, var(--sc-primary) 40%, transparent);
  transition: transform 0.3s, box-shadow 0.3s;
  position: relative;
}

.seodach-chat__fab:hover { transform: scale(1.08); }
.seodach-chat__fab--open {
  background: var(--sc-bg-card);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}
.seodach-chat__fab--pulse {
  animation: scFabPulse 2s ease-in-out infinite;
}

@keyframes scFabPulse {
  0%, 100% { box-shadow: 0 4px 20px color-mix(in srgb, var(--sc-primary) 40%, transparent); }
  50% { box-shadow: 0 4px 30px color-mix(in srgb, var(--sc-primary) 70%, transparent), 0 0 0 8px color-mix(in srgb, var(--sc-primary) 15%, transparent); }
}

.seodach-chat__badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 22px;
  height: 22px;
  padding: 0 5px;
  border-radius: 11px;
  background: var(--sc-accent);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #fff;
}

.seodach-chat__tooltip {
  position: absolute;
  bottom: 72px;
  right: 0;
  background: var(--sc-bg);
  color: var(--sc-text);
  padding: 12px 36px 12px 16px;
  border-radius: 14px;
  font-size: 14px;
  max-width: 280px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.4);
  cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.seodach-chat__tooltip-close {
  position: absolute;
  top: 8px;
  right: 8px;
  background: none;
  border: none;
  color: #64748b;
  cursor: pointer;
  padding: 2px;
  line-height: 1;
}

.seodach-chat__tooltip-arrow {
  position: absolute;
  bottom: -7px;
  right: 24px;
  width: 14px;
  height: 14px;
  background: var(--sc-bg);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-top: none;
  border-left: none;
  transform: rotate(45deg);
}

.seodach-chat__panel {
  position: absolute;
  bottom: 72px;
  right: 0;
  width: 380px;
  max-height: 560px;
  background: var(--sc-bg-deep);
  border-radius: 20px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  animation: scSlideUp 0.3s ease;
}

@keyframes scSlideUp {
  from { opacity: 0; transform: translateY(16px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.seodach-chat__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: linear-gradient(135deg, var(--sc-bg-card) 0%, var(--sc-bg-deep) 100%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.seodach-chat__header-info { display: flex; align-items: center; gap: 12px; }

.seodach-chat__avatar {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--sc-primary), var(--sc-secondary));
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #fff;
  overflow: hidden;
}

.seodach-chat__avatar img { width: 100%; height: 100%; object-fit: cover; }

.seodach-chat__status {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #22c55e;
  border: 2px solid var(--sc-bg-deep);
}

.seodach-chat__title { color: #fff; font-size: 15px; font-weight: 600; }
.seodach-chat__subtitle { color: var(--sc-muted); font-size: 12px; }

.seodach-chat__header-close {
  background: none;
  border: none;
  color: var(--sc-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 8px;
}

.seodach-chat__header-close:hover { color: #fff; background: rgba(255, 255, 255, 0.08); }

.seodach-chat__messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 16px 8px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 300px;
  max-height: 360px;
}

.seodach-chat__msg { display: flex; }
.seodach-chat__msg--user { justify-content: flex-end; }
.seodach-chat__msg--assistant { justify-content: flex-start; }

.seodach-chat__bubble {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 14px;
  word-wrap: break-word;
  white-space: pre-wrap;
}

.seodach-chat__bubble--user {
  background: linear-gradient(135deg, var(--sc-primary) 0%, var(--sc-secondary) 100%);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.seodach-chat__bubble--assistant {
  background: var(--sc-bg-card);
  color: var(--sc-text);
  border-bottom-left-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.seodach-chat__cursor {
  display: inline-block;
  width: 2px;
  height: 16px;
  background: var(--sc-primary);
  margin-left: 2px;
  vertical-align: text-bottom;
  animation: scBlink 0.8s step-end infinite;
}

@keyframes scBlink { 50% { opacity: 0; } }

.seodach-chat__typing {
  display: flex;
  gap: 4px;
  padding: 14px 16px;
}

.seodach-chat__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--sc-muted);
  animation: scDot 1.4s infinite ease-in-out both;
}
.seodach-chat__dot:nth-child(1) { animation-delay: -0.32s; }
.seodach-chat__dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes scDot {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

.seodach-chat__offline {
  text-align: center;
  padding: 6px;
  font-size: 12px;
  color: var(--sc-muted);
  background: rgba(0, 0, 0, 0.2);
}

.seodach-chat__input {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 12px 16px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.seodach-chat__field {
  flex: 1;
  resize: none;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 10px 14px;
  background: var(--sc-bg);
  color: var(--sc-text);
  font: inherit;
  max-height: 100px;
  outline: none;
}

.seodach-chat__field:focus { border-color: var(--sc-primary); }
.seodach-chat__field:disabled { opacity: 0.5; }

.seodach-chat__send {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: linear-gradient(135deg, var(--sc-primary), var(--sc-secondary));
  flex-shrink: 0;
}

.seodach-chat__send:disabled { opacity: 0.4; cursor: not-allowed; }

@media (max-width: 480px) {
  .seodach-chat { bottom: 0; right: 0; left: 0; }
  .seodach-chat__fab { position: fixed; bottom: 20px; right: 20px; }
  .seodach-chat__panel {
    position: fixed;
    bottom: 0; right: 0; left: 0;
    width: 100%;
    max-height: 100dvh;
    border-radius: 0;
  }
}
