/* ========================================
   CHATBOT WIDGET STYLES
   Виджет чат-бота консультанта
   ======================================== */

/* Chat Toggle Button */
.chatbot-toggle {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  width: 80px;
  height: 80px;
  border-radius: 16px;
  background: transparent;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  /* Removed glass background as requested */
  background: transparent;
  border: none;

  /* Organic shadow for the icon shape */
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.25));

  animation: floatButton 3s ease-in-out infinite;
}

@keyframes floatButton {

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

  50% {
    transform: translateY(-8px) scale(1.05);
  }
}

.chatbot-toggle:hover {
  transform: scale(1.05) translateY(-4px);
  animation-play-state: paused;
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.3)) brightness(1.1);
}

.chatbot-toggle:active {
  transform: scale(0.97);
}

.chatbot-toggle.hidden {
  opacity: 0;
  visibility: hidden;
  transform: scale(0.8);
  pointer-events: none;
}

.chatbot-toggle-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.chatbot-toggle-icon {
  width: 36px;
  height: 36px;
  fill: #071032;
}

/* Chat Window */
.chatbot-window {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9998;
  width: 400px;
  max-width: calc(100vw - 32px);
  height: 600px;
  max-height: calc(100vh - 120px);
  background: #fff;
  border-radius: 20px;
  box-shadow:
    0 8px 40px rgba(0, 0, 0, 0.15),
    0 20px 60px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px) scale(0.95);
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.chatbot-window.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

/* Chat Header - Title left, Logo right */
.chatbot-header {
  background: #091E6B;
  padding: 20px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 80px;
}

.chatbot-header-content {
  flex: 1;
}

.chatbot-header-title {
  font-size: 18px;
  font-weight: 600;
  color: #fff;
  margin: 0 0 4px 0;
  line-height: 1.3;
}

.chatbot-header-subtitle {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.6);
  margin: 0;
}

.chatbot-header-logo {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chatbot-header-logo img {
  height: 48px;
  width: auto;
  object-fit: contain;
}

.chatbot-close {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: transparent;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
  flex-shrink: 0;
  margin-left: 8px;
}

.chatbot-close:hover {
  background: rgba(255, 255, 255, 0.15);
}

.chatbot-close svg {
  width: 18px;
  height: 18px;
  fill: rgba(255, 255, 255, 0.8);
}

/* Chat Messages Area */
.chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.chatbot-messages::-webkit-scrollbar {
  width: 5px;
}

.chatbot-messages::-webkit-scrollbar-track {
  background: transparent;
}

.chatbot-messages::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.12);
  border-radius: 3px;
}

.chatbot-messages::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.2);
}

/* Message Bubbles */
.chatbot-message {
  display: flex;
  gap: 10px;
  max-width: 90%;
  animation: messageSlideIn 0.3s ease-out;
}

.chatbot-message.bot {
  align-self: flex-start;
  flex-direction: row;
}

.chatbot-message.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.chatbot-message-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: 100%;
}

.chatbot-message-bubble {
  padding: 12px 16px;
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.5;
  word-wrap: break-word;
}

.chatbot-message.bot .chatbot-message-bubble {
  background: #f0f0f0;
  color: #1a1a2e;
  border-bottom-left-radius: 6px;
}

.chatbot-message.user .chatbot-message-bubble {
  background: #091E6B;
  color: #fff;
  border-bottom-right-radius: 6px;
}

.chatbot-message.user .chatbot-message-bubble.chatbot-message-quick {
  background: #091E6B;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.chatbot-message-time {
  font-size: 11px;
  color: #999;
  padding: 0 4px;
}

.chatbot-message.user .chatbot-message-time {
  text-align: right;
}

/* Bot Avatar */
.chatbot-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #091E6B;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  padding: 0;
}

.chatbot-avatar svg {
  width: 16px;
  height: 16px;
  fill: #071032;
}

.chatbot-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 50%;
}

/* Quick Actions - Fixed above input */
.chatbot-quick-actions-container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 20px;
  background: #fff;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  justify-content: center;
}

.chatbot-quick-action {
  padding: 10px 20px;
  background: #091E6B;
  border: none;
  border-radius: 24px;
  font-size: 13px;
  font-weight: 500;
  color: #fff;
  cursor: pointer;
  transition: all 0.2s ease;
}

.chatbot-quick-action:hover {
  background: #0b2580;
  transform: translateY(-1px);
}

.chatbot-quick-action:active {
  transform: translateY(0);
}

/* Chat Input Area */
.chatbot-input-area {
  padding: 16px 20px;
  background: #fff;
  display: flex;
  align-items: center;
  gap: 12px;
}

.chatbot-input-wrapper {
  flex: 1;
  display: flex;
  align-items: center;
}

.chatbot-input {
  width: 100%;
  height: 44px;
  padding: 0 16px;
  border: 1px solid #e0e0e0;
  border-radius: 22px;
  font-size: 14px;
  line-height: 44px;
  resize: none;
  outline: none;
  font-family: inherit;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  background: #f8f8f8;
  box-sizing: border-box;
}

.chatbot-input::placeholder {
  color: #999;
}

.chatbot-input:focus {
  border-color: #071032;
  box-shadow: 0 0 0 3px rgba(7, 16, 50, 0.08);
  background: #fff;
}

.chatbot-send {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(145deg, #F7C948 0%, #E6B84A 100%);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(247, 201, 72, 0.3);
  color: #071032;
}

.chatbot-send:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(247, 201, 72, 0.4);
}

.chatbot-send:active {
  transform: scale(0.95);
}

.chatbot-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.chatbot-send svg {
  width: 20px;
  height: 20px;
}



/* Typing Indicator */
.chatbot-typing {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 12px 16px;
  background: #f0f0f0;
  border-radius: 18px;
  border-bottom-left-radius: 6px;
}

.chatbot-typing-dot {
  width: 8px;
  height: 8px;
  background: #bbb;
  border-radius: 50%;
  animation: typingDot 1.4s infinite ease-in-out;
}

.chatbot-typing-dot:nth-child(1) {
  animation-delay: 0s;
}

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

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

@keyframes typingDot {

  0%,
  60%,
  100% {
    transform: translateY(0);
    background: #bbb;
  }

  30% {
    transform: translateY(-5px);
    background: #071032;
  }
}

/* Animation for new messages */
@keyframes messageSlideIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

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

/* Mobile Responsiveness */
@media (max-width: 480px) {
  .chatbot-toggle {
    bottom: 16px;
    right: 16px;
    width: 64px;
    height: 64px;
    border-radius: 14px;
  }

  .chatbot-window {
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
    max-width: 100%;
    height: 100%;
    max-height: 100%;
    border-radius: 0;
  }

  .chatbot-header {
    padding: 16px 20px;
    min-height: 70px;
  }

  .chatbot-header-title {
    font-size: 16px;
  }

  .chatbot-header-logo img {
    height: 40px;
  }

  .chatbot-messages {
    padding: 16px;
  }

  .chatbot-quick-actions-container {
    padding: 10px 16px;
  }

  .chatbot-input-area {
    padding: 10px 16px;
  }

  .chatbot-emoji-row {
    padding: 6px 16px 12px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  }
}

/* Pulse animation for unread messages */
.chatbot-toggle.has-unread::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 20px;
  border: 2px solid #F7C948;
  animation: pulseRing 2s infinite;
}

@keyframes pulseRing {
  0% {
    transform: scale(1);
    opacity: 1;
  }

  100% {
    transform: scale(1.2);
    opacity: 0;
  }
}