/* CSS Custom Properties for Dynamic Theming */
:root {
  /* Primary Colors - Main brand colors */
  --primary-100: #14b8a6;
  --primary-200: #0891b2;
  --primary-300: #0e7490;
  --primary-400: #075985;
  
  /* Secondary Colors - Accent colors */
  --secondary-100: #f97316;
  --secondary-200: #ea580c;
  
  /* Success/Money Colors - Green variants */
  --success-100: #10b981;
  --success-200: #059669;
  --success-300: #047857;
  
  /* Background Colors */
  --bg-primary: #ffffff;
  --bg-secondary: #f8fafc;
  --bg-tertiary: #fafbfc;
  
  /* Text Colors */
  --text-primary: #1f2937;
  --text-secondary: #374151;
  --text-tertiary: #6b7280;
  --text-light: #9ca3af;
  --text-white: #ffffff;
  
  /* Status Colors */
  --error-100: #ef4444;
  --error-200: #dc2626;
  --error-300: #b91c1c;
  --warning-100: #f59e0b;
  --warning-200: #d97706;
  
  /* Social/External Colors */
  --whatsapp-100: #25d366;
  --whatsapp-200: #128c7e;
  
  /* Utility Colors */
  --border-light: #e5e7eb;
  --border-medium: #d1d5db;
  --shadow-light: rgba(0, 0, 0, 0.1);
  --shadow-medium: rgba(0, 0, 0, 0.15);
  --shadow-dark: rgba(0, 0, 0, 0.25);
  
  /* Primary gradients */
  --gradient-primary: linear-gradient(135deg, var(--primary-100) 0%, var(--primary-200) 100%);
  --gradient-secondary: linear-gradient(135deg, var(--secondary-100) 0%, var(--secondary-200) 100%);
  --gradient-success: linear-gradient(135deg, var(--success-100) 0%, var(--success-200) 100%);
  --gradient-background: linear-gradient(135deg, var(--primary-100) 0%, var(--primary-200) 35%, var(--primary-300) 70%, var(--primary-400) 100%);
}

/* Theme 1: Professional Blue/Purple */
.theme-1 {
  /* Primary Colors - Professional Blue/Purple gradient */
  --primary-100: #1e40af;
  --primary-200: #7c3aed;
  --primary-300: #6366f1;
  --primary-400: #4f46e5;
  
  /* Secondary Colors - Gold/Amber accents */
  --secondary-100: #f59e0b;
  --secondary-200: #d97706;
  
  /* Success/Money Colors - Bright Blue variants */
  --success-100: #3b82f6;
  --success-200: #2563eb;
  --success-300: #1d4ed8;
  
  /* Status Colors - Professional variants */
  --error-100: #ef4444;
  --error-200: #dc2626;
  --error-300: #b91c1c;
  --warning-100: #f59e0b;
  --warning-200: #d97706;
  
  /* Social/External Colors remain consistent */
  --whatsapp-100: #25d366;
  --whatsapp-200: #128c7e;
  
  /* Updated gradients for theme */
  --gradient-primary: linear-gradient(135deg, var(--primary-100) 0%, var(--primary-200) 100%);
  --gradient-secondary: linear-gradient(135deg, var(--secondary-100) 0%, var(--secondary-200) 100%);
  --gradient-success: linear-gradient(135deg, var(--success-100) 0%, var(--success-200) 100%);
  --gradient-background: linear-gradient(135deg, var(--primary-100) 0%, var(--primary-200) 35%, var(--primary-300) 70%, var(--primary-400) 100%);
}

/* Theme 1: Enhanced text contrast for reCAPTCHA instructions */
.theme-1 .recaptcha-label {
  color: #ffffff;
  font-weight: 600;
}

.theme-1 .recaptcha-instruction {
  color: #ffffff;
  font-weight: 500;
}

/* Theme 2: Warm Sunset Orange/Red */
.theme-2 {
  /* Primary Colors - Warm Orange to Red gradient */
  --primary-100: #ea580c;
  --primary-200: #dc2626;
  --primary-300: #b91c1c;
  --primary-400: #991b1b;
  
  /* Secondary Colors - Golden Yellow accents */
  --secondary-100: #eab308;
  --secondary-200: #ca8a04;
  
  /* Success/Money Colors - Warm Orange variants */
  --success-100: #f97316;
  --success-200: #ea580c;
  --success-300: #c2410c;
  
  /* Status Colors - Warm variants */
  --error-100: #ef4444;
  --error-200: #dc2626;
  --error-300: #b91c1c;
  --warning-100: #fbbf24;
  --warning-200: #f59e0b;
  
  /* Social/External Colors remain consistent */
  --whatsapp-100: #25d366;
  --whatsapp-200: #128c7e;
  
  /* Updated gradients for theme */
  --gradient-primary: linear-gradient(135deg, var(--primary-100) 0%, var(--primary-200) 100%);
  --gradient-secondary: linear-gradient(135deg, var(--secondary-100) 0%, var(--secondary-200) 100%);
  --gradient-success: linear-gradient(135deg, var(--success-100) 0%, var(--success-200) 100%);
  --gradient-background: linear-gradient(135deg, var(--primary-100) 0%, var(--primary-200) 35%, var(--primary-300) 70%, var(--primary-400) 100%);
}

