* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary: #4F46E5;
  --primary-dark: #4338CA;
  --bg: #F3F4F6;
  --white: #FFFFFF;
  --text: #1F2937;
  --text-light: #6B7280;
  --user-bubble: #4F46E5;
  --bot-bubble: #FFFFFF;
}

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  overflow: hidden;
}

.chat-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-width: 800px;
  margin: 0 auto;
  background: var(--white);
  box-shadow: 0 0 20px rgba(0,0,0,0.1);
}

.chat-header {
  background: var(--primary);
  color: var(--white);
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}

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

.bot-avatar {
  font-size: 32px;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.2);
  border-radius: 50%;
}

.bot-info {
  flex: 1;
}

.bot-name {
  font-size: 18px;
  font-weight: 600;
}

.bot-status {
  font-size: 13px;
  opacity: 0.9;
}

.clear-btn {
  background: rgba(255,255,255,0.2);
  border: none;
  color: white;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 18px;
  transition: background 0.2s;
}

.clear-btn:hover {
  background: rgba(255,255,255,0.3);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  -webkit-overflow-scrolling: touch;
}

.welcome-message {
  text-align: center;
  padding: 20px;
  color: var(--text-light);
  font-size: 14px;
}

.message {
  max-width: 80%;
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 15px;
  line-height: 1.4;
  word-wrap: break-word;
  animation: messageSlide 0.3s ease;
}

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

.message-user {
  align-self: flex-end;
  background: var(--user-bubble);
  color: var(--white);
  border-bottom-right-radius: 4px;
}

.message-bot {
  align-self: flex-start;
  background: var(--bot-bubble);
  color: var(--text);
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.message-time {
  font-size: 11px;
  opacity: 0.7;
  margin-top: 4px;
}

.typing-indicator {
  display: none;
  align-items: center;
  gap: 4px;
  padding: 12px 16px;
  align-self: flex-start;
}

.typing-indicator.active {
  display: flex;
}

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

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

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

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

.chat-input {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  background: var(--white);
  border-top: 1px solid #E5E7EB;
}

.chat-input input {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid #E5E7EB;
  border-radius: 24px;
  font-size: 15px;
  outline: none;
  transition: border-color 0.2s;
}

.chat-input input:focus {
  border-color: var(--primary);
}

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

.chat-input button:hover {
  background: var(--primary-dark);
}

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

.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal.hidden {
  display: none;
}

.modal-content {
  background: var(--white);
  padding: 32px;
  border-radius: 16px;
  max-width: 400px;
  width: 100%;
  text-align: center;
}

.modal-content h2 {
  font-size: 22px;
  margin-bottom: 8px;
  color: var(--text);
}

.modal-icon {
  font-size: 48px;
  margin-bottom: 12px;
}

.form-group {
  text-align: left;
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

.form-group input {
  width: 100%;
  padding: 12px 14px;
  border: 2px solid #E5E7EB;
  border-radius: 10px;
  font-size: 15px;
  outline: none;
  transition: border-color 0.2s;
}

.form-group input:focus {
  border-color: var(--primary);
}

.register-btn {
  width: 100%;
  padding: 14px;
  background: var(--primary);
  color: var(--white);
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  margin-top: 8px;
}

.register-btn:hover {
  background: var(--primary-dark);
}

.form-note {
  font-size: 12px;
  color: var(--text-light);
  margin-top: 12px;
  margin-bottom: 0;
}

.modal-content p {
  color: var(--text-light);
  margin-bottom: 20px;
  font-size: 14px;
}

.modal-content input {
  /* Override: form-group inputs are visible */
}

@media (max-width: 480px) {
  .message {
    max-width: 85%;
    font-size: 14px;
  }
  
  .chat-input {
    padding: 10px 12px;
  }
  
  .chat-input input {
    padding: 10px 14px;
    font-size: 14px;
  }
  
  .chat-input button {
    width: 40px;
    height: 40px;
  }
}
