.geolak-aichat-root {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 999999;
  font-family: "Segoe UI", Tahoma, sans-serif;
  margin: 0;
  padding: 0;
}

.geolak-aichat-toggle {
  width: 58px;
  height: 58px;
  border: 0;
  border-radius: 50%;
  background: #ffffff;
  color: #1e293b;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(30, 41, 59, 0.22);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  position: relative;
  margin: 0;
  padding: 0;
  overflow: hidden;
}

.geolak-aichat-toggle:hover {
  transform: scale(1.08);
  box-shadow: 0 14px 34px rgba(30, 41, 59, 0.3);
}

.geolak-aichat-toggle-avatar-wrap {
  width: 100%;
  height: 100%;
  position: relative;
  display: block;
}

.geolak-aichat-toggle-avatar {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.geolak-aichat-toggle-q {
  position: absolute;
  right: 2px;
  bottom: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #1f5f47;
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 800;
  border: 2px solid #ffffff;
}

.geolak-aichat-panel {
  width: min(360px, calc(100vw - 36px));
  height: min(520px, calc(100vh - 96px));
  background: #ffffff;
  border: 1px solid #e0e7ff;
  border-radius: 16px;
  box-shadow: 0 20px 50px rgba(30, 41, 59, 0.12);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: absolute;
  right: 0;
  bottom: 68px;
  opacity: 0;
  transform: translateY(14px) scale(0.98);
  pointer-events: none;
  visibility: hidden;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.geolak-aichat-root[data-open="1"] .geolak-aichat-panel {
  visibility: visible;
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.geolak-aichat-header {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid #e0e7ff;
  background: linear-gradient(180deg, #f8fafc, #f1f5f9);
}

.geolak-aichat-header-top {
  width: 100%;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.geolak-aichat-header-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.geolak-aichat-title {
  margin: 0;
  color: #1e293b;
  font-size: 15px;
  font-weight: 700;
  flex: 1;
}

.geolak-aichat-subtitle {
  margin: 0;
  color: #64748b;
  font-size: 12px;
  line-height: 1.4;
  width: 100%;
}

.geolak-aichat-minimize {
  border: 0;
  border-radius: 6px;
  padding: 4px 10px;
  cursor: pointer;
  background: #e0e7ff;
  color: #334155;
  font-size: 18px;
  line-height: 1;
  transition: all 0.2s ease;
}

.geolak-aichat-minimize:hover {
  background: #cbd5e1;
}

.geolak-aichat-maximize {
  border: 0;
  border-radius: 6px;
  padding: 4px 10px;
  cursor: pointer;
  background: #e0e7ff;
  color: #334155;
  font-size: 14px;
  line-height: 1;
  transition: all 0.2s ease;
  min-width: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.geolak-aichat-maximize:hover {
  background: #cbd5e1;
}

.geolak-aichat-maximize-icon {
  position: relative;
  width: 14px;
  height: 14px;
  display: inline-block;
}

.geolak-aichat-maximize-icon span {
  position: absolute;
  width: 5px;
  height: 5px;
  border-color: #334155;
  border-style: solid;
}

.geolak-aichat-maximize-icon span:nth-child(1) {
  top: 0;
  left: 0;
  border-width: 2px 0 0 2px;
}

.geolak-aichat-maximize-icon span:nth-child(2) {
  top: 0;
  right: 0;
  border-width: 2px 2px 0 0;
}

.geolak-aichat-maximize-icon span:nth-child(3) {
  right: 0;
  bottom: 0;
  border-width: 0 2px 2px 0;
}

.geolak-aichat-maximize-icon span:nth-child(4) {
  left: 0;
  bottom: 0;
  border-width: 0 0 2px 2px;
}

.geolak-aichat-root[data-maximized="1"] .geolak-aichat-maximize-icon {
  transform: scale(0.92);
}

.geolak-aichat-root[data-maximized="1"] .geolak-aichat-maximize-icon span:nth-child(1) {
  top: 2px;
  left: 2px;
}

.geolak-aichat-root[data-maximized="1"] .geolak-aichat-maximize-icon span:nth-child(2) {
  top: 2px;
  right: 2px;
}

.geolak-aichat-root[data-maximized="1"] .geolak-aichat-maximize-icon span:nth-child(3) {
  right: 2px;
  bottom: 2px;
}

.geolak-aichat-root[data-maximized="1"] .geolak-aichat-maximize-icon span:nth-child(4) {
  left: 2px;
  bottom: 2px;
}

.geolak-aichat-root[data-maximized="1"] .geolak-aichat-panel {
  position: fixed;
  right: 16px;
  bottom: 16px;
  width: min(980px, calc(100vw - 32px));
  height: min(92vh, calc(100vh - 32px));
  max-height: none;
}

.geolak-aichat-clear {
  border: 1px solid #e0e7ff;
  border-radius: 6px;
  padding: 4px 10px;
  cursor: pointer;
  background: transparent;
  color: #475569;
  font-size: 12px;
  transition: all 0.2s ease;
}

.geolak-aichat-clear:hover:not([disabled]) {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

.geolak-aichat-clear[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}

.geolak-aichat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  background: #ffffff;
}

.geolak-aichat-message {
  max-width: 88%;
  margin-bottom: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.45;
  white-space: pre-wrap;
}

.geolak-aichat-message-user {
  margin-left: auto;
  color: #ffffff;
  background: #2a7a5e;
}

.geolak-aichat-message-bot {
  margin-right: auto;
  color: #1e293b;
  background: #e8eef7;
  border: 1px solid #d9e2f0;
}

.geolak-aichat-loading {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 38px;
}

.geolak-aichat-loading-text {
  font-style: italic;
  color: #475569;
  opacity: 1;
  transition: opacity 0.28s ease;
}

.geolak-aichat-loading-text.is-fading {
  opacity: 0.2;
}

.geolak-aichat-loading span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #2a7a5e;
  opacity: 0.35;
  animation: geolak-chat-bounce 1s infinite ease-in-out;
}

.geolak-aichat-loading span:nth-child(2) {
  animation-delay: 0.18s;
}

.geolak-aichat-loading span:nth-child(3) {
  animation-delay: 0.36s;
}

@keyframes geolak-chat-bounce {
  0%,
  80%,
  100% {
    transform: translateY(0);
    opacity: 0.35;
  }

  40% {
    transform: translateY(-5px);
    opacity: 1;
  }
}

.geolak-aichat-input-wrap {
  border-top: 1px solid #e0e7ff;
  display: flex;
  gap: 8px;
  padding: 12px;
  background: #f8fafc;
}

.geolak-aichat-input {
  flex: 1;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #ffffff;
  color: #1e293b;
  resize: none;
  padding: 10px 14px;
  font-size: 14px;
  transition: all 0.2s ease;
}

.geolak-aichat-input::placeholder {
  color: #cbd5e1;
}

.geolak-aichat-input:focus {
  outline: none;
  border-color: #2a7a5e;
  box-shadow: 0 0 0 3px rgba(42, 122, 94, 0.1);
}

.geolak-aichat-send {
  border: 0;
  border-radius: 8px;
  padding: 0 16px;
  cursor: pointer;
  font-weight: 700;
  font-size: 13px;
  color: #ffffff;
  background: linear-gradient(135deg, #2a7a5e, #1f5f47);
  transition: all 0.2s ease;
}

.geolak-aichat-send:hover:not([disabled]) {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(42, 122, 94, 0.3);
}

.geolak-aichat-send[disabled],
.geolak-aichat-input[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}

.geolak-aichat-status {
  margin: 0;
  min-height: 24px;
  padding: 0 12px 10px;
  color: #64748b;
  font-size: 12px;
  background: #f8fafc;
  border-top: 1px solid #e0e7ff;
}

.geolak-aichat-status.is-error {
  color: #ef4444;
}

@media (max-width: 560px) {
  .geolak-aichat-root {
    right: 10px;
    bottom: 10px;
  }

  .geolak-aichat-panel {
    width: calc(100vw - 20px);
    height: min(70vh, 540px);
  }

  .geolak-aichat-root[data-maximized="1"] .geolak-aichat-panel {
    right: 10px;
    bottom: 10px;
    width: calc(100vw - 20px);
    height: calc(100vh - 20px);
  }
}