/* Theme 2: Enhanced text contrast for reCAPTCHA instructions */
.theme-2 .recaptcha-label {
  color: #1f2937;
  font-weight: 600;
}

.theme-2 .recaptcha-instruction {
  color: #374151;
  font-weight: 500;
}

/* Theme 3: Forest Nature Green */
.theme-3 {
  /* Primary Colors - Forest Green to Emerald gradient */
  --primary-100: #166534;
  --primary-200: #059669;
  --primary-300: #047857;
  --primary-400: #065f46;
  
  /* Secondary Colors - Lime Green accents */
  --secondary-100: #84cc16;
  --secondary-200: #65a30d;
  
  /* Success/Money Colors - Bright Green variants */
  --success-100: #22c55e;
  --success-200: #16a34a;
  --success-300: #15803d;
  
  /* Status Colors - Natural variants */
  --error-100: #ef4444;
  --error-200: #dc2626;
  --error-300: #b91c1c;
  --warning-100: #fbbf24;
  --warning-200: #f59e0b;
  
  /* Social/External Colors - Enhanced for nature theme */
  --whatsapp-100: #25d366;
  --whatsapp-200: #128c7e;
  
  /* Updated gradients for theme */
  --gradient-primary: linear-gradient(135deg, var(--primary-100) 0%, var(--primary-200) 100%);
  --gradient-secondary: linear-gradient(135deg, var(--secondary-100) 0%, var(--secondary-200) 100%);
  --gradient-success: linear-gradient(135deg, var(--success-100) 0%, var(--success-200) 100%);
  --gradient-background: linear-gradient(135deg, var(--primary-100) 0%, var(--primary-200) 35%, var(--primary-300) 70%, var(--primary-400) 100%);
}

/* Theme 3: Enhanced text contrast for reCAPTCHA instructions */
.theme-3 .recaptcha-label {
  color: #1f2937;
  font-weight: 600;
}

.theme-3 .recaptcha-instruction {
  color: #374151;
  font-weight: 500;
}

* {
  font-family: "Poppins", -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  box-sizing: border-box;
}

body {
  background: var(--gradient-background);
  background-attachment: fixed;
  background-size: 400% 400%;
  animation: gradientShift 8s ease infinite;
  min-height: 100vh;
  min-height: 100dvh; /* 动态视口高度 */
  height: 100vh;
  height: 100dvh; /* 动态视口高度 */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  margin: 0;
  overflow: hidden;
}

@keyframes gradientShift {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

.chat-container {
  width: 100%;
  height: 100vh;
  height: 100dvh; /* 动态视口高度 */
  display: flex;
  flex-direction: column;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(30px) saturate(1.5);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.2);
  position: relative;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.chat-header {
  padding: 20px 24px 16px;
  background: var(--gradient-primary);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  flex-shrink: 0;
  position: relative;
  z-index: 10;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.header-content {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-container {
  flex-shrink: 0;
  position: relative;
}

.logo-icon {
  width: 36px;
  height: 36px;
  color: var(--text-white);
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
  transition: transform 0.2s ease;
  border-radius: 30px;
  object-fit: contain;
}

.logo-icon:hover {
  transform: scale(1.05);
}

.online-indicator {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 12px;
  height: 12px;
  background: var(--success-100);
  border: 2px solid var(--text-white);
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  }
  70% {
    box-shadow: 0 0 0 6px rgba(16, 185, 129, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
  }
}

.title-container {
  flex: 1;
  text-align: left;
}

.chat-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-white);
  margin: 0;
  line-height: 1.2;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  letter-spacing: -0.5px;
}

/* Money Counter Styles */
.money-counter {
  display: flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, var(--success-100) 0%, var(--success-200) 50%, var(--success-300) 100%);
  padding: 8px 12px;
  border-radius: 20px;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
  border: 2px solid rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
  transition: all 0.3s ease;
}

