/* Chatbot Widget - Дизайн TAKUMI - Точная копия из React проекта */

/* Обертка для виджета и подсказки */
.takumi-chatbot-widget-wrapper {
    position: fixed;
    bottom: 100px;
    right: 30px;
    z-index: 999999;
    display: flex;
    align-items: center;
    gap: 15px;
}

/* Позиционирование виджета */
.takumi-chatbot-widget-wrapper.bottom-right {
    bottom: 100px;
    right: 30px;
    left: auto;
    top: auto;
}

.takumi-chatbot-widget-wrapper.bottom-left {
    bottom: 100px;
    left: 30px;
    right: auto;
    top: auto;
}

.takumi-chatbot-widget-wrapper.top-right {
    top: 100px;
    right: 30px;
    left: auto;
    bottom: auto;
}

.takumi-chatbot-widget-wrapper.top-left {
    top: 100px;
    left: 30px;
    right: auto;
    bottom: auto;
}

/* Корректировка подсказки для разных позиций */
.takumi-chatbot-widget-wrapper.bottom-left .takumi-chatbot-tooltip,
.takumi-chatbot-widget-wrapper.top-left .takumi-chatbot-tooltip {
    right: -180px;
    left: auto;
}

.takumi-chatbot-widget-wrapper.top-right .takumi-chatbot-tooltip,
.takumi-chatbot-widget-wrapper.top-left .takumi-chatbot-tooltip {
    bottom: -65px;
    top: auto;
}

.takumi-chatbot-widget-wrapper.top-right .takumi-chatbot-tooltip .takumi-chatbot-tooltip-arrow,
.takumi-chatbot-widget-wrapper.top-left .takumi-chatbot-tooltip .takumi-chatbot-tooltip-arrow {
    top: -8px;
    bottom: auto;
    border-color: transparent transparent #333 transparent;
}

/* Стрелка тултипа */
.takumi-chatbot-tooltip-arrow {
  position: absolute;
  bottom: -10px;
  right: 50px;
  width: 0;
  height: 0;
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-top: 10px solid #ffffff;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

/* Кнопка чатбота в правом нижнем углу */
.takumi-chatbot-widget-button {
    position: fixed;
    bottom: 100px;
    right: 20px;
    width: 85px;
    height: 85px;
    background: transparent;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    z-index: 9999;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.takumi-chatbot-widget-visible {
  opacity: 1;
  transform: scale(1) translateY(0);
}

/* Внешняя пульсация кнопки (за пределами кнопки) */
.takumi-chatbot-widget-button::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: rgba(0, 123, 255, 0.3);
  transform: translate(-50%, -50%);
  animation: pulse-outer 2s infinite;
  z-index: -1;
  pointer-events: none;
}

/* Отключение внешней пульсации */
.takumi-chatbot-pulse-disabled.takumi-chatbot-widget-button::before {
  display: none;
}

@keyframes pulse-outer {
  0% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 0.6;
  }
  50% {
    transform: translate(-50%, -50%) scale(1.3);
    opacity: 0.3;
  }
  100% {
    transform: translate(-50%, -50%) scale(1.6);
    opacity: 0;
  }
}

.takumi-chatbot-button-icon {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

.takumi-chatbot-button-icon svg {
  width: 70px;
  height: 70px;
  transition: transform 0.3s ease;
}

.takumi-chatbot-widget-button:hover {
  background: none;
}

.takumi-chatbot-widget-button:hover .takumi-chatbot-button-icon svg {
  transform: scale(1.1) translateY(-2px);
}

.takumi-chatbot-widget-button:active {
  background: none;
}

.takumi-chatbot-widget-button:active .takumi-chatbot-button-icon svg {
  transform: scale(0.95);
}

/* Пульсирующий эффект - точный размер кнопки */
.takumi-chatbot-button-pulse {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: rgba(0, 123, 255, 0.5);
  transform: translate(-50%, -50%);
  animation: pulse-inner 2.5s infinite;
  z-index: 0;
  pointer-events: none;
}

.takumi-chatbot-pulse-disabled .takumi-chatbot-button-pulse {
  display: none;
}

@keyframes pulse-inner {
  0% {
    transform: translate(-50%, -50%) scale(0.8);
    opacity: 0.7;
  }
  50% {
    transform: translate(-50%, -50%) scale(1.0);
    opacity: 0.4;
  }
  100% {
    transform: translate(-50%, -50%) scale(1.3);
    opacity: 0;
  }
}



/* Всплывающая подсказка */
.takumi-chatbot-tooltip {
  position: absolute;
  top: -180px;
  left: -320px;
  background: #ffffff;
  color: #000000;
  padding: 16px 20px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 500;
  white-space: normal;
  max-width: 280px;
  line-height: 1.4;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: all 0.3s ease;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.15);
  border: 2px solid #d4af37;
  z-index: 1001;
  cursor: pointer;
  text-align: center;
}

