.owsi-chat-widget {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.owsi-chat-toggle {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border: none;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.owsi-chat-toggle:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.owsi-chat-container {
  display: flex;
  flex-direction: column;
  width: 380px;
  height: 600px;
  max-height: 80vh;
  background: white;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
  overflow: hidden;
}

.owsi-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.owsi-chat-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

.owsi-chat-close {
  background: none;
  border: none;
  color: white;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: background 0.2s ease;
}

.owsi-chat-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

.owsi-chat-log {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #f8f9fa;
}

.owsi-msg {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 85%;
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.owsi-msg.owsi-user {
  align-self: flex-end;
}

.owsi-msg.owsi-bot {
  align-self: flex-start;
}

.owsi-msg-text {
  padding: 12px 16px;
  border-radius: 18px;
  line-height: 1.5;
  font-size: 14px;
  word-wrap: break-word;
}

.owsi-user .owsi-msg-text {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-bottom-right-radius: 4px;
}

.owsi-bot .owsi-msg-text {
  background: white;
  color: #333;
  border-bottom-left-radius: 4px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

.owsi-thinking {
  display: flex;
  gap: 4px;
  padding: 12px 20px !important;
}

.owsi-thinking span {
  width: 8px;
  height: 8px;
  background: #667eea;
  border-radius: 50%;
  animation: bounce 1.4s infinite ease-in-out both;
}

.owsi-thinking span:nth-child(1) {
  animation-delay: -0.32s;
}

.owsi-thinking span:nth-child(2) {
  animation-delay: -0.16s;
}

@keyframes bounce {
  0%, 80%, 100% {
    transform: scale(0);
  }
  40% {
    transform: scale(1);
  }
}

.owsi-sources {
  background: white;
  padding: 12px 16px;
  border-radius: 18px;
  border-bottom-left-radius: 4px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
  font-size: 13px;
}

.owsi-sources strong {
  display: block;
  margin-bottom: 8px;
  color: #667eea;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.owsi-sources ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.owsi-sources li {
  margin: 0;
}

.owsi-sources a {
  color: #667eea;
  text-decoration: none;
  transition: color 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.owsi-sources a:hover {
  color: #764ba2;
  text-decoration: underline;
}

.owsi-sources a::before {
  content: "→";
  font-weight: bold;
}

.owsi-error .owsi-msg-text {
  background: #fee;
  color: #c33;
}

.owsi-chat-form {
  display: flex;
  gap: 8px;
  padding: 16px;
  background: white;
  border-top: 1px solid #e9ecef;
}

.owsi-chat-form input {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid #dee2e6;
  border-radius: 24px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s ease;
}

.owsi-chat-form input:focus {
  border-color: #667eea;
}

.owsi-chat-form button {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border: none;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease;
}

.owsi-chat-form button:hover {
  transform: scale(1.05);
}

@media (max-width: 768px) {
  .owsi-chat-container {
    width: calc(100vw - 40px);
    height: calc(100vh - 100px);
    max-height: calc(100vh - 100px);
  }
}