.money-counter:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(16, 185, 129, 0.4);
}

.money-icon {
  font-size: 16px;
  animation: coinBounce 2s infinite;
}

.money-amount {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-white);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  letter-spacing: 0.5px;
  transition: all 0.3s ease;
  min-width: 45px;
  text-align: center;
}

.money-amount.money-updating {
  transform: scale(1.1);
  animation: pulse 0.6s ease-in-out;
}

.money-amount.money-updated {
  animation: moneySuccess 1s ease-in-out;
}

@keyframes coinBounce {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-4px);
  }
}

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

@keyframes moneySuccess {
  0% {
    transform: scale(1);
  }
  25% {
    transform: scale(1.15);
    color: var(--success-100);
  }
  75% {
    transform: scale(1.05);
    color: var(--success-100);
  }
  100% {
    transform: scale(1);
    color: var(--text-white);
  }
}
}

/* Mobile responsive */
@media (max-width: 480px) {
  .money-counter {
    padding: 6px 10px;
    gap: 6px;
  }

  .money-icon {
    font-size: 14px;
  }

  .money-amount {
    font-size: 12px;
    min-width: 40px;
  }
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 24px;
  background: linear-gradient(180deg, var(--bg-primary) 0%, var(--bg-tertiary) 100%);
  scroll-behavior: smooth;
  display: flex;
  flex-direction: column;
  min-height: 0; /* 重要：允许flex子项收缩 */
  position: relative;
}

.chat-messages::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 20px;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 1) 0%,
    rgba(255, 255, 255, 0) 100%
  );
  pointer-events: none;
  z-index: 1;
}

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

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

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

.bot-message-container {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  max-width: 85%;
  margin: 12px 0;
}

.bot-message-gif {
  max-width: 200px;
  max-height: 150px;
  width: auto;
  height: auto;
  border-radius: 12px;
  margin-bottom: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  animation: fadeInUp 0.3s ease-out;
  object-fit: cover;
}

.bot-message,
.user-message {
  padding: 16px 20px;
  margin: 0; /* Remove margin since container handles spacing */
  border-radius: 20px;
  line-height: 1.6;
  font-size: 15px;
  font-weight: 500;
  animation: fadeInUp 0.3s ease-out;
  word-wrap: break-word;
  max-width: 100%; /* Use full container width */
  position: relative;
  backdrop-filter: blur(10px);
}

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

.bot-message {
  background: var(--gradient-primary);
  color: var(--text-white);
  align-self: flex-start;
  border-bottom-left-radius: 8px;
  box-shadow: 0 4px 20px rgba(20, 184, 166, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.bot-message::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.1) 0%,
    rgba(255, 255, 255, 0.05) 100%
  );
  border-radius: inherit;
  pointer-events: none;
}

.user-message {
  background: var(--gradient-secondary);
  color: var(--text-white);
  align-self: flex-end;
  border-bottom-right-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  width: auto;
  max-width: 85%;
  display: inline-block;
  box-shadow: 0 4px 20px rgba(249, 115, 22, 0.4);
}

.user-message::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.1) 0%,
    rgba(255, 255, 255, 0.05) 100%
  );
  border-radius: inherit;
  pointer-events: none;
}

.options-container {
  padding: 20px 24px 24px;
  background: linear-gradient(180deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
  border-top: 1px solid rgba(0, 0, 0, 0.03);
  flex-shrink: 0;
  position: relative;
  z-index: 10;
  display: none; /* Hide the bottom options container */
  backdrop-filter: blur(10px);
}

.bottom-action-container {
  padding: 20px 24px;
  padding-bottom: max(env(safe-area-inset-bottom), 24px);
  background: linear-gradient(180deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
  border-top: 1px solid rgba(0, 0, 0, 0.03);
  flex-shrink: 0;
  position: relative;
  z-index: 10;
  backdrop-filter: blur(10px);
}

.apply-now-button {
  width: 100%;
  padding: 18px 24px;
  background: var(--gradient-success);
  color: var(--text-white);
  border: none;
  border-radius: 14px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  position: relative;
  overflow: hidden;
  letter-spacing: 0.5px;
}

.apply-now-button::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.2),
    transparent
  );
  transition: left 0.5s;
}

.apply-now-button:hover::before {
  left: 100%;
}

.apply-now-button:hover {
  background: linear-gradient(135deg, var(--success-200) 0%, var(--success-300) 100%);
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 8px 25px rgba(16, 185, 129, 0.6);
}

.apply-now-button:active {
  transform: translateY(0) scale(0.98);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.5);
}

