/**
 * Gatlinburg's Best Cabins - AI Chatbot Widget
 * A beautiful, modern chat interface that matches the site design
 */

/* CSS Variables for easy theming */
:root {
  --chat-primary: #2E5D34;          /* Forest green - matches site */
  --chat-primary-dark: #1e4024;     /* Darker green for hover */
  --chat-primary-light: #4a8b52;    /* Lighter green */
  --chat-gold: #B8860B;             /* Gold accent */
  --chat-white: #ffffff;
  --chat-bg: #FAFAF8;               /* Soft cream background */
  --chat-gray-light: #f5f5f5;
  --chat-gray: #e0e0e0;
  --chat-gray-dark: #666666;
  --chat-text: #1A1A1A;
  --chat-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
  --chat-shadow-hover: 0 12px 48px rgba(0, 0, 0, 0.2);
  --chat-radius: 20px;
  --chat-radius-sm: 12px;
  --chat-font: 'Nunito Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ============================================================================
   CHAT TOGGLE BUTTON
   ============================================================================ */
.chat-toggle {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--chat-primary) 0%, var(--chat-primary-dark) 100%);
  border: none;
  cursor: pointer;
  box-shadow: var(--chat-shadow);
  z-index: 9998;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  animation: chatPulse 3s ease-in-out infinite;
}

.chat-toggle:hover {
  transform: scale(1.1);
  box-shadow: var(--chat-shadow-hover);
  animation: none;
}

.chat-toggle:active {
  transform: scale(0.95);
}

.chat-toggle svg {
  width: 28px;
  height: 28px;
  color: var(--chat-white);
  transition: transform 0.3s ease;
}

.chat-toggle.active svg {
  transform: rotate(180deg);
}

/* Notification badge */
.chat-toggle__badge {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 24px;
  height: 24px;
  background: var(--chat-gold);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--chat-white);
  border: 2px solid var(--chat-white);
  animation: badgePop 0.3s ease;
}

@keyframes chatPulse {
  0%, 100% { box-shadow: var(--chat-shadow); }
  50% { box-shadow: 0 8px 32px rgba(46, 93, 52, 0.4); }
}

