.ai-trigger {
  position: fixed;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2147483647;
  cursor: pointer;
  background: linear-gradient(135deg, #0093CA 0%, #1e8bc3 100%);
  border-radius: 12px 0 0 12px;
  padding: 24px 12px;
  color: #fff;
  font-family: 'Roboto', sans-serif;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 3px;
  text-transform: uppercase;
  box-shadow: 0 4px 20px rgba(0, 147, 202, 0.4);
  transition: opacity 0.3s ease, visibility 0.3s ease, box-shadow 0.3s ease;
  user-select: none;
  line-height: 1.3;
  min-width: 36px;
  writing-mode: vertical-lr;
  text-orientation: mixed;
}
.ai-trigger:hover {
  box-shadow: 0 8px 30px rgba(0, 147, 202, 0.6);
}

@keyframes ai-pulse {
  0%, 100% { transform: translateY(-50%) translateX(0); }
  50% { transform: translateY(-50%) translateX(-5px); }
}
.ai-trigger:not(.ai-trigger--open):not(:hover) {
  animation: ai-pulse 2s ease-in-out infinite;
}
.ai-trigger--open {
  animation: none;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.ai-panel {
  position: fixed;
  right: 0;
  top: 0;
  height: 100vh;
  height: 100svh;
  width: min(400px, 33vw);
  min-width: 320px;
  z-index: 2147483646;
  background: #ffffff;
  border-left: 1px solid #C4CBCE;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: -4px 0 40px rgba(0, 0, 0, 0.15);
  font-family: 'Roboto', sans-serif;
}
.ai-panel--open {
  transform: translateX(0);
}

.ai-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #C4CBCE;
  flex-shrink: 0;
  background: #0093CA;
}
.ai-panel__title {
  font-size: 16px;
  font-weight: 700;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 10px;
}
.ai-panel__title-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #FFBD00;
  box-shadow: 0 0 8px rgba(255, 189, 0, 0.6);
  animation: ai-dot 1.5s ease-in-out infinite;
}
@keyframes ai-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}
.ai-panel__close {
  background: none;
  border: none;
  color: #ffffff;
  font-size: 24px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all 0.2s ease;
  line-height: 1;
}
.ai-panel__close:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
}

.ai-panel__messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 0;
}
.ai-panel__messages::-webkit-scrollbar {
  width: 6px;
}
.ai-panel__messages::-webkit-scrollbar-track {
  background: transparent;
}
.ai-panel__messages::-webkit-scrollbar-thumb {
  background: #C4CBCE;
  border-radius: 3px;
}

.ai-msg {
  max-width: 90%;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.6;
  word-wrap: break-word;
  animation: ai-msg-in 0.25s ease-out;
}
@keyframes ai-msg-in {
  0% { opacity: 0; transform: translateY(8px); }
  100% { opacity: 1; transform: translateY(0); }
}
.ai-msg--user {
  align-self: flex-end;
  background: linear-gradient(135deg, #0093CA 0%, #1e8bc3 100%);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.ai-msg--bot {
  align-self: flex-start;
  background: #EBF3F6;
  color: #333333;
  border: 1px solid #C4CBCE;
  border-bottom-left-radius: 4px;
}
.ai-msg--bot strong {
  color: #272727;
  font-weight: 600;
}
.ai-msg--bot em {
  color: #0093CA;
  font-style: italic;
}
.ai-msg--bot a {
  color: #0093CA;
  font-weight: 600;
  text-decoration: underline;
}
.ai-msg--bot a:hover {
  color: #006699;
}
.ai-msg--error {
  align-self: flex-start;
  background: rgba(211, 124, 124, 0.15);
  color: #d17c7c;
  border: 1px solid rgba(211, 124, 124, 0.3);
  border-bottom-left-radius: 4px;
}

.ai-panel__thinking {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 12px 16px;
  align-self: flex-start;
  background: #EBF3F6;
  border-radius: 12px;
  border-bottom-left-radius: 4px;
  border: 1px solid #C4CBCE;
}
.ai-panel__thinking-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ADBEC6;
  animation: ai-think 1.2s ease-in-out infinite;
}
.ai-panel__thinking-dot:nth-child(2) { animation-delay: 0.2s; }
.ai-panel__thinking-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes ai-think {
  0%, 80%, 100% { background: #ADBEC6; }
  40% { background: #0093CA; }
}

.ai-panel__input-area {
  padding: 16px 20px;
  border-top: 1px solid #C4CBCE;
  display: flex;
  gap: 10px;
  flex-shrink: 0;
  background: #ffffff;
}
.ai-panel__input {
  flex: 1;
  height: 44px;
  padding: 0 16px;
  border: 2px solid #ADBEC6;
  border-radius: 8px;
  background: #ffffff;
  color: #333333;
  font-family: 'Roboto', sans-serif;
  font-size: 14px;
  transition: border-color 0.2s ease;
}
.ai-panel__input:focus {
  outline: none;
  border-color: #0093CA;
}
.ai-panel__input::placeholder {
  color: #ADBEC6;
}
.ai-panel__disclaimer {
  padding: 6px 20px 10px;
  font-size: 10px;
  color: #ADBEC6;
  text-align: center;
  line-height: 1.3;
  flex-shrink: 0;
}
.ai-panel__send {
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 8px;
  background: linear-gradient(135deg, #0093CA 0%, #1e8bc3 100%);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
}
.ai-panel__send:hover {
  box-shadow: 0 4px 15px rgba(0, 147, 202, 0.4);
}
.ai-panel__send svg {
  width: 20px;
  height: 20px;
}
.ai-panel__send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Hide third-party widgets that interfere with AI chat input */
#CalltouchWidgetFrame,
jdiv, [class*="calltouch"], [id*="calltouch"], [data-calltouch], [data-calltouch-widget] {
  display: none !important;
}

@media (max-width: 768px) {
  .ai-panel {
    width: 100vw;
    min-width: 100vw;
  }
  .ai-trigger {
    padding: 14px 8px;
    font-size: 12px;
    font-family: 'Roboto', sans-serif;
  }
}