.whatsapp-icon {
  width: 20px;
  height: 20px;
  fill: currentColor;
  flex-shrink: 0;
}

.inline-options-container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
  padding: 0;
  align-self: flex-start;
  max-width: 85%;
}

.inline-option-button {
  padding: 12px 18px;
  background: transparent;
  color: var(--primary-100);
  border: 2px solid var(--primary-100);
  border-radius: 20px;
  text-align: center;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  white-space: nowrap;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: fit-content;
  box-shadow: 0 2px 8px rgba(20, 184, 166, 0.1);
  line-height: 1.3;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  backdrop-filter: blur(10px);
  letter-spacing: 0.25px;
}

.inline-option-button::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 0;
  height: 100%;
  background: var(--gradient-primary);
  transition: width 0.3s ease;
  z-index: -1;
}

.inline-option-button:hover {
  color: var(--text-white);
  border-color: var(--primary-100);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(20, 184, 166, 0.3);
}

.inline-option-button:hover::before {
  width: 100%;
}

.inline-option-button:active {
  transform: translateY(0) scale(0.95);
  box-shadow: 0 2px 8px rgba(20, 184, 166, 0.4);
}

.whatsapp-option-button {
  background: transparent;
  color: var(--primary-100);
  border: 2px solid var(--primary-100);
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(20, 184, 166, 0.1);
  backdrop-filter: blur(10px);
  position: relative;
  overflow: hidden;
}

.whatsapp-option-button::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 0;
  height: 100%;
  background: var(--gradient-primary);
  transition: width 0.3s ease;
  z-index: -1;
}

.whatsapp-option-button:hover {
  color: var(--text-white);
  border-color: var(--primary-100);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(20, 184, 166, 0.3);
}

.whatsapp-option-button:hover::before {
  width: 100%;
}

.whatsapp-option-button:active {
  transform: translateY(0) scale(0.95);
  box-shadow: 0 2px 8px rgba(20, 184, 166, 0.4);
}

.landing-page-option-button {
  background: transparent;
  color: var(--secondary-100);
  border: 2px solid var(--secondary-100);
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(249, 115, 22, 0.1);
  backdrop-filter: blur(10px);
  position: relative;
  overflow: hidden;
}

.landing-page-option-button::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 0;
  height: 100%;
  background: var(--gradient-secondary);
  transition: width 0.3s ease;
  z-index: -1;
}

.landing-page-option-button:hover {
  color: var(--text-white);
  border-color: var(--secondary-100);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(249, 115, 22, 0.3);
}

.landing-page-option-button:hover::before {
  width: 100%;
}

.landing-page-option-button:active {
  transform: translateY(0) scale(0.95);
  box-shadow: 0 2px 8px rgba(249, 115, 22, 0.4);
}

.typing-indicator {
  display: flex;
  align-items: center;
  padding: 16px 20px;
  margin: 12px 0;
  max-width: 85%;
  background: var(--bg-secondary);
  border-radius: 20px;
  border-bottom-left-radius: 8px;
  align-self: flex-start;
}

.typing-dots {
  display: flex;
  gap: 4px;
}

