/* ===== CHAT CONTAINER ===== */

.chat-container {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-height: 520px;
  overflow: hidden;
  background: var(--gradient-glass);
  backdrop-filter: var(--blur-glass);
  -webkit-backdrop-filter: var(--blur-glass);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 0;
}

.chat-header {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-sm) var(--space-md);
  border-bottom: 1px solid var(--color-border);
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  flex-shrink: 0;
}

.chat-status {
  width: 8px;
  height: 8px;
  background: var(--color-success);
  border-radius: 50%;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-md);
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  scroll-behavior: smooth;
}

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

.chat-messages::-webkit-scrollbar-thumb {
  background: var(--color-border-hover);
  border-radius: var(--radius-full);
}

/* ===== CHAT BUBBLES ===== */

.chat-bubble {
  max-width: 85%;
  padding: 0.7rem 1rem;
  border-radius: 16px;
  font-size: var(--text-sm);
  line-height: 1.5;
  animation: bubble-in 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.chat-bubble-bot {
  align-self: flex-start;
  background: rgba(215, 210, 203, 0.08);
  border: 1px solid var(--color-border);
  border-bottom-left-radius: 4px;
  color: var(--color-text-primary);
}

.chat-bubble-user {
  align-self: flex-end;
  background: rgba(215, 210, 203, 0.15);
  border: 1px solid var(--color-accent-dark);
  border-bottom-right-radius: 4px;
  color: var(--color-text-primary);
  font-weight: 500;
}

.chat-bubble-summary {
  white-space: pre-line;
  font-size: var(--text-xs);
  background: rgba(215, 210, 203, 0.06);
  border: 1px dashed var(--color-border-hover);
  padding: 0.8rem 1rem;
}

@keyframes bubble-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ===== TYPING INDICATOR ===== */

.typing-indicator {
  align-self: flex-start;
  display: flex;
  gap: 4px;
  padding: 0.7rem 1rem;
  background: rgba(215, 210, 203, 0.08);
  border: 1px solid var(--color-border);
  border-radius: 16px;
  border-bottom-left-radius: 4px;
  animation: bubble-in 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.typing-dot {
  width: 6px;
  height: 6px;
  background: var(--color-text-muted);
  border-radius: 50%;
  animation: typing-bounce 1.4s infinite;
}

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

@keyframes typing-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-4px); opacity: 1; }
}

/* ===== CHAT INPUT AREA ===== */

.chat-input-area {
  padding: var(--space-sm) var(--space-md);
  border-top: 1px solid var(--color-border);
  flex-shrink: 0;
  animation: input-in 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.chat-input-area:empty {
  display: none;
}

@keyframes input-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Choice buttons */
.chat-choices {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
}

.chat-choice-btn {
  padding: 0.55rem 1.25rem;
  border: 1px solid var(--color-border-hover);
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--color-accent);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-base);
}

.chat-choice-btn:hover {
  background: rgba(215, 210, 203, 0.08);
  border-color: var(--color-accent);
  transform: translateY(-1px);
}

.chat-choice-btn:active {
  transform: translateY(0);
}

/* Multi-select chips */
.chat-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  margin-bottom: var(--space-sm);
}

.chat-chip {
  padding: 0.45rem 0.9rem;
  border: 1px solid var(--color-border-hover);
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--color-text-secondary);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  cursor: pointer;
  transition: all var(--transition-base);
  user-select: none;
}

.chat-chip:hover {
  border-color: var(--color-accent);
}

.chat-chip.selected {
  background: rgba(215, 210, 203, 0.15);
  border-color: var(--color-accent);
  color: var(--color-accent-light);
  animation: check-pop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.chat-chip-unavailable {
  opacity: 0.45;
  border-style: dashed;
}

.chat-chip-unavailable.selected {
  opacity: 0.7;
}

.chat-chip-all {
  width: 100%;
  text-align: center;
  border-style: dashed;
}

.chat-confirm-btn {
  width: 100%;
  padding: 0.7rem;
  background: var(--gradient-accent);
  color: var(--color-bg-primary);
  border: none;
  border-radius: var(--radius-full);
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: var(--text-sm);
  cursor: pointer;
  transition: all var(--transition-base);
  opacity: 0;
  pointer-events: none;
  transform: translateY(4px);
}

.chat-confirm-btn.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.chat-confirm-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-accent);
}

