/* iOS tap highlight fix — applies globally */
* {
  -webkit-tap-highlight-color: transparent;
}

/* Chat Icon */
.chat-icon {
  position: fixed;
  bottom: 20px;
  bottom: calc(20px + env(safe-area-inset-bottom));
  left: 20px;
  background: #e77829;
  color: white;
  border-radius: 50%;
  width: 60px;
  height: 60px;
  font-size: 20px;
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: center;
  align-items: center;
  -webkit-justify-content: center;
  justify-content: center;
  cursor: pointer;
  z-index: 1000;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
  /* iOS fixed-position GPU compositing fix */
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
  will-change: transform;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

/* Chat window — hidden by default; JS toggles visibility */
.chat-window {
  position: fixed;
  bottom: 90px;
  bottom: calc(90px + env(safe-area-inset-bottom));
  left: 20px;
  width: 320px;
  max-height: 480px;
  border-radius: 12px;
  background: white;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  z-index: 1000;
  display: none; /* hidden by default; JS uses .show() / .hide() */
  -webkit-flex-direction: column;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid #ddd;
  /* iOS fixed-position GPU compositing fix */
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
  will-change: transform;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

/* When JS shows the chat window */
.chat-window.chat-open {
  display: -webkit-flex;
  display: flex;
}

.chat-header {
  background: #e77829;
  color: white;
  padding: 12px;
  font-weight: bold;
  text-align: center;
  font-size: 16px;
}

.chat-body {
  -webkit-flex: 1;
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch; /* smooth momentum scrolling on iOS */
  padding: 10px;
  background: #f7f7f7;
}

.chat-footer {
  padding: 10px;
  border-top: 1px solid #ccc;
  background: #fff;
}

.chat-message {
  margin-bottom: 12px;
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.4;
  position: relative;
  clear: both;
}

.chat-message .meta {
  font-size: 11px;
  color: #666;
  margin-top: 5px;
  text-align: right;
}

.chat-message.user {
  background: #dcf8c6;
  float: right;
  border-bottom-right-radius: 0;
}

.chat-message.bot {
  background: #ffffff;
  border: 1px solid #ddd;
  float: left;
  border-bottom-left-radius: 0;
}