.typing-dot {
  width: 8px;
  height: 8px;
  background: var(--text-light);
  border-radius: 50%;
  animation: typing 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(1) {
  animation-delay: -0.32s;
}
.typing-dot:nth-child(2) {
  animation-delay: -0.16s;
}

@keyframes typing {
  0%,
  80%,
  100% {
    transform: scale(0.8);
    opacity: 0.5;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

/* 桌面端样式 */
@media (min-width: 769px) {
  body {
    padding: 24px;
  }

  .chat-container {
    width: 100%;
    max-width: 440px;
    height: 85vh;
    height: 85dvh;
    max-height: 720px;
    border-radius: 28px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.15),
      0 8px 32px rgba(20, 184, 166, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
  }

  .chat-header {
    padding: 24px 28px 20px;
    border-radius: 28px 28px 0 0;
  }

  .chat-messages {
    padding: 28px;
  }

  .bottom-action-container {
    padding: 24px 28px;
    border-radius: 0 0 28px 28px;
  }

  .options-container {
    padding: 24px 28px;
  }

  .logo-icon {
    width: 40px;
    height: 40px;
  }

  .chat-title {
    font-size: 22px;
  }
}

/* 移动端样式 */
@media (max-width: 768px) {
  body {
    padding: 0;
    overflow: hidden;
  }

  .chat-container {
    height: 100vh;
    height: 100dvh; /* 动态视口高度 */
    border-radius: 0;
    box-shadow: none;
    border: none;
  }

  .chat-header {
    padding: env(safe-area-inset-top, 18px) 18px 14px;
    padding-top: max(env(safe-area-inset-top), 18px);
  }

  .logo-icon {
    width: 32px;
    height: 32px;
  }

  .online-indicator {
    width: 10px;
    height: 10px;
    bottom: -1px;
    right: -1px;
    border-width: 1.5px;
  }

  .chat-title {
    font-size: 18px;
  }

  .chat-messages {
    padding: 20px;
    flex: 1;
    min-height: 0;
  }

  .options-container {
    display: none; /* Keep hidden on mobile */
  }

  .bottom-action-container {
    padding: 16px 20px;
    padding-bottom: max(env(safe-area-inset-bottom), 20px);
  }

  .apply-now-button {
    padding: 16px 24px;
    font-size: 16px;
    border-radius: 12px;
    gap: 10px;
  }

  .whatsapp-icon {
    width: 18px;
    height: 18px;
  }

  .inline-options-container {
    gap: 6px;
    margin: 10px 0;
  }

  .inline-option-button {
    padding: 8px 14px;
    font-size: 12px;
    border-radius: 16px;
  }

  .bot-message,
  .user-message {
    padding: 12px 16px;
    margin: 8px 0;
    font-size: 13px;
  }

  .bot-message-container {
    margin: 8px 0;
  }

  .bot-message-gif {
    max-width: 140px;
    max-height: 100px;
    border-radius: 8px;
    margin-bottom: 4px;
  }
}

/* 针对iOS Safari的特殊处理 */
@supports (-webkit-touch-callout: none) {
  .chat-container {
    height: -webkit-fill-available;
  }
}

/* 针对非常小的屏幕 */
@media (max-height: 600px) {
  .chat-header {
    padding: 12px 16px 8px;
  }

  .logo-icon {
    width: 24px;
    height: 24px;
  }

  .online-indicator {
    width: 8px;
    height: 8px;
    bottom: 0;
    right: 0;
    border-width: 1px;
  }

  .chat-title {
    font-size: 14px;
  }

  .chat-messages {
    padding: 12px 16px;
  }

  .options-container {
    display: none; /* Keep hidden on small screens */
  }

  .bottom-action-container {
    padding: 8px 16px;
    padding-bottom: max(env(safe-area-inset-bottom), 12px);
  }

  .apply-now-button {
    padding: 12px 18px;
    font-size: 14px;
    border-radius: 8px;
    gap: 6px;
  }

  .whatsapp-icon {
    width: 16px;
    height: 16px;
  }

  .inline-options-container {
    gap: 4px;
    margin: 8px 0;
  }

  .inline-option-button {
    padding: 6px 12px;
    font-size: 11px;
    border-radius: 14px;
  }

  .bot-message,
  .user-message {
    padding: 12px 16px;
    margin: 8px 0;
    font-size: 13px;
  }
}

/* 表单样式 */
.form-container {
  background: var(--gradient-primary);
  border-radius: 16px;
  padding: 20px;
  margin: 16px 0;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
  animation: fadeInUp 0.6s ease-out;
}

.form-title {
  color: var(--text-white);
  font-size: 18px;
  font-weight: 600;
  margin: 0 0 20px 0;
  text-align: center;
}

.registration-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group label {
  color: var(--text-white);
  font-size: 14px;
  font-weight: 500;
}

.form-group input {
  padding: 12px 16px;
  border: none;
  border-radius: 12px;
  font-size: 14px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--text-primary);
  transition: all 0.3s ease;
}

.form-group input:focus {
  outline: none;
  background: var(--bg-primary);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.3);
}

.form-group input::placeholder {
  color: var(--text-light);
}

.form-button-group {
  display: flex;
  gap: 12px;
  margin-top: 8px;
  width: 100%;
}

.form-submit-button {
  padding: 12px 20px;
  border: none;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  width: 100%;
  flex: 1;
}

.form-cancel-button {
  flex: 1;
  padding: 12px 20px;
  border: none;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.form-submit-button {
  background: var(--success-100);
  color: var(--text-white);
}

.form-submit-button:hover:not(:disabled) {
  background: var(--success-200);
  transform: translateY(-1px);
}

.form-submit-button:disabled {
  background: var(--text-light);
  cursor: not-allowed;
  transform: none;
}

.form-cancel-button {
  background: rgba(255, 255, 255, 0.2);
  color: var(--text-white);
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.form-cancel-button:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-1px);
}

.form-error-message {
  background: var(--error-100);
  color: var(--text-white);
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 16px;
  animation: shake 0.5s ease-in-out;
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-5px);
  }
  75% {
    transform: translateX(5px);
  }
}

