:root {
  --chat-primary: #2c3e50;
  --chat-accent: #d4af37;
  --chat-accent-dark: #b8860b;
  --chat-light: #f8f9fa;
  --chat-text: #333;
  --chat-radius: 24px;
  --chat-shadow: 0 4px 20px rgba(0,0,0,0.15);
  --chat-transition: 0.25s ease;
}

.chatbot-wrap * {
  box-sizing: border-box !important;
}

.chat-toggle-state {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

/* ===== FLOATING TOGGLE BUTTON ===== */
.chat-toggle-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, #d4af37, #b8860b);
  color: white;
  font-size: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--chat-shadow);
  z-index: 999999;
  border: none;
  line-height: 1;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  transition: transform var(--chat-transition);
}
.chat-toggle-btn:hover,
.chat-toggle-btn:focus {
  transform: scale(1.05);
  outline: 2px solid var(--chat-accent);
  outline-offset: 2px;
}

/* ===== CHAT WINDOW ===== */
.chat-window {
  position: fixed;
  bottom: 100px;
  right: 24px;
  width: 380px;
  max-width: calc(100vw - 48px);
  height: 560px;
  max-height: calc(100vh - 120px);
  background: #ffffff;
  border-radius: 24px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
  border: 1px solid #e5e5e5;
  display: flex;
  flex-direction: column;
  z-index: 999998;
  overflow: hidden;
  opacity: 0;
  transform: translateY(20px);
  pointer-events: none;
  transition: opacity var(--chat-transition), transform var(--chat-transition);
}

.chat-toggle-state:checked ~ .chat-window {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.chat-toggle-state:checked + .chat-toggle-btn {
  opacity: 0.5;
}

/* ===== HEADER ===== */
.chat-header {
  background: linear-gradient(135deg, #2c3e50, #1a252f);
  color: white;
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
  font-size: 16px;
  flex-shrink: 0;
}
.chat-close-btn {
  background: rgba(255,255,255,0.15);
  border: none;
  color: white;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0;
  line-height: 1;
  transition: background var(--chat-transition);
}
.chat-close-btn:hover,
.chat-close-btn:focus {
  background: rgba(255,255,255,0.25);
  outline: none;
}

/* ===== MESSAGES AREA ===== */
.chat-messages {
  flex: 1;
  padding: 20px;
  background: #fafafa;
  overflow-y: auto;
  font-size: 15px;
  line-height: 1.55;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
}
.chat-msg {
  margin-bottom: 14px;
  padding: 12px 16px;
  border-radius: 18px;
  max-width: 82%;
  line-height: 1.5;
  word-wrap: break-word;
}
.chat-msg.bot {
  background: #e9e9eb;
  color: #333;
  border-bottom-left-radius: 6px;
}
.chat-msg.user {
  background: #d4af37;
  color: white;
  margin-left: auto;
  border-bottom-right-radius: 6px;
}
.chat-msg a {
  color: #d4af37;
  text-decoration: underline;
}

/* ===== QUICK BUTTONS ===== */
.chat-quick {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.chat-quick a {
  padding: 8px 14px;
  background: #eef2ff;
  color: #2c3e50;
  border-radius: 20px;
  font-size: 13px;
  text-decoration: none;
  display: inline-block;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all var(--chat-transition);
}
.chat-quick a:hover,
.chat-quick a:focus {
  background: #d6deff;
  text-decoration: none;
  outline: none;
}
.chat-quick a.is-active {
  border-color: var(--chat-accent);
  background: #fff9e6;
  font-weight: 600;
}

/* ===== INPUT AREA ===== */
.chat-input-wrap {
  padding: 12px 14px;
  border-top: 1px solid #eee;
  display: flex;
  gap: 10px;
  flex-shrink: 0;
  background: white;
  width: 100%;
}
.chat-input-form {
  display: flex;
  flex: 1;
  gap: 10px;
  margin: 0;
  padding: 0;
  width: 100%;
}
.chat-input {
  flex: 1 1 auto;
  padding: 12px 16px;
  border: 1px solid #ddd;
  border-radius: 24px;
  outline: none;
  font-size: 16px;
  background: #fff;
  color: #333;
  min-width: 0;
  transition: border-color var(--chat-transition), box-shadow var(--chat-transition);
}
.chat-input:focus {
  border-color: #d4af37;
  box-shadow: 0 0 0 2px rgba(212,175,55,0.2);
}
.chat-submit {
  padding: 12px 18px;
  border: none;
  background: #d4af37;
  color: white;
  border-radius: 24px;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  flex: 0 0 auto;
  transition: background var(--chat-transition);
}
.chat-submit:hover,
.chat-submit:focus {
  background: #b8860b;
  outline: none;
}

/* ===== MOBILE RESPONSIVE ===== */
@media (max-width: 480px) {
  .chat-toggle-btn {
    bottom: 16px;
    right: 16px;
    width: 56px;
    height: 56px;
  }
  .chat-window {
    bottom: 88px;
    right: 12px;
    left: 12px;
    width: auto;
    max-width: none;
    height: calc(100vh - 110px);
    border-radius: 20px;
  }
  .chat-input { font-size: 16px; }
  .chat-submit {
    padding: 12px 16px;
    font-size: 13px;
  }
}

/* Prevent mobile auto-scaling */
@media (max-width: 480px) {
  .chatbot-wrap {
    -webkit-text-size-adjust: 100% !important;
    -moz-text-size-adjust: 100% !important;
    -ms-text-size-adjust: 100% !important;
  }
  .chat-toggle-btn,
  .chat-window {
    transform: none !important;
    zoom: 1 !important;
  }
}
