/* Sleek and refreshing color palette */
:root {
  --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --messenger-blue: #0084ff;
  --messenger-blue-dark: #006bc7;
  --success-green: #42d392;
  --accent-teal: #17a2b8;
  --chat-bg: #fafbfc;
  --user-bubble: var(--messenger-blue);
  --bot-bubble: #f1f3f4;
  --text-dark: #1c1e21;
  --text-light: #65676b;
  --border-light: #e4e6ea;
  --shadow: rgba(0, 0, 0, 0.08);
  --shadow-hover: rgba(0, 0, 0, 0.15);
  --gradient-bg: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
}

/* Reset and base styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Poppins", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
    Arial, sans-serif;
  background: var(--gradient-bg);
  min-height: 100vh;
  color: var(--text-dark);
}

.container {
  max-width: 400px;
  margin: 0 auto;
  background: white;
  min-height: 100vh;
  position: relative;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
  border-radius: 0;
}

/* Welcome Logo Styles */
.welcome-logo {
  text-align: center;
  margin: 0;
  padding: 0;
}

.welcome-logo img {
  max-width: 120px;
  height: auto;
  background: transparent;
}

/* Remove bubble styling for logo message */
.message-bubble:has(.welcome-logo) {
  background: transparent !important;
  border: none !important;
  padding: 0 !important;
  box-shadow: none !important;
}

/* Header with balance */
.header {
  background: transparent;
  padding: 1rem;
  position: sticky;
  top: 0;
  z-index: 100;
}

.balance-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(
    135deg,
    var(--success-green) 0%,
    var(--accent-teal) 100%
  );
  padding: 0.75rem 1rem;
  border-radius: 20px;
  box-shadow: 0 4px 20px rgba(66, 211, 146, 0.25);
}

.balance-label {
  font-weight: 600;
  color: white;
  font-size: 0.9rem;
  opacity: 0.9;
}