/* 移动端表单样式调整 */
@media (max-width: 768px) {
  .form-container {
    padding: 16px;
    margin: 12px 0;
    border-radius: 12px;
  }

  .form-title {
    font-size: 16px;
    margin-bottom: 16px;
  }

  .form-group input {
    padding: 14px 16px;
    font-size: 16px; /* 防止iOS缩放 */
  }

  .form-button-group {
    width: 100%;
    gap: 8px;
  }

  .form-submit-button {
    padding: 14px 20px;
    font-size: 15px;
    width: 100%;
  }

  .form-cancel-button {
    padding: 14px 20px;
    font-size: 15px;
  }

  .form-error-message {
    font-size: 12px;
    padding: 10px 14px;
  }
}

/* 小屏幕表单样式 */
@media (max-height: 600px) {
  .form-container {
    padding: 12px;
    margin: 8px 0;
  }

  .form-title {
    font-size: 15px;
    margin-bottom: 12px;
  }

  .registration-form {
    gap: 12px;
  }

  .form-group {
    gap: 6px;
  }

  .form-group input {
    padding: 10px 14px;
    font-size: 14px;
  }

  .form-submit-button {
    padding: 10px 20px;
    font-size: 13px;
    width: 100%;
  }

  .form-cancel-button {
    padding: 10px 16px;
    font-size: 13px;
  }
}

/* Toast Notification System */
.toast-container {
  position: fixed;
  top: 80px;
  right: 20px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  border-radius: 16px;
  padding: 16px 20px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.2);
  min-width: 280px;
  max-width: 400px;
  transform: translateX(100%);
  opacity: 0;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: auto;
}

.toast-success {
  border-left: 4px solid var(--success-100);
  background: linear-gradient(
    135deg,
    rgba(16, 185, 129, 0.1) 0%,
    rgba(255, 255, 255, 0.95) 100%
  );
}

.toast-error {
  border-left: 4px solid var(--error-100);
  background: linear-gradient(
    135deg,
    rgba(239, 68, 68, 0.1) 0%,
    rgba(255, 255, 255, 0.95) 100%
  );
}

.toast-show {
  transform: translateX(0);
  opacity: 1;
}

.toast-hide {
  transform: translateX(100%);
  opacity: 0;
}

.toast-icon {
  font-size: 20px;
  flex-shrink: 0;
  animation: toastIconPop 0.5s ease-out;
}

.toast-message {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.4;
  flex: 1;
}

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

/* Mobile responsiveness for toast */
@media (max-width: 480px) {
  .toast-container {
    right: 16px;
    left: 16px;
    top: 70px;
  }

  .toast {
    min-width: unset;
    max-width: unset;
    padding: 14px 16px;
    gap: 10px;
  }

  .toast-icon {
    font-size: 18px;
  }

  .toast-message {
    font-size: 13px;
  }
}

/* Modal Popup and Countdown Timer */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20000;
  opacity: 0;
  transition: opacity 0.3s ease;
  padding: 20px;
}

.modal-overlay.modal-show {
  opacity: 1;
}

.modal-content {
  background: linear-gradient(145deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
  border-radius: 24px;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.1);
  max-width: 420px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(0.9) translateY(20px);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  animation: modalSlideIn 0.5s ease-out forwards;
}

.modal-show .modal-content {
  transform: scale(1) translateY(0);
}

.modal-header {
  text-align: center;
  padding: 24px 28px 20px;
  border-bottom: 1px solid rgba(226, 232, 240, 0.5);
  position: relative;
}

.modal-close-button {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  background: rgba(107, 114, 128, 0.1);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  color: var(--text-tertiary);
}

.modal-close-button:hover {
  background: rgba(107, 114, 128, 0.2);
  color: var(--text-secondary);
  transform: scale(1.05);
}

.modal-close-button:active {
  transform: scale(0.95);
}

.modal-close-button svg {
  width: 16px;
  height: 16px;
}

.celebration-icon {
  font-size: 40px;
  margin-bottom: 12px;
  animation: celebrationBounce 1s infinite;
}

.modal-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
  background: var(--gradient-success);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1.2;
}

.modal-body {
  padding: 24px 28px;
  text-align: center;
}

.earnings-display {
  background: linear-gradient(135deg, var(--warning-100) 0%, var(--warning-200) 100%);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 6px 16px rgba(251, 191, 36, 0.3);
}

.earnings-label {
  font-size: 13px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.9);
  margin-bottom: 6px;
}

.earnings-amount {
  font-size: 30px;
  font-weight: 900;
  color: var(--text-white);
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  animation: moneyPulse 2s infinite;
}