@keyframes badgePop {
  0% { transform: scale(0); }
  50% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

/* ============================================================================
   CHAT WINDOW
   ============================================================================ */
.chat-window {
  position: fixed;
  bottom: 100px;
  right: 24px;
  width: 400px;
  max-width: calc(100vw - 48px);
  height: 600px;
  max-height: calc(100vh - 140px);
  background: var(--chat-white);
  border-radius: var(--chat-radius);
  box-shadow: var(--chat-shadow-hover);
  display: flex;
  flex-direction: column;
  z-index: 9999;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px) scale(0.95);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.chat-window.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

/* ============================================================================
   CHAT HEADER
   ============================================================================ */
.chat-header {
  background: linear-gradient(135deg, var(--chat-primary) 0%, var(--chat-primary-dark) 100%);
  color: var(--chat-white);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.chat-header__avatar {
  width: 48px;
  height: 48px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}

.chat-header__info {
  flex: 1;
}

.chat-header__title {
  font-family: 'Josefin Sans', sans-serif;
  font-size: 18px;
  font-weight: 600;
  margin: 0;
  line-height: 1.2;
}

.chat-header__subtitle {
  font-size: 13px;
  opacity: 0.9;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.chat-header__status {
  width: 8px;
  height: 8px;
  background: #4ade80;
  border-radius: 50%;
  animation: statusPulse 2s ease-in-out infinite;
}

@keyframes statusPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.chat-header__close {
  background: rgba(255, 255, 255, 0.15);
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

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

.chat-header__close svg {
  width: 20px;
  height: 20px;
  color: var(--chat-white);
}

/* ============================================================================
   CHAT MESSAGES
   ============================================================================ */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: var(--chat-bg);
}

.chat-messages::-webkit-scrollbar {
  width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
  background: var(--chat-gray);
  border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
  background: var(--chat-gray-dark);
}

/* Message bubbles */
.chat-message {
  display: flex;
  gap: 10px;
  max-width: 85%;
  animation: messageSlide 0.3s ease;
}

@keyframes messageSlide {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.chat-message--user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.chat-message--bot {
  align-self: flex-start;
}

.chat-message__avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--chat-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 14px;
}

.chat-message--user .chat-message__avatar {
  background: var(--chat-gold);
}

.chat-message__content {
  padding: 12px 16px;
  border-radius: var(--chat-radius-sm);
  font-family: var(--chat-font);
  font-size: 14px;
  line-height: 1.5;
}

.chat-message--bot .chat-message__content {
  background: var(--chat-white);
  color: var(--chat-text);
  border-bottom-left-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.chat-message--user .chat-message__content {
  background: var(--chat-primary);
  color: var(--chat-white);
  border-bottom-right-radius: 4px;
}

/* Message formatting */
.chat-message__content p {
  margin: 0 0 10px;
}

.chat-message__content p:last-child {
  margin-bottom: 0;
}

.chat-message__content strong {
  font-weight: 600;
  color: var(--chat-primary);
}

.chat-message--user .chat-message__content strong {
  color: var(--chat-white);
}

.chat-message__content ul,
.chat-message__content ol {
  margin: 10px 0;
  padding-left: 20px;
}

.chat-message__content li {
  margin-bottom: 6px;
}

.chat-message__content a {
  color: var(--chat-primary);
  text-decoration: underline;
}

.chat-message--user .chat-message__content a {
  color: var(--chat-white);
}

/* Typing indicator */
.chat-typing {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--chat-white);
  border-radius: var(--chat-radius-sm);
  border-bottom-left-radius: 4px;
  max-width: 80px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.chat-typing__dots {
  display: flex;
  gap: 4px;
}

.chat-typing__dot {
  width: 8px;
  height: 8px;
  background: var(--chat-gray);
  border-radius: 50%;
  animation: typingBounce 1.4s ease-in-out infinite;
}

.chat-typing__dot:nth-child(2) {
  animation-delay: 0.2s;
}

.chat-typing__dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typingBounce {
  0%, 60%, 100% {
    transform: translateY(0);
    background: var(--chat-gray);
  }
  30% {
    transform: translateY(-8px);
    background: var(--chat-primary);
  }
}

/* ============================================================================
   QUICK ACTIONS (Suggestion chips)
   ============================================================================ */
.chat-quick-actions {
  padding: 12px 20px;
  background: var(--chat-white);
  border-top: 1px solid var(--chat-gray-light);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chat-quick-action {
  padding: 8px 14px;
  background: var(--chat-bg);
  border: 1px solid var(--chat-gray);
  border-radius: 20px;
  font-family: var(--chat-font);
  font-size: 13px;
  color: var(--chat-text);
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.chat-quick-action:hover {
  background: var(--chat-primary);
  color: var(--chat-white);
  border-color: var(--chat-primary);
}

/* ============================================================================
   CHAT INPUT
   ============================================================================ */
.chat-input-container {
  padding: 16px 20px;
  background: var(--chat-white);
  border-top: 1px solid var(--chat-gray-light);
  display: flex;
  gap: 12px;
  align-items: flex-end;
}

.chat-input {
  flex: 1;
  min-height: 44px;
  max-height: 120px;
  padding: 12px 16px;
  background: var(--chat-bg);
  border: 1px solid var(--chat-gray);
  border-radius: var(--chat-radius-sm);
  font-family: var(--chat-font);
  font-size: 14px;
  color: var(--chat-text);
  resize: none;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.chat-input:focus {
  border-color: var(--chat-primary);
  box-shadow: 0 0 0 3px rgba(46, 93, 52, 0.1);
}

.chat-input::placeholder {
  color: var(--chat-gray-dark);
}

.chat-send {
  width: 44px;
  height: 44px;
  background: var(--chat-primary);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}

.chat-send:hover:not(:disabled) {
  background: var(--chat-primary-dark);
  transform: scale(1.05);
}

.chat-send:disabled {
  background: var(--chat-gray);
  cursor: not-allowed;
}

.chat-send svg {
  width: 20px;
  height: 20px;
  color: var(--chat-white);
}

/* ============================================================================
   WELCOME MESSAGE
   ============================================================================ */
.chat-welcome {
  text-align: center;
  padding: 20px;
}

.chat-welcome__icon {
  font-size: 48px;
  margin-bottom: 12px;
}

.chat-welcome__title {
  font-family: 'Josefin Sans', sans-serif;
  font-size: 20px;
  font-weight: 600;
  color: var(--chat-text);
  margin: 0 0 8px;
}

.chat-welcome__text {
  font-size: 14px;
  color: var(--chat-gray-dark);
  margin: 0 0 20px;
  line-height: 1.5;
}

/* ============================================================================
   MOBILE RESPONSIVE
   ============================================================================ */
@media (max-width: 480px) {
  .chat-toggle {
    bottom: 16px;
    right: 16px;
    width: 56px;
    height: 56px;
  }
  
  .chat-toggle svg {
    width: 24px;
    height: 24px;
  }
  
  .chat-window {
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
    max-width: 100%;
    height: calc(100vh - 20px);
    max-height: calc(100vh - 20px);
    border-radius: var(--chat-radius) var(--chat-radius) 0 0;
  }
  
  .chat-window.open {
    transform: translateY(0);
  }
  
  .chat-header {
    padding: 16px;
  }
  
  .chat-messages {
    padding: 16px;
  }
  
  .chat-message {
    max-width: 90%;
  }
  
  .chat-quick-actions {
    padding: 10px 16px;
  }
  
  .chat-input-container {
    padding: 12px 16px;
    padding-bottom: max(12px, env(safe-area-inset-bottom));
  }
}

/* ============================================================================
   DARK MODE SUPPORT (optional)
   ============================================================================ */
@media (prefers-color-scheme: dark) {
  /* Keeping light mode for chat to maintain branding consistency */
}

/* ============================================================================
   ANIMATIONS & TRANSITIONS
   ============================================================================ */
.chat-fade-in {
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Print styles - hide chatbot */
@media print {
  .chat-toggle,
  .chat-window {
    display: none !important;
  }
}