.balance-amount {
  font-weight: bold;
  font-size: 1.5rem;
  color: white;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Chat container */
.chat-container {
  padding: 16px 12px;
  padding-bottom: 180px;
  background: var(--chat-bg);
  min-height: calc(100vh - 120px);
}

.chat-messages {
  margin-bottom: 2rem;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Spacer to prevent first message from being blocked by balance container */
.balance-spacer {
  height: 70px;
  width: 100%;
  flex-shrink: 0;
}

/* Chat message styles */
.message {
  margin-bottom: 6px;
  opacity: 0;
  transform: translateY(20px);
  animation: slideIn 0.4s ease forwards;
}

.message.bot {
  display: flex;
  justify-content: flex-start;
}

.message.user {
  display: flex;
  justify-content: flex-end;
}

.message-bubble {
  max-width: 75%;
  padding: 8px 12px;
  border-radius: 18px;
  font-size: 0.95rem;
  line-height: 1.35;
  position: relative;
  word-wrap: break-word;
  white-space: pre-line;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.message.bot .message-bubble {
  background: var(--bot-bubble);
  border: none;
  border-bottom-left-radius: 4px;
  color: var(--text-dark);
}

.message.user .message-bubble {
  background: rgba(0, 132, 255, 0.9);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-bottom-right-radius: 4px;
}

/* Typing indicator */
.typing-indicator {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  background: var(--bot-bubble);
  border-radius: 18px;
  border-bottom-left-radius: 4px;
  max-width: 60px;
  margin-bottom: 1rem;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

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

.typing-dot {
  width: 6px;
  height: 6px;
  background: #bcc3ce;
  border-radius: 50%;
  animation: typingDot 1.4s infinite ease-in-out;
}

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

.typing-dot:nth-child(3) {
  animation-delay: 0.4s;
}

/* Interaction area */
.interaction-area {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 400px;
  background: transparent;
  padding: 12px 16px;
}

/* reCAPTCHA overlay */
.recaptcha-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.recaptcha-container {
  background: white;
  border-radius: 16px;
  padding: 24px;
  max-width: 320px;
  width: 100%;
  text-align: center;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
  backdrop-filter: blur(10px);
}

.recaptcha-header h3 {
  color: var(--messenger-blue);
  margin-bottom: 0.5rem;
  font-size: 1.2rem;
}

.recaptcha-header p {
  color: var(--text-light);
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.recaptcha-challenge {
  margin: 1rem 0;
}

#recaptchaCanvas {
  border: 2px solid var(--border-light);
  border-radius: 8px;
  margin-bottom: 1rem;
  background: #f8f8f8;
}

.recaptcha-input-group {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

#recaptchaInput {
  flex: 1;
  padding: 0.75rem;
  border: 2px solid var(--border-light);
  border-radius: 8px;
  font-size: 1rem;
  text-align: center;
  text-transform: uppercase;
}

#recaptchaInput:focus {
  outline: none;
  border-color: var(--messenger-blue);
  box-shadow: 0 0 0 2px rgba(0, 132, 255, 0.2);
}

/* Progress indicator */
.progress-indicator {
  display: none;
}

.progress-step {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.85rem;
  border: 2px solid var(--border-light);
  background: white;
  color: var(--text-light);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.progress-step.active {
  background: var(--messenger-blue);
  color: white;
  border-color: var(--messenger-blue);
}

.progress-step.completed {
  background: var(--success-green);
  color: white;
  border-color: var(--success-green);
}

/* Animations */
@keyframes slideIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes typingDot {
  0%,
  60%,
  100% {
    transform: translateY(0);
  }
  30% {
    transform: translateY(-10px);
  }
}

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

@keyframes bounce {
  0%,
  20%,
  50%,
  80%,
  100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-10px);
  }
  60% {
    transform: translateY(-5px);
  }
}

/* Responsive design */
@media (max-width: 480px) {
  .container {
    max-width: 100%;
  }

  .balance-container {
    padding: 0.5rem 0.75rem;
  }

  .balance-amount {
    font-size: 1.3rem;
  }

  .message-bubble {
    font-size: 0.9rem;
    padding: 0.6rem 0.8rem;
    max-width: 85%;
  }

  .recaptcha-container {
    padding: 20px;
    margin: 8px;
    border-radius: 12px;
  }

  .recaptcha-input-group {
    flex-direction: column;
    gap: 0.75rem;
  }

  .progress-indicator {
    top: 70px;
    padding: 6px 12px;
  }

  .progress-step {
    width: 28px;
    height: 28px;
    font-size: 0.8rem;
  }

  .chat-container {
    padding: 12px 10px;
    padding-bottom: 160px;
  }

  .balance-spacer {
    height: 60px;
  }

  .interaction-area {
    padding: 12px;
  }
}

/* WhatsApp in-app browser optimizations */
@media (max-width: 400px) {
  .header {
    padding: 0.8rem;
  }

  .balance-container {
    padding: 0.5rem 0.8rem;
    border-radius: 20px;
  }

  .balance-label {
    font-size: 0.8rem;
  }

  .balance-amount {
    font-size: 1.2rem;
  }

  .message-bubble {
    font-size: 0.85rem;
    padding: 0.5rem 0.7rem;
    border-radius: 16px;
  }

  .message.bot .message-bubble {
    border-bottom-left-radius: 4px;
  }

  .message.user .message-bubble {
    border-bottom-right-radius: 4px;
  }

  .progress-indicator {
    top: 65px;
    gap: 0.8rem;
  }

  .recaptcha-container {
    padding: 0.8rem;
    border-radius: 10px;
  }

  .recaptcha-input-group {
    flex-direction: column;
    gap: 0.75rem;
  }

  #recaptchaCanvas {
    width: 180px;
    height: 70px;
  }

  .balance-spacer {
    height: 55px;
  }
}

/* Touch optimizations */
@media (pointer: coarse) {
  .btn {
    min-height: 48px;
    min-width: 48px;
  }

  .recaptcha-input-group input {
    min-height: 48px;
  }

  .progress-step {
    min-width: 32px;
    min-height: 32px;
  }
}

/* Success animations */
.success-animation {
  animation: bounce 0.6s ease;
}

.balance-increment {
  animation: pulse 0.8s ease;
}