/* Text input */
.chat-text-row {
  display: flex;
  gap: var(--space-xs);
}

.chat-text-input {
  flex: 1;
  padding: 0.65rem 1rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  color: var(--color-text-primary);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  transition: border-color var(--transition-base), box-shadow var(--transition-base);
}

.chat-text-input:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(215, 210, 203, 0.08);
}

.chat-text-input::placeholder {
  color: var(--color-text-muted);
}

.chat-send-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--gradient-accent);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.chat-send-btn:hover {
  transform: scale(1.05);
  box-shadow: var(--shadow-accent);
}

.chat-send-btn svg {
  width: 18px;
  height: 18px;
  fill: var(--color-bg-primary);
}

.chat-skip-link {
  display: block;
  text-align: center;
  margin-top: var(--space-xs);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  cursor: pointer;
  background: none;
  border: none;
  font-family: var(--font-body);
  transition: color var(--transition-base);
}

.chat-skip-link:hover {
  color: var(--color-text-secondary);
}

/* WhatsApp button */
.chat-whatsapp-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  width: 100%;
  padding: 0.75rem;
  background: #25D366;
  color: #fff;
  border: none;
  border-radius: var(--radius-full);
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: var(--text-sm);
  cursor: pointer;
  transition: all var(--transition-base);
  text-decoration: none;
}

.chat-whatsapp-btn:hover {
  background: #20bd5a;
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(37, 211, 102, 0.3);
  color: #fff;
}

.chat-whatsapp-btn svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.chat-whatsapp-btn-secondary {
  background: transparent;
  border: 1px solid #25D366;
  color: #25D366;
  margin-top: var(--space-xs);
}

.chat-whatsapp-btn-secondary:hover {
  background: rgba(37, 211, 102, 0.1);
  color: #25D366;
}

.chat-message-preview {
  background: rgba(215, 210, 203, 0.08);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: var(--space-sm);
  margin-bottom: var(--space-sm);
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  white-space: pre-line;
  line-height: 1.6;
  user-select: all;
}

.chat-photo-preview {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  margin-top: var(--space-xs);
  margin-bottom: var(--space-xs);
}

.chat-photo-thumb {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
}

.chat-restart-link {
  display: block;
  text-align: center;
  margin-top: var(--space-xs);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  cursor: pointer;
  background: none;
  border: none;
  font-family: var(--font-body);
  transition: color var(--transition-base);
}

.chat-restart-link:hover {
  color: var(--color-text-secondary);
}

/* Loading */
.chat-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-sm);
}

.chat-loader {
  width: 24px;
  height: 24px;
  border: 2px solid var(--color-border);
  border-top-color: var(--color-accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

/* Validation shake */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

/* ===== CHAT FOCUS MODE ===== */

.hero-content {
  transition: opacity 0.5s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.5s cubic-bezier(0.16, 1, 0.3, 1),
              max-height 0.6s cubic-bezier(0.16, 1, 0.3, 1),
              margin 0.6s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

.chat-container {
  transition: max-height 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.chat-focused .hero-content {
  opacity: 0;
  transform: translateY(-20px);
  max-height: 0;
  margin: 0;
  pointer-events: none;
}

.chat-focused .hero-with-form {
  padding-top: 80px;
  padding-bottom: var(--space-md);
  min-height: auto;
  transition: padding 0.6s cubic-bezier(0.16, 1, 0.3, 1),
              min-height 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.chat-focused .chat-container {
  max-height: calc(100vh - 120px);
  max-height: calc(100dvh - 120px);
}

.chat-focused .hero-particles {
  opacity: 0.3;
  transition: opacity 0.8s ease;
}

.main-nav {
  transition: opacity 0.5s ease;
}

.chat-focused .main-nav {
  opacity: 0.4;
}

.chat-focused .main-nav:hover {
  opacity: 1;
}

/* ===== RESPONSIVE ===== */

@media (max-width: 480px) {
  .chat-container {
    max-height: none;
  }

  .chat-focused .chat-container {
    max-height: calc(100vh - 100px);
    max-height: calc(100dvh - 100px);
  }

  .chat-chip {
    font-size: var(--text-xs);
    padding: 0.4rem 0.7rem;
  }

  .chat-choice-btn {
    font-size: var(--text-xs);
    padding: 0.5rem 1rem;
  }
}