.urgency-message {
  font-size: 15px;
  font-weight: 700;
  color: var(--error-200);
  margin-bottom: 16px;
  line-height: 1.3;
  animation: urgencyGlow 1.5s infinite;
}

.offer-benefits {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 20px;
  text-align: left;
  background: rgba(16, 185, 129, 0.1);
  padding: 14px;
  border-radius: 10px;
  border-left: 3px solid var(--success-100);
}

.countdown-container {
  background: linear-gradient(135deg, var(--error-200) 0%, var(--error-300) 100%);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 24px;
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3);
}

.countdown-label {
  font-size: 11px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.9);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.countdown-timer {
  font-size: 28px;
  font-weight: 900;
  color: var(--text-white);
  font-family: "Courier New", monospace;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  animation: countdownPulse 1s infinite;
}

.countdown-timer.countdown-urgent {
  animation: countdownUrgent 0.5s infinite;
  color: var(--warning-100);
}

.countdown-timer.countdown-expired {
  animation: countdownExpired 1s infinite;
  color: var(--error-100);
}

.modal-actions {
  padding: 0 28px 28px;
  text-align: center;
}

.modal-whatsapp-button {
  width: 100%;
  background: linear-gradient(135deg, var(--whatsapp-100) 0%, var(--whatsapp-200) 100%);
  color: var(--text-white);
  border: none;
  border-radius: 14px;
  padding: 16px 28px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 4px 16px rgba(37, 211, 102, 0.4);
  animation: ctaPulse 2s infinite;
  margin-bottom: 12px;
}

.reply-instruction {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-tertiary);
  margin-top: 8px;
  font-style: italic;
  opacity: 0.9;
}

.modal-whatsapp-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(37, 211, 102, 0.5);
}

.modal-whatsapp-button:active {
  transform: translateY(0);
}

.modal-whatsapp-button .whatsapp-icon {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

/* Animations */
@keyframes modalSlideIn {
  0% {
    transform: scale(0.8) translateY(50px);
    opacity: 0;
  }
  100% {
    transform: scale(1) translateY(0);
    opacity: 1;
  }
}

@keyframes celebrationBounce {
  0%,
  100% {
    transform: scale(1) rotate(0deg);
  }
  25% {
    transform: scale(1.1) rotate(-5deg);
  }
  75% {
    transform: scale(1.1) rotate(5deg);
  }
}

@keyframes moneyPulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

@keyframes urgencyGlow {
  0%,
  100% {
    text-shadow: 0 0 5px rgba(220, 38, 38, 0.5);
  }
  50% {
    text-shadow: 0 0 15px rgba(220, 38, 38, 0.8);
  }
}

@keyframes countdownPulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.02);
  }
}

@keyframes countdownUrgent {
  0%,
  100% {
    transform: scale(1);
    color: var(--warning-100);
  }
  50% {
    transform: scale(1.05);
    color: var(--warning-200);
  }
}
}

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

@keyframes ctaPulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.02);
  }
}

/* Mobile responsiveness for modal */
@media (max-width: 480px) {
  .modal-content {
    margin: 10px;
    border-radius: 16px;
    max-width: calc(100vw - 20px);
  }

  .modal-header {
    padding: 20px 20px 16px;
  }

  .modal-close-button {
    top: 12px;
    right: 12px;
    width: 28px;
    height: 28px;
  }

  .modal-close-button svg {
    width: 14px;
    height: 14px;
  }

  .celebration-icon {
    font-size: 36px;
    margin-bottom: 10px;
  }

  .modal-title {
    font-size: 18px;
  }

  .modal-body {
    padding: 20px;
    padding-bottom: 0px;
  }

  .earnings-display {
    padding: 16px;
    margin-bottom: 16px;
  }

  .earnings-amount {
    font-size: 26px;
  }

  .urgency-message {
    font-size: 14px;
    margin-bottom: 14px;
  }

  .offer-benefits {
    font-size: 12px;
    padding: 12px;
    margin-bottom: 16px;
  }

  .countdown-container {
    padding: 14px;
    margin-bottom: 20px;
  }

  .countdown-timer {
    font-size: 24px;
  }

  .modal-actions {
    padding: 0 20px 20px;
  }

  .modal-whatsapp-button {
    padding: 14px 20px;
    font-size: 14px;
    gap: 8px;
    margin-bottom: 10px;
  }

  .reply-instruction {
    font-size: 11px;
  }
}

/* reCAPTCHA Input System and Sponsor Logos */
.recaptcha-input-container {
  margin: 20px 0;
  padding: 0;
}

