:root {
  --primary-gradient: linear-gradient(135deg, #6C5CE7 0%, #341f97 100%);
  --bg-dark: rgba(18, 18, 18, 0.95);
  --glass-bg: rgba(255, 255, 255, 0.05);
  --glass-border: rgba(255, 255, 255, 0.1);
  --text-main: #FFFFFF;
  --text-muted: rgba(255, 255, 255, 0.6);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Inter', -apple-system, system-ui, sans-serif;
}

body {
  background: transparent;
  overflow: hidden;
}

#ow-chat {
  display: flex;
  flex-direction: column;
  height: 100vh;
  background: var(--bg-dark);
  backdrop-filter: blur(20px);
  color: var(--text-main);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  overflow: hidden;
}

#ow-header {
  padding: 16px 20px;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  position: relative;
  z-index: 2;
}

#ow-header .title {
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.02em;
}

#ow-header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

#ow-minimize {
  width: 36px;
  height: 36px;
  min-width: 36px;
  min-height: 36px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, color 0.2s ease;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  pointer-events: auto;
  position: relative;
  z-index: 3;
}

#ow-minimize:focus {
  outline: none;
}

#ow-minimize:focus-visible {
  outline: 2px solid rgba(108, 92, 231, 0.8);
  outline-offset: 2px;
}

#ow-minimize:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
}

#ow-minimize svg {
  width: 18px;
  height: 18px;
  pointer-events: none;
}

body.ow-collapsed #ow-messages,
body.ow-collapsed #ow-input {
  display: none !important;
}

body.ow-collapsed #ow-chat {
  height: auto;
  min-height: 0;
}

body.ow-collapsed #ow-header {
  border-bottom: none;
}

#ow-messages {
  flex: 1;
  padding: 16px 16px 28px;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  min-height: 0;
  scrollbar-width: thin;
  scrollbar-color: var(--glass-border) transparent;
}

#ow-messages::-webkit-scrollbar {
  width: 4px;
}

#ow-messages::-webkit-scrollbar-thumb {
  background: var(--glass-border);
  border-radius: 10px;
}

.ow-msg {
  max-width: 100%;
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.ow-msg.user {
  background: var(--primary-gradient);
  color: white;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
  box-shadow: 0 4px 15px rgba(108, 92, 231, 0.3);
}

.ow-msg.bot {
  background: var(--glass-bg);
  color: var(--text-main);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
  border: 1px solid var(--glass-border);
}

.ow-message-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 92%;
  min-width: 0;
  width: fit-content;
  align-self: flex-start;
}

.ow-message-block.user-block {
  align-self: flex-end;
  max-width: 92%;
}

.ow-message-block.user-block .ow-msg {
  align-self: flex-end;
}

.ow-message-block.bot-block .ow-msg {
  align-self: flex-start;
}

.ow-lead-hint {
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-muted);
  padding: 0 4px 2px;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.ow-msg.bot.ow-msg-sectioned {
  border-left: 3px solid #6C5CE7;
  padding-left: 14px;
}

.ow-msg.bot.ow-msg-estimate {
  border-left: 3px solid #f1c40f;
  background: rgba(241, 196, 15, 0.08);
}

.ow-chip.discovery {
  border-color: rgba(241, 196, 15, 0.45);
  background: rgba(241, 196, 15, 0.12);
  font-weight: 500;
}

.ow-chip.discovery:hover {
  background: rgba(241, 196, 15, 0.22);
  border-color: #f1c40f;
}

.ow-chip.portfolio {
  border-color: rgba(108, 92, 231, 0.35);
  background: rgba(108, 92, 231, 0.12);
}

.ow-chip.portfolio:hover {
  background: rgba(108, 92, 231, 0.25);
  border-color: #6C5CE7;
}

/* Chips / Buttons inside chat */
.ow-chip-container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
  max-width: 100%;
  animation: fadeIn 0.5s ease-out;
}

.ow-chip {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--glass-border);
  color: var(--text-main);
  padding: 8px 14px;
  border-radius: 20px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  white-space: normal;
  word-break: break-word;
  line-height: 1.35;
}

.ow-chip svg {
  width: 14px;
  height: 14px;
}

.ow-chip.lead {
  border-color: rgba(46, 204, 113, 0.45);
  background: rgba(46, 204, 113, 0.12);
  font-weight: 500;
}

.ow-chip.lead:hover {
  background: rgba(46, 204, 113, 0.22);
  border-color: #2ecc71;
}

.ow-chip.slot {
  border-color: rgba(52, 152, 219, 0.4);
  background: rgba(52, 152, 219, 0.1);
}

.ow-chip.slot:hover {
  background: rgba(52, 152, 219, 0.2);
  border-color: #3498db;
}

.ow-chip.email:hover {
  background: rgba(241, 196, 15, 0.2);
  border-color: #f1c40f;
}

.ow-chip.telegram:hover {
  background: rgba(52, 152, 219, 0.2);
  border-color: #3498db;
}

.ow-chip:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.3);
}

#ow-input {
  padding: 16px;
  background: rgba(0, 0, 0, 0.2);
  border-top: 1px solid var(--glass-border);
  display: flex;
  gap: 10px;
  align-items: center;
  flex-shrink: 0;
  position: relative;
  z-index: 2;
}

#ow-text {
  flex: 1;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  padding: 12px 16px;
  border-radius: 24px;
  color: white;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s ease;
}

#ow-text:focus {
  border-color: #6C5CE7;
}

#ow-send {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: var(--primary-gradient);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease;
}

#ow-send:hover {
  transform: scale(1.1);
}

#ow-send svg {
  width: 18px;
  height: 18px;
}

.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 12px 16px;
  background: var(--glass-bg);
  border-radius: 16px;
  width: fit-content;
}

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

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

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

@keyframes bounce {

  0%,
  80%,
  100% {
    transform: scale(0);
  }

  40% {
    transform: scale(1);
  }
}