.takumi-chatbot-tooltip:hover {
  background: #ffffff;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.takumi-chatbot-tooltip-arrow {
  position: absolute;
  top: 50%;
  right: -8px;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-right: 8px solid #ffffff;
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
}

.takumi-chatbot-widget-wrapper:hover .takumi-chatbot-tooltip {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* Адаптивность для мобильных устройств */
@media (max-width: 768px) {
  .takumi-chatbot-widget-wrapper {
    bottom: 120px; /* Підняли кнопку вище на мобільних */
    right: 20px;
  }
  
  .takumi-chatbot-widget-button {
    width: 60px;
    height: 60px;
    border-width: 2px;
    bottom: 120px; /* Підняли кнопку вище на мобільних */
    right: 20px;
  }
  
  .takumi-chatbot-tooltip {
    display: none; /* Скрываем тултип на мобильных для экономии места */
  }
}

@media (max-width: 480px) {
  .takumi-chatbot-widget-wrapper {
    bottom: 100px; /* Підняли кнопку вище на маленьких екранах */
    right: 16px;
  }
  
  .takumi-chatbot-widget-button {
    width: 56px;
    height: 56px;
    bottom: 100px; /* Підняли кнопку вище на маленьких екранах */
    right: 16px;
  }
}

/* Индикатор статуса */
.takumi-chatbot-status-indicator {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid #ffffff;
  z-index: 3;
}

.takumi-chatbot-status-online {
  background: #4CAF50;
  box-shadow: 0 0 6px rgba(76, 175, 80, 0.6);
}

.takumi-chatbot-status-offline {
  background: #f44336;
  box-shadow: 0 0 6px rgba(244, 67, 54, 0.6);
}

/* Контейнер виджета */
.takumi-chatbot-widget-container {
  position: fixed;
  bottom: 200px;
  right: 24px;
  width: 380px;
  height: 500px;
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  border: 1px solid #e5e5e5;
  display: flex;
  flex-direction: column;
  z-index: 1001;
  overflow: hidden;
  animation: slideUp 0.3s ease-out;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', sans-serif;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Заголовок виджета */
.takumi-chatbot-widget-header {
  background: linear-gradient(135deg, #1a1a1a 0%, #333333 100%);
  color: #ffffff;
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid #d4af37;
}

.takumi-chatbot-widget-title {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 600;
  font-size: 16px;
}

.takumi-chatbot-widget-logo {
  width: 28px;
  height: 28px;
}

.takumi-chatbot-widget-title svg {
  width: 28px;
  height: 28px;
}

.takumi-chatbot-widget-close {
  background: none;
  border: none;
  color: #ffffff;
  font-size: 18px;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: background-color 0.2s ease;
}

.takumi-chatbot-widget-close:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

/* Кнопки в header */
.takumi-chatbot-header-buttons {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Кнопка TTS мута */
.takumi-chatbot-tts-toggle {
  background: none;
  border: none;
  color: #ffffff;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: background-color 0.2s ease, transform 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
}

.takumi-chatbot-tts-toggle:hover {
  background-color: rgba(255, 255, 255, 0.1);
  transform: scale(1.1);
}

.takumi-chatbot-tts-toggle:active {
  transform: scale(0.95);
}

.takumi-chatbot-tts-toggle svg {
  transition: opacity 0.2s ease;
}

/* Область сообщений */
.takumi-chatbot-widget-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #fafafa;
}

.takumi-chatbot-widget-messages::-webkit-scrollbar {
  width: 6px;
}

.takumi-chatbot-widget-messages::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 3px;
}

.takumi-chatbot-widget-messages::-webkit-scrollbar-thumb {
  background: #d4af37;
  border-radius: 3px;
}

.takumi-chatbot-widget-messages::-webkit-scrollbar-thumb:hover {
  background: #b8941f;
}

/* Стили сообщений */
.takumi-chatbot-widget-message {
  display: flex;
  flex-direction: column;
  max-width: 85%;
  animation: messageSlide 0.3s ease-out;
}

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

.takumi-chatbot-widget-message.user {
  align-self: flex-end;
}

.takumi-chatbot-widget-message.assistant {
  align-self: flex-start;
}

.takumi-chatbot-widget-message-content {
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.4;
  word-wrap: break-word;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', sans-serif;
  /* Улучшенная поддержка эмодзи */
  font-variant-emoji: unicode;
  text-rendering: optimizeLegibility;
  -webkit-font-feature-settings: "liga", "kern";
  font-feature-settings: "liga", "kern";
}

/* Усиленная поддержка эмодзи */
.takumi-chatbot-widget-message-content .emoji,
.takumi-chatbot-widget-message-content span[aria-label] {
  font-family: 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', sans-serif;
  font-size: 1.1em;
  vertical-align: baseline;
}

/* Универсальная поддержка эмодзи для всех Unicode символов */
.takumi-chatbot-widget-message-content {
  font-variant-emoji: unicode;
}

/* Специальные стили для часто используемых эмодзи */
.takumi-chatbot-widget-message-content [data-emoji],
.takumi-chatbot-widget-message-content .car-emoji,
.takumi-chatbot-widget-message-content .money-emoji,
.takumi-chatbot-widget-message-content .color-emoji,
.takumi-chatbot-widget-message-content .link-emoji,
.takumi-chatbot-widget-message-content .check-emoji,
.takumi-chatbot-widget-message-content .cross-emoji,
.takumi-chatbot-widget-message-content .info-emoji,
.takumi-chatbot-widget-message-content .lightning-emoji {
  font-family: 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', sans-serif !important;
  font-size: 1em !important;
  line-height: inherit !important;
  vertical-align: baseline !important;
  display: inline !important;
}

.takumi-chatbot-widget-message.user .takumi-chatbot-widget-message-content {
  background: linear-gradient(135deg, #1a1a1a 0%, #333333 100%);
  color: #ffffff;
  border-bottom-right-radius: 4px;
}

.takumi-chatbot-widget-message.assistant .takumi-chatbot-widget-message-content {
  background: #ffffff;
  color: #333333;
  border: 1px solid #e5e5e5;
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.takumi-chatbot-widget-message-time {
  font-size: 11px;
  color: #999999;
  margin-top: 4px;
  text-align: right;
}

.takumi-chatbot-widget-message.assistant .takumi-chatbot-widget-message-time {
  text-align: left;
}

/* Индикатор печати */
.takumi-chatbot-widget-typing {
  display: flex;
  gap: 4px;
  padding: 12px 16px;
}

.takumi-chatbot-widget-typing span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #d4af37;
  animation: typing 1.4s infinite ease-in-out;
}

.takumi-chatbot-widget-typing span:nth-child(1) {
  animation-delay: -0.32s;
}

.takumi-chatbot-widget-typing span:nth-child(2) {
  animation-delay: -0.16s;
}

@keyframes typing {
  0%, 80%, 100% {
    transform: scale(0.8);
    opacity: 0.5;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

/* Поле ввода */
.takumi-chatbot-widget-input-container {
  padding: 16px;
  border-top: 1px solid #e5e5e5;
  background: #ffffff;
  display: flex;
  gap: 12px;
  align-items: flex-end;
  position: relative;
}

/* Подсказка о голосовом вводе */
.takumi-chatbot-widget-voice-hint {
  position: absolute;
  bottom: -2px;
  left: 16px;
  right: 16px;
  font-size: 10px;
  color: #999;
  text-align: center;
  opacity: 0.8;
  transition: all 0.3s ease;
  line-height: 1;
  pointer-events: none;
  z-index: 1;
}

.takumi-chatbot-widget-voice-hint.recording {
  color: #f44336;
  opacity: 1;
  font-weight: 500;
  animation: pulse-text 1s infinite;
}

@keyframes pulse-text {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.takumi-chatbot-widget-input {
  flex: 1;
  border: 1px solid #e5e5e5;
  border-radius: 20px;
  padding: 12px 16px;
  font-size: 14px;
  font-family: inherit;
  resize: none;
  outline: none;
  transition: border-color 0.2s ease;
  min-height: 20px;
  max-height: 80px;
}

.takumi-chatbot-widget-input:focus {
  border-color: #d4af37;
}

.takumi-chatbot-widget-input::placeholder {
  color: #999999;
}

.takumi-chatbot-widget-send {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1a1a1a 0%, #333333 100%);
  border: none;
  color: #d4af37;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.takumi-chatbot-widget-send:hover:not(:disabled) {
  transform: scale(1.05);
  background: linear-gradient(135deg, #333333 0%, #1a1a1a 100%);
}

.takumi-chatbot-widget-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.takumi-chatbot-widget-mic {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
  border: none;
  color: #ffffff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: all 0.2s ease;
  flex-shrink: 0;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  position: relative;
}

.takumi-chatbot-widget-mic:hover:not(:disabled) {
  transform: scale(1.05);
  background: linear-gradient(135deg, #45a049 0%, #4CAF50 100%);
  box-shadow: 0 2px 8px rgba(76, 175, 80, 0.3);
}

.takumi-chatbot-widget-mic:active:not(.recording) {
  transform: scale(0.95);
  background: linear-gradient(135deg, #f44336 0%, #d32f2f 100%);
}

.takumi-chatbot-widget-mic.recording {
  background: linear-gradient(135deg, #f44336 0%, #d32f2f 100%);
  animation: pulse 1.5s infinite;
  transform: scale(1.1);
}

.takumi-chatbot-widget-mic:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Добавляем индикатор для Push-to-Talk */
.takumi-chatbot-widget-mic::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 2px;
  background: #ffffff;
  border-radius: 1px;
  transition: width 0.3s ease;
}

.takumi-chatbot-widget-mic:active::after,
.takumi-chatbot-widget-mic.recording::after {
  width: 80%;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(244, 67, 54, 0.7);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(244, 67, 54, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(244, 67, 54, 0);
  }
}

/* Стили для кнопки регистрации в сообщении */
.takumi-chatbot-registration-button {
  margin-top: 12px !important;
  background: #000000 !important;
  color: #ffffff !important;
  border: none !important;
  padding: 8px 16px !important;
  border-radius: 6px !important;
  font-size: 14px !important;
  cursor: pointer !important;
  font-weight: 500 !important;
  transition: all 0.2s ease !important;
}

.takumi-chatbot-registration-button:hover {
  background: #333333 !important;
  transform: translateY(-1px) !important;
}

/* Стили для информации о пользователе */
.takumi-chatbot-user-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 12px;
  padding: 8px 12px;
  background: #f8fdf9;
  border: 1px solid #d1fae5;
  border-radius: 6px;
}

.takumi-chatbot-logout-button {
  background: #ef4444 !important;
  color: white !important;
  border: none !important;
  padding: 4px 8px !important;
  border-radius: 4px !important;
  font-size: 12px !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
}

.takumi-chatbot-logout-button:hover {
  background: #dc2626 !important;
  transform: translateY(-1px) !important;
}

/* Quick actions кнопки */
.takumi-chatbot-quick-actions {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.takumi-chatbot-quick-action {
  background: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 20px;
  padding: 8px 16px;
  font-size: 13px;
  color: #495057;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s ease;
}

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

/* Модальное окно аутентификации */
.takumi-chatbot-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.takumi-chatbot-modal {
  background: #ffffff;
  border-radius: 12px;
  padding: 32px;
  width: 90%;
  max-width: 450px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
  animation: modalSlideUp 0.3s ease-out;
  border: 1px solid #e5e5e5;
}

@keyframes modalSlideUp {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.takumi-chatbot-modal-header {
  text-align: center;
  margin-bottom: 24px;
}

.takumi-chatbot-modal-title {
  font-size: 26px;
  font-weight: 700;
  color: #000000;
  margin-bottom: 8px;
  text-align: center;
}

.takumi-chatbot-modal-subtitle {
  color: #7f8c8d;
  font-size: 14px;
}

.takumi-chatbot-modal-tabs {
  display: flex;
  margin-bottom: 24px;
  border-bottom: 1px solid #e5e5e5;
}

.takumi-chatbot-modal-tab {
  flex: 1;
  padding: 12px;
  text-align: center;
  background: none;
  border: none;
  cursor: pointer;
  color: #7f8c8d;
  font-weight: 500;
  transition: all 0.2s ease;
}

.takumi-chatbot-modal-tab.active {
  color: #000000;
  border-bottom: 3px solid #000000;
  font-weight: 600;
}

.takumi-chatbot-modal-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.takumi-chatbot-form-group {
  display: flex !important;
  flex-direction: column !important;
  gap: 8px !important;
  margin-bottom: 16px !important;
}

.takumi-chatbot-form-label {
  font-weight: 600 !important;
  color: #000000 !important;
  font-size: 14px !important;
  margin-bottom: 4px !important;
  font-family: inherit !important;
}

.takumi-chatbot-form-input {
  padding: 12px 16px !important;
  border: 1px solid #e5e5e5 !important;
  border-radius: 8px !important;
  font-size: 14px !important;
  transition: border-color 0.2s ease !important;
  width: 100% !important;
  box-sizing: border-box !important;
  background: #ffffff !important;
  color: #000000 !important;
  font-family: inherit !important;
}

.takumi-chatbot-form-input:focus {
  outline: none !important;
  border-color: #000000 !important;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.1) !important;
}

.takumi-chatbot-form-button {
  background: #000000 !important;
  color: #ffffff !important;
  border: none !important;
  padding: 12px 24px !important;
  border-radius: 6px !important;
  font-weight: 600 !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
  font-size: 14px !important;
  text-transform: uppercase !important;
  letter-spacing: 0.5px !important;
  width: 100% !important;
  margin-top: 16px !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15) !important;
}

.takumi-chatbot-form-button:hover {
  background: #333333 !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2) !important;
}

.takumi-chatbot-form-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.takumi-chatbot-modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: #7f8c8d;
  transition: color 0.2s ease;
}

.takumi-chatbot-modal-close:hover {
  color: #000000;
}

.takumi-chatbot-form-error {
  color: #e74c3c;
  font-size: 13px;
  margin-top: 4px;
}

.takumi-chatbot-form-success {
  color: #27ae60;
  font-size: 13px;
  margin-top: 4px;
}

/* Мобильная адаптация */
@media (max-width: 768px) {
  .takumi-chatbot-widget-container {
    width: calc(100vw - 32px);
    height: 500px !important; /* Фиксированная высота - не меняется */
    max-height: 500px !important;
    min-height: 500px !important;
    bottom: 200px; /* Підняли віджет вище щоб був над кнопкою з проміжком */
    right: 16px;
    border-radius: 16px;
    position: fixed !important;
  }

  .takumi-chatbot-widget-button {
    bottom: 120px; /* Підняли кнопку вище на планшетах */
    right: 20px;
    width: 60px;
    height: 60px;
    font-size: 24px;
  }

  .takumi-chatbot-widget-header {
    padding: max(16px, env(safe-area-inset-top)) 20px 16px 20px;
    flex-shrink: 0;
  }

  .takumi-chatbot-widget-messages {
    padding: 16px;
    padding-bottom: 16px;
    flex: 1;
    overflow-y: auto;
    min-height: 0;
  }

  .takumi-chatbot-widget-input-container {
    padding: 12px 16px;
    padding-bottom: 12px;
    position: relative;
    flex-shrink: 0;
    background: #ffffff;
    border-top: 1px solid #e5e5e5;
  }

  .takumi-chatbot-modal {
    width: 95%;
    max-width: 400px;
    padding: 24px;
  }
}

@media (max-width: 480px) {
  .takumi-chatbot-widget-container {
    width: calc(100vw - 24px);
    height: 480px !important; /* Фиксированная высота для маленьких экранов */
    max-height: 480px !important;
    min-height: 480px !important;
    bottom: 180px; /* Підняли віджет вище щоб був над кнопкою з проміжком */
    right: 12px;
    border-radius: 16px;
    position: fixed !important;
  }

  .takumi-chatbot-widget-button {
    bottom: 100px; /* Підняли кнопку вище на маленьких екранах */
    right: 16px;
    width: 56px;
    height: 56px;
  }

  .takumi-chatbot-widget-header {
    padding: 12px 16px;
    font-size: 15px;
    flex-shrink: 0;
  }

  .takumi-chatbot-widget-title {
    font-size: 15px;
    gap: 10px;
  }

  .takumi-chatbot-widget-logo {
    width: 24px;
    height: 24px;
  }

  .takumi-chatbot-widget-messages {
    padding: 12px;
    padding-bottom: 12px;
    flex: 1;
    overflow-y: auto;
    min-height: 0;
  }

  .takumi-chatbot-widget-input-container {
    padding: 10px 12px;
    padding-bottom: 10px;
    position: relative;
    flex-shrink: 0;
    background: #ffffff;
    border-top: 1px solid #e5e5e5;
  }

  .takumi-chatbot-widget-input {
    font-size: 16px; /* Предотвращает зум на iOS */
    padding: 10px 12px;
  }

  .takumi-chatbot-modal {
    padding: 20px;
    max-width: 340px;
  }
}

/* iOS Safari специфичные исправления */
@supports (-webkit-touch-callout: none) {
  /* Запобігаємо зміщенню при відкритті клавіатури */
  .takumi-chatbot-widget-container {
    position: fixed !important;
    height: 500px !important;
  }
  
  @media (max-width: 480px) {
    .takumi-chatbot-widget-container {
      height: 480px !important;
    }
  }

  .takumi-chatbot-widget-input {
    /* Предотвращает зум при фокусе на iOS */
    font-size: 16px !important;
  }
  
  /* Фіксуємо body при відкритому віджеті щоб не скролилось */
  body.takumi-chatbot-open {
    position: fixed;
    width: 100%;
    overflow: hidden;
  }
}

/* Ландшафтная ориентация на мобильных */
@media (max-width: 768px) and (orientation: landscape) {
  .takumi-chatbot-widget-container {
    height: 400px !important; /* Фиксированная высота в landscape */
    max-height: 400px !important;
    min-height: 400px !important;
    bottom: 80px; /* Менше відступ в landscape */
  }

  .takumi-chatbot-widget-header {
    padding: 10px 16px;
  }

  .takumi-chatbot-widget-messages {
    padding: 10px 12px;
  }

  .takumi-chatbot-widget-input-container {
    padding: 8px 12px;
  }
}

/* Дополнительные улучшения для премиального вида */
.takumi-chatbot-widget-container::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, #d4af37 0%, #f4d03f 50%, #d4af37 100%);
  z-index: 1;
}

/* Эффект при hover на сообщения */
.takumi-chatbot-widget-message-content:hover {
  transform: translateY(-1px);
  transition: transform 0.2s ease;
}

/* Анимация появления кнопки */
.takumi-chatbot-widget-button {
  animation: buttonFloat 0.5s ease-out;
}

@keyframes buttonFloat {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.8);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Скрытие виджета */
.takumi-chatbot-widget-hidden {
  display: none !important;
}

/* Статус онлайн/оффлайн */
.takumi-chatbot-status-indicator {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid #ffffff;
}

.takumi-chatbot-status-online {
  background-color: #4ade80;
}

.takumi-chatbot-status-offline {
  background-color: #ef4444;
}

/* Уведомления */
.takumi-chatbot-notification {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: #333333;
  color: #ffffff;
  padding: 12px 24px;
  border-radius: 8px;
  z-index: 10001;
  animation: notificationSlide 0.3s ease-out;
}

@keyframes notificationSlide {
  from {
    opacity: 0;
    transform: translate(-50%, -20px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

.takumi-chatbot-notification.success {
  background: #10b981;
}

.takumi-chatbot-notification.error {
  background: #ef4444;
}

.takumi-chatbot-notification.warning {
  background: #f59e0b;
}

/* Модальное окно аутентификации */
.takumi-chatbot-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10001;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.takumi-chatbot-modal-overlay:not(.takumi-chatbot-widget-hidden) {
  opacity: 1;
  visibility: visible;
}

.takumi-chatbot-modal {
  background: #ffffff;
  border-radius: 12px;
  width: 90%;
  max-width: 400px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  transform: scale(0.9) translateY(20px);
  transition: all 0.3s ease;
}

.takumi-chatbot-modal-overlay:not(.takumi-chatbot-widget-hidden) .takumi-chatbot-modal {
  transform: scale(1) translateY(0);
}

.takumi-chatbot-modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: #6b7280;
  padding: 4px;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.takumi-chatbot-modal-close:hover {
  background: #f3f4f6;
  color: #374151;
}

.takumi-chatbot-modal-header {
  text-align: center;
  padding: 24px 24px 16px 24px;
  border-bottom: 1px solid #e5e7eb;
}

.takumi-chatbot-modal-title {
  font-size: 24px;
  font-weight: 700;
  color: #111827;
  margin: 0 0 8px 0;
}

.takumi-chatbot-modal-subtitle {
  font-size: 14px;
  color: #6b7280;
  margin: 0;
}

.takumi-chatbot-modal-tabs {
  display: flex;
  padding: 0 24px;
  background: #f9fafb;
}

.takumi-chatbot-modal-tab {
  flex: 1;
  padding: 12px 16px;
  background: none;
  border: none;
  font-size: 14px;
  font-weight: 500;
  color: #6b7280;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s ease;
}

.takumi-chatbot-modal-tab.active {
  color: #d4af37;
  border-bottom-color: #d4af37;
}

.takumi-chatbot-modal-form {
  padding: 24px;
}

.takumi-chatbot-form-group {
  margin-bottom: 16px;
}

.takumi-chatbot-form-label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: #374151;
  margin-bottom: 6px;
}

.takumi-chatbot-form-input {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 16px;
  transition: all 0.2s ease;
  box-sizing: border-box;
}

.takumi-chatbot-form-input:focus {
  outline: none;
  border-color: #d4af37;
  box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.1);
}

.takumi-chatbot-form-button {
  width: 100%;
  padding: 12px 16px;
  background: #d4af37;
  color: #ffffff;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.takumi-chatbot-form-button:hover:not(:disabled) {
  background: #c49b2f;
}

.takumi-chatbot-form-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.takumi-chatbot-form-message {
  margin-top: 12px;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 14px;
  text-align: center;
}

.takumi-chatbot-form-message.takumi-chatbot-form-success {
  background: #d1fae5;
  color: #065f46;
}

.takumi-chatbot-form-message.takumi-chatbot-form-error {
  background: #fee2e2;
  color: #991b1b;
}

/* Стили для ссылок в сообщениях */
.takumi-chatbot-widget-message-content a {
  color: #d4af37;
  text-decoration: underline;
  font-weight: 500;
  transition: color 0.2s ease;
}

.takumi-chatbot-widget-message-content a:hover {
  color: #b8941f;
  text-decoration: none;
}

.takumi-chatbot-widget-message-content a:visited {
  color: #a67c19;
}

/* Стили для ссылок в сообщениях от пользователя (белый текст) */
.takumi-chatbot-widget-message.user .takumi-chatbot-widget-message-content a {
  color: #f4d03f;
}

.takumi-chatbot-widget-message.user .takumi-chatbot-widget-message-content a:hover {
  color: #f7dc6f;
}

.takumi-chatbot-widget-message.user .takumi-chatbot-widget-message-content a:visited {
  color: #f1c40f;
}

/* ============================================
   МОБІЛЬНА ОПТИМІЗАЦІЯ ДЛЯ iPhone
   ============================================ */

/* Глобальні виправлення для touch пристроїв */
@media (hover: none) and (pointer: coarse) {
  /* Збільшуємо кнопки для зручності touch */
  .takumi-chatbot-widget-button,
  .takumi-chatbot-widget-close,
  .takumi-chatbot-widget-send,
  .takumi-chatbot-action-button {
    min-width: 44px;
    min-height: 44px;
  }

  /* Видаляємо hover ефекти на touch пристроях */
  .takumi-chatbot-widget-button:hover,
  .takumi-chatbot-widget-close:hover,
  .takumi-chatbot-widget-send:hover {
    transform: none;
  }

  /* Додаємо active стан замість hover */
  .takumi-chatbot-widget-button:active {
    transform: scale(0.95);
  }

  .takumi-chatbot-widget-send:active {
    background: #b8941f;
  }

  .takumi-chatbot-widget-close:active {
    background-color: rgba(255, 255, 255, 0.2);
  }
}

/* iPhone X, XS, 11 Pro, 12 Mini, 13 Mini (375 x 812) */
@media only screen 
  and (device-width: 375px) 
  and (device-height: 812px) 
  and (-webkit-device-pixel-ratio: 3) {
  .takumi-chatbot-widget-container {
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
  }
}

/* iPhone XR, 11 (414 x 896) */
@media only screen 
  and (device-width: 414px) 
  and (device-height: 896px) 
  and (-webkit-device-pixel-ratio: 2) {
  .takumi-chatbot-widget-container {
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
  }
}

/* iPhone XS Max, 11 Pro Max (414 x 896) */
@media only screen 
  and (device-width: 414px) 
  and (device-height: 896px) 
  and (-webkit-device-pixel-ratio: 3) {
  .takumi-chatbot-widget-container {
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
  }
}

/* iPhone 12, 12 Pro, 13, 13 Pro, 14 (390 x 844) */
@media only screen 
  and (device-width: 390px) 
  and (device-height: 844px) 
  and (-webkit-device-pixel-ratio: 3) {
  .takumi-chatbot-widget-container {
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
  }
}

/* iPhone 12 Pro Max, 13 Pro Max, 14 Plus (428 x 926) */
@media only screen 
  and (device-width: 428px) 
  and (device-height: 926px) 
  and (-webkit-device-pixel-ratio: 3) {
  .takumi-chatbot-widget-container {
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
  }
}

/* iPhone 14 Pro (393 x 852) */
@media only screen 
  and (device-width: 393px) 
  and (device-height: 852px) 
  and (-webkit-device-pixel-ratio: 3) {
  .takumi-chatbot-widget-container {
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
  }
}

/* iPhone 14 Pro Max (430 x 932) */
@media only screen 
  and (device-width: 430px) 
  and (device-height: 932px) 
  and (-webkit-device-pixel-ratio: 3) {
  .takumi-chatbot-widget-container {
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
  }
}

/* iPhone 15, 15 Pro (393 x 852) */
@media only screen 
  and (device-width: 393px) 
  and (device-height: 852px) 
  and (-webkit-device-pixel-ratio: 3) {
  .takumi-chatbot-widget-container {
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
  }
}

/* iPhone 15 Plus, 15 Pro Max (430 x 932) */
@media only screen 
  and (device-width: 430px) 
  and (device-height: 932px) 
  and (-webkit-device-pixel-ratio: 3) {
  .takumi-chatbot-widget-container {
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
  }
}

/* iOS Safari виправлення для фіксованих елементів */
@supports (-webkit-touch-callout: none) {
  /* Фікс для 100vh на iOS */
  .takumi-chatbot-widget-container {
    min-height: -webkit-fill-available;
  }

  /* Запобігаємо zoom при фокусі на input */
  .takumi-chatbot-widget-input,
  .takumi-chatbot-form-input,
  input[type="text"],
  input[type="email"],
  input[type="tel"],
  textarea {
    font-size: 16px !important;
  }

  /* Виправлення для клавіатури iOS */
  .takumi-chatbot-widget-input-container {
    position: relative;
  }

  /* Smooth scrolling для iOS */
  .takumi-chatbot-widget-messages {
    -webkit-overflow-scrolling: touch;
  }
}

/* Виправлення відступів для Dynamic Island (iPhone 14 Pro+) */
@media (min-width: 390px) and (max-width: 430px) and (min-height: 844px) {
  .takumi-chatbot-widget-header {
    padding-top: max(20px, env(safe-area-inset-top, 20px));
  }
}

/* Запобігаємо pull-to-refresh в Safari при скролі віджета */
.takumi-chatbot-widget-messages {
  overscroll-behavior-y: contain;
}

/* Покращення для touch взаємодії */
* {
  -webkit-tap-highlight-color: transparent;
}

.takumi-chatbot-widget-button,
.takumi-chatbot-action-button,
.takumi-chatbot-widget-send {
  -webkit-tap-highlight-color: rgba(212, 175, 55, 0.3);
}

/* Виправлення для landscape режиму на iPhone */
@media (max-height: 500px) and (orientation: landscape) {
  .takumi-chatbot-widget-header {
    padding: 8px 16px;
    min-height: 50px;
  }

  .takumi-chatbot-widget-title {
    font-size: 14px;
  }

  .takumi-chatbot-widget-logo {
    width: 20px;
    height: 20px;
  }

  .takumi-chatbot-widget-messages {
    padding: 8px 12px;
  }

  .takumi-chatbot-widget-input-container {
    padding: 6px 12px;
  }

  .takumi-chatbot-widget-button {
    width: 48px;
    height: 48px;
    bottom: 10px;
    right: 10px;
  }
}