.recaptcha-input-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: linear-gradient(145deg, #ffffff 0%, #f8fafc 100%);
  padding: 24px;
  border-radius: 20px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
  border: 2px solid rgba(20, 184, 166, 0.2);
  animation: inputFormSlideIn 0.5s ease-out;
}

.recaptcha-input-field {
  width: 100%;
  padding: 16px 20px;
  font-size: 16px;
  font-weight: 500;
  border: 2px solid var(--border-light);
  border-radius: 12px;
  background: var(--bg-primary);
  color: var(--text-primary);
  transition: all 0.3s ease;
  text-align: center;
  letter-spacing: 2px;
  font-family: "Courier New", monospace;
  text-transform: uppercase;
}

.recaptcha-input-field:focus {
  outline: none;
  border-color: var(--primary-100);
  box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.1);
  background: var(--bg-secondary);
}

.recaptcha-input-field::placeholder {
  color: var(--text-light);
  letter-spacing: normal;
  text-transform: none;
  font-family: "Poppins", sans-serif;
}

.recaptcha-submit-button {
  background: var(--gradient-primary);
  color: var(--text-white);
  border: none;
  border-radius: 12px;
  padding: 16px 32px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(20, 184, 166, 0.3);
  animation: submitButtonPulse 2s infinite;
}

.recaptcha-submit-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(20, 184, 166, 0.4);
}

.recaptcha-submit-button:active {
  transform: translateY(0);
}

/* Sponsor logo styling in conversations */
.sponsor-logo {
  max-width: 120px;
  height: auto;
  margin: 16px 0;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease;
  display: block;
  animation: logoFadeIn 0.5s ease-out;
}

.sponsor-logo:hover {
  transform: scale(1.05);
}

/* reCAPTCHA Code Display */
.recaptcha-code-container {
  margin: 16px 0;
  animation: recaptchaFadeIn 0.5s ease-out;
}

.recaptcha-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.recaptcha-code {
  background: linear-gradient(145deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
  border: 2px solid var(--border-light);
  border-radius: 8px;
  padding: 20px;
  margin: 12px 0;
  text-align: center;
  font-family: "Courier New", monospace;
  font-size: 24px;
  font-weight: 900;
  letter-spacing: 8px;
  color: var(--text-primary);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05),
    inset 0 2px 4px rgba(255, 255, 255, 0.9);
  position: relative;
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: codeGlow 2s infinite;
}

.recaptcha-code::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    45deg,
    rgba(59, 130, 246, 0.05) 0%,
    rgba(16, 185, 129, 0.05) 100%
  );
  border-radius: 6px;
  pointer-events: none;
}

.recaptcha-instruction {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-tertiary);
  margin-top: 8px;
  font-style: italic;
}

/* Animations */
@keyframes logoFadeIn {
  0% {
    opacity: 0;
    transform: translateY(10px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes recaptchaFadeIn {
  0% {
    opacity: 0;
    transform: translateY(15px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes codeGlow {
  0%,
  100% {
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05),
      inset 0 2px 4px rgba(255, 255, 255, 0.9);
  }
  50% {
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05),
      inset 0 2px 4px rgba(255, 255, 255, 0.9), 0 0 20px rgba(59, 130, 246, 0.1);
  }
}

/* Mobile responsiveness for reCAPTCHA display */
@media (max-width: 480px) {
  .sponsor-logo {
    max-width: 100px;
  }

  .recaptcha-code {
    font-size: 20px;
    letter-spacing: 6px;
    padding: 16px;
    min-height: 50px;
  }

  .recaptcha-label {
    font-size: 13px;
  }

  .recaptcha-instruction {
    font-size: 12px;
  }
}

/* reCAPTCHA code display styling */
.bot-message {
  white-space: pre-line;
}

/* URL display in messages */
.bot-message a {
  display: inline-block;
  margin: 8px 0;
  padding: 0;
  color: inherit;
  text-decoration: none;
}

/* Animations */
@keyframes inputFormSlideIn {
  0% {
    transform: translateY(20px);
    opacity: 0;
  }
  100% {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes submitButtonPulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.02);
  }
}

/* Mobile responsiveness for reCAPTCHA input */
@media (max-width: 480px) {
  .recaptcha-input-form {
    padding: 20px;
    gap: 14px;
  }

  .recaptcha-input-field {
    padding: 14px 16px;
    font-size: 15px;
  }

  .recaptcha-submit-button {
    padding: 14px 24px;
    font-size: 14px;
  }

  .bot-message img {
    max-width: 100px;
  }
}
