/* ===== Фима — кнопка → меню → чат ===== */

/* Меню (три кнопки) */
.fima-menu {
  position: fixed;
  bottom: 120px;
  right: 24px;
  z-index: 9998;
  display: none;
  flex-direction: column;
  gap: 12px;
  animation: fima-menu-in 0.25s ease;
}

.fima-menu.open { display: flex; }

@keyframes fima-menu-in {
  from { opacity: 0; transform: translateY(16px) scale(0.9); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.fima-menu-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  border-radius: 16px;
  border: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  transition: all 0.2s;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
  white-space: nowrap;
  min-width: 200px;
}

.fima-menu-btn:hover {
  transform: translateX(-4px);
  box-shadow: 0 6px 24px rgba(0,0,0,0.2);
}

.fima-menu-btn .icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.fima-btn-ask { background: linear-gradient(135deg, #008080, #006666); color: #fff; }
.fima-btn-ask .icon { background: rgba(255,255,255,0.2); }
.fima-btn-max { background: #fff; color: #36454F; border: 1.5px solid #cce0e0; }
.fima-btn-max .icon { background: #e6f5f5; color: #008080; }
.fima-btn-book { background: linear-gradient(135deg, #3CB371, #2d8f59); color: #fff; }
.fima-btn-book .icon { background: rgba(255,255,255,0.2); }

/* Скрываем старую этикетку */
.fima-label { display: none; }

/* ===== Окно чата ===== */
.fima-chat {
  position: fixed;
  bottom: 96px;
  right: 24px;
  z-index: 9997;
  width: 380px;
  height: 560px;
  max-width: calc(100vw - 48px);
  max-height: calc(100vh - 120px);
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.18);
  display: none;
  flex-direction: column;
  overflow: hidden;
  animation: fima-slide-up 0.25s ease;
}

.fima-chat.open { display: flex; }

@keyframes fima-slide-up {
  from { opacity: 0; transform: translateY(16px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Шапка чата */
.fima-chat-header {
  background: linear-gradient(135deg, #008080, #006666);
  color: #fff;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.fima-chat-header-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.fima-chat-header-info { flex: 1; min-width: 0; }
.fima-chat-header-name { font-weight: 600; font-size: 14px; }
.fima-chat-header-status { font-size: 11px; opacity: 0.8; }

.fima-chat-close {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  border: none;
  color: #fff;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.fima-chat-close:hover { background: rgba(255,255,255,0.25); }

/* Сообщения */
.fima-chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: #f5fafa;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.fima-msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.5;
  word-wrap: break-word;
  white-space: pre-wrap;
  animation: fima-msg-in 0.2s ease;
}

@keyframes fima-msg-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.fima-msg-bot {
  align-self: flex-start;
  background: #e6f5f5;
  color: #36454F;
  border-bottom-left-radius: 4px;
}

.fima-msg-user {
  align-self: flex-end;
  background: linear-gradient(135deg, #008080, #006666);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.fima-msg-time {
  font-size: 10px;
  opacity: 0.5;
  margin-top: 4px;
  text-align: right;
}

.fima-typing {
  align-self: flex-start;
  display: flex;
  gap: 4px;
  padding: 12px 16px;
  background: #e6f5f5;
  border-radius: 14px;
  border-bottom-left-radius: 4px;
}

.fima-typing-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #008080;
  animation: fima-bounce 1.2s infinite;
}

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

@keyframes fima-bounce {
  0%, 80%, 100% { transform: translateY(0); }
  40% { transform: translateY(-6px); }
}

/* Поле ввода */
.fima-chat-input-area {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid #e6f5f5;
  background: #fff;
  flex-shrink: 0;
}

.fima-chat-input {
  flex: 1;
  border: 1.5px solid #cce0e0;
  border-radius: 24px;
  padding: 10px 16px;
  font-size: 14px;
  outline: none;
  font-family: inherit;
  color: #36454F;
  background: #fafafa;
}

.fima-chat-input:focus {
  border-color: #008080;
  background: #fff;
}

.fima-chat-input::placeholder { color: #a0b4b4; }

.fima-chat-send {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #008080, #006666);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
  transition: all 0.2s;
}

.fima-chat-send:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(0,128,128,0.35);
}

.fima-chat-send:disabled {
  opacity: 0.4;
  cursor: default;
  transform: none;
  box-shadow: none;
}

/* Адаптация */
@media (max-width: 480px) {
  .fima-menu { right: 16px; bottom: 100px; }
  .fima-menu-btn { min-width: 170px; padding: 12px 16px; font-size: 13px; }
  .fima-chat { right: 12px; bottom: 80px; width: calc(100vw - 24px); height: calc(100vh - 100px); border-radius: 12px; }
}