:root {
  --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --secondary-gradient: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  --accent-gradient: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
  --dark-gradient: linear-gradient(135deg, #0c0c0c 0%, #1a1a1a 100%);
  --glass-bg: rgba(255, 255, 255, 0.08);
  --glass-border: rgba(255, 255, 255, 0.15);
  --text-primary: #ffffff;
  --text-secondary: rgba(255, 255, 255, 0.8);
  --text-muted: rgba(255, 255, 255, 0.6);
  --shadow-glow: 0 8px 32px rgba(0, 0, 0, 0.3);
  --shadow-intense: 0 20px 60px rgba(0, 0, 0, 0.4);
  --border-radius: 24px;
  --border-radius-lg: 32px;
  --transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
  --animation-speed: 0.6s;
}

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

body {
  font-family:
    "Inter",
    -apple-system,
    BlinkMacSystemFont,
    sans-serif;
  background: #0a0a0a;
  color: var(--text-primary);
  overflow-x: hidden;
  min-height: 100vh;
  position: relative;
}

/* Animated background */
body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background:
    radial-gradient(
      circle at 20% 80%,
      rgba(120, 119, 198, 0.3) 0%,
      transparent 50%
    ),
    radial-gradient(
      circle at 80% 20%,
      rgba(255, 119, 198, 0.3) 0%,
      transparent 50%
    ),
    radial-gradient(
      circle at 40% 40%,
      rgba(120, 219, 226, 0.2) 0%,
      transparent 50%
    );
  animation: backgroundShift 20s ease-in-out infinite alternate;
  z-index: -2;
}

body::after {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background:
    linear-gradient(
      45deg,
      transparent 30%,
      rgba(255, 255, 255, 0.02) 50%,
      transparent 70%
    ),
    linear-gradient(
      -45deg,
      transparent 30%,
      rgba(255, 255, 255, 0.02) 50%,
      transparent 70%
    );
  background-size: 60px 60px;
  animation: meshMove 10s linear infinite;
  z-index: -1;
}

@keyframes backgroundShift {
  0% {
    background:
      radial-gradient(
        circle at 20% 80%,
        rgba(120, 119, 198, 0.3) 0%,
        transparent 50%
      ),
      radial-gradient(
        circle at 80% 20%,
        rgba(255, 119, 198, 0.3) 0%,
        transparent 50%
      ),
      radial-gradient(
        circle at 40% 40%,
        rgba(120, 219, 226, 0.2) 0%,
        transparent 50%
      );
  }
  100% {
    background:
      radial-gradient(
        circle at 80% 20%,
        rgba(120, 119, 198, 0.4) 0%,
        transparent 50%
      ),
      radial-gradient(
        circle at 20% 80%,
        rgba(255, 119, 198, 0.4) 0%,
        transparent 50%
      ),
      radial-gradient(
        circle at 60% 60%,
        rgba(120, 219, 226, 0.3) 0%,
        transparent 50%
      );
  }
}

@keyframes meshMove {
  0% {
    transform: translate(0, 0);
  }
  100% {
    transform: translate(60px, 60px);
  }
}

.main-container {
  display: flex;
  align-items: flex-start;
  gap: 40px;
  width: 95%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 40px 20px;
  min-height: 100vh;
}

.avatar-container {
  position: relative;
  width: 320px;
  height: 320px;
  margin-top: 80px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.chat-avatar {
  width: 100%;
  height: 100%;
  border-radius: var(--border-radius-lg);
  overflow: hidden;
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  border: 2px solid var(--glass-border);
  box-shadow:
    var(--shadow-intense),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  transition: var(--transition);
  transform-style: preserve-3d;
  position: relative;
}

.chat-avatar::before {
  content: "";
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  background: var(--primary-gradient);
  border-radius: var(--border-radius-lg);
  z-index: -1;
  opacity: 0;
  transition: var(--transition);
}

.chat-avatar:hover {
  transform: translateY(-10px) rotateY(8deg) rotateX(5deg);
  box-shadow:
    0 30px 80px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.chat-avatar:hover::before {
  opacity: 0.8;
}

.chat-avatar video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: calc(var(--border-radius-lg) - 2px);
}

.avatar-title {
  margin-top: 30px;
  font-size: 2rem;
  font-weight: 800;
  text-align: center;
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
  animation: titleGlow 3s ease-in-out infinite alternate;
}

.avatar-subtitle {
  color: var(--text-secondary);
  font-size: 1.1rem;
  margin-top: 12px;
  text-align: center;
  font-weight: 500;
  opacity: 0.9;
}

@keyframes titleGlow {
  0% {
    filter: drop-shadow(0 4px 8px rgba(102, 126, 234, 0.3));
  }
  100% {
    filter: drop-shadow(0 4px 16px rgba(118, 75, 162, 0.5));
  }
}

#chat-container {
  width: 100%;
  max-width: 800px;
  background: var(--glass-bg);
  backdrop-filter: blur(25px);
  box-shadow: var(--shadow-intense);
  border-radius: var(--border-radius-lg);
  border: 1px solid var(--glass-border);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: 85vh;
  transition: var(--transition);
  position: relative;
}

#chat-container::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--accent-gradient);
  animation: headerPulse 2s ease-in-out infinite alternate;
}

@keyframes headerPulse {
  0% {
    opacity: 0.5;
  }
  100% {
    opacity: 1;
  }
}

#chat-header {
  background: var(--primary-gradient);
  color: white;
  padding: 24px 32px;
  text-align: center;
  font-weight: 700;
  font-size: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.header-actions {
  display: flex;
  gap: 16px;
  align-items: center;
}

.action-button {
  background: rgba(255, 255, 255, 0.15);
  border: none;
  border-radius: 16px;
  padding: 12px 20px;
  color: white;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: var(--transition);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  text-decoration: none;
}

.action-button:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

@media (max-width: 600px) {
  .action-button {
    padding: 10px 12px;
  }
  .action-button span.text {
    display: none;
  }
}

#chat-output {
  flex-grow: 1;
  padding: 32px;
  overflow-y: auto;
  background: rgba(0, 0, 0, 0.2);
  scroll-behavior: smooth;
  position: relative;
}

#chat-output::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background:
    radial-gradient(
      circle at 10% 20%,
      rgba(120, 119, 198, 0.05) 0%,
      transparent 30%
    ),
    radial-gradient(
      circle at 90% 80%,
      rgba(255, 119, 198, 0.05) 0%,
      transparent 30%
    );
  pointer-events: none;
}

.message-container {
  display: flex;
  margin-bottom: 32px;
  flex-direction: column;
  animation: messageSlide var(--animation-speed) cubic-bezier(0.23, 1, 0.32, 1);
  position: relative;
}

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

.user-container {
  align-items: flex-end;
}

.bot-container {
  align-items: flex-start;
}

.message {
  padding: 22px 28px;
  border-radius: 24px;
  line-height: 1.8;
  max-width: 85%;
  position: relative;
  word-wrap: break-word;
  transition: var(--transition);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.user-message {
  background: var(--secondary-gradient);
  color: white;
  border-bottom-right-radius: 8px;
  box-shadow:
    0 8px 32px rgba(240, 147, 251, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.user-message:hover {
  transform: translateY(-2px);
  box-shadow:
    0 12px 40px rgba(240, 147, 251, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.bot-message {
  background: var(--glass-bg);
  color: var(--text-primary);
  border: 1px solid var(--glass-border);
  border-bottom-left-radius: 8px;
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.bot-message:hover {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.12);
  box-shadow:
    0 12px 40px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.message-time {
  font-size: 0.8rem;
  margin-top: 12px;
  color: var(--text-muted);
  font-weight: 400;
  font-family: "JetBrains Mono", monospace;
}

.bot-message .message-content h1,
.bot-message .message-content h2,
.bot-message .message-content h3 {
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin: 20px 0 16px 0;
  font-weight: 700;
}

.bot-message .message-content code {
  background: rgba(0, 0, 0, 0.4);
  color: #64ffda;
  padding: 4px 8px;
  border-radius: 6px;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.9em;
  border: 1px solid rgba(100, 255, 218, 0.2);
}

.bot-message .message-content pre {
  background: rgba(0, 0, 0, 0.6);
  border-radius: 12px;
  padding: 20px;
  overflow-x: auto;
  margin: 16px 0;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(10px);
}

#input-area {
  display: flex;
  padding: 28px;
  background: rgba(10, 10, 10, 0.6);
  backdrop-filter: blur(30px);
  flex-direction: column;
  gap: 15px;
  border-top: 1px solid var(--glass-border);
}

.contact-buttons {
  display: flex;
  gap: 12px;
  justify-content: flex-start;
  margin-bottom: 5px;
}

.contact-button {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(10px);
  border: 2px solid transparent;
}

.contact-button::before {
  content: "";
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  border-radius: 50%;
  padding: 2px;
  background: var(--primary-gradient);
  mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  mask-composite: exclude;
  opacity: 0;
  transition: var(--transition);
}

.contact-button:hover {
  transform: translateY(-5px) scale(1.05);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

.contact-button:hover::before {
  opacity: 1;
}

#whatsapp-button {
  background: linear-gradient(135deg, #25d366, #128c7e);
  animation: whatsappPulse 3s ease-in-out infinite;
}

#gmail-button {
  background: linear-gradient(135deg, #ea4335, #db4437);
  animation: gmailPulse 3s ease-in-out infinite;
}

@keyframes whatsappPulse {
  0%,
  100% {
    box-shadow: 0 8px 32px rgba(37, 211, 102, 0.3);
  }
  50% {
    box-shadow: 0 8px 32px rgba(37, 211, 102, 0.6);
  }
}

@keyframes gmailPulse {
  0%,
  100% {
    box-shadow: 0 8px 32px rgba(234, 67, 53, 0.3);
  }
  50% {
    box-shadow: 0 8px 32px rgba(234, 67, 53, 0.6);
  }
}

.input-row {
  display: flex;
  width: 100%;
  gap: 16px;
  position: relative;
}

#user-input {
  flex-grow: 1;
  border: 2px solid var(--glass-border);
  padding: 18px 28px;
  border-radius: 28px;
  font-size: 1.05rem;
  outline: none;
  transition: var(--transition);
  font-family: "Inter", sans-serif;
  background: var(--glass-bg);
  backdrop-filter: blur(10px);
  color: var(--text-primary);
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.1);
}

#user-input::placeholder {
  color: var(--text-muted);
}

#user-input:focus {
  border-color: rgba(79, 172, 254, 0.5);
  background: rgba(255, 255, 255, 0.15);
  box-shadow:
    0 0 25px rgba(79, 172, 254, 0.2),
    inset 0 2px 10px rgba(0, 0, 0, 0.2);
  transform: translateY(-1px);
}

#send-button {
  background: var(--accent-gradient);
  color: white;
  border: none;
  border-radius: 28px;
  padding: 0 32px;
  cursor: pointer;
  font-weight: 700;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 8px 32px rgba(79, 172, 254, 0.3);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-size: 0.9rem;
  position: relative;
  overflow: hidden;
}

#send-button::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.3),
    transparent
  );
  transition: var(--transition);
}

#send-button:hover {
  transform: translateY(-4px) scale(1.05);
  box-shadow: 0 16px 40px rgba(79, 172, 254, 0.5);
}

#send-button:hover::before {
  left: 100%;
}

.typing-indicator {
  font-style: italic;
  color: var(--text-secondary);
  padding: 16px 24px;
  background: var(--glass-bg);
  backdrop-filter: blur(10px);
  border-radius: 20px;
  margin: 8px 0;
  display: inline-block;
  align-self: flex-start;
  border: 1px solid var(--glass-border);
  animation: typingGlow 2s ease-in-out infinite alternate;
}

@keyframes typingGlow {
  0% {
    box-shadow: 0 4px 20px rgba(79, 172, 254, 0.2);
  }
  100% {
    box-shadow: 0 4px 20px rgba(79, 172, 254, 0.5);
  }
}

.typing-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent-gradient);
  margin-right: 6px;
  animation: typingBounce 1.4s infinite ease-in-out both;
}

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

@keyframes typingBounce {
  0%,
  80%,
  100% {
    transform: scale(0.8) translateY(0);
    opacity: 0.5;
  }
  40% {
    transform: scale(1.2) translateY(-10px);
    opacity: 1;
  }
}

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb {
  background: var(--primary-gradient);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--accent-gradient);
  background-clip: padding-box;
}

/* Tooltip styling */
.tooltip {
  position: relative;
  display: inline-block;
}

.tooltip .tooltiptext {
  visibility: hidden;
  width: 160px;
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(10px);
  color: #fff;
  text-align: center;
  border-radius: 12px;
  padding: 8px 12px;
  position: absolute;
  z-index: 1000;
  bottom: 130%;
  left: 50%;
  transform: translateX(-50%);
  opacity: 0;
  transition: var(--transition);
  font-size: 0.85rem;
  font-weight: 500;
  border: 1px solid var(--glass-border);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.tooltip:hover .tooltiptext {
  visibility: visible;
  opacity: 1;
  transform: translateX(-50%) translateY(-5px);
}

/* Floating animation for avatar */
@keyframes float {
  0%,
  100% {
    transform: translateY(0) rotateY(0);
  }
  50% {
    transform: translateY(-15px) rotateY(5deg);
  }
}

.chat-avatar {
  animation: float 8s ease-in-out infinite;
}

/* Responsive design */
@media (max-width: 1200px) {
  .main-container {
    flex-direction: column;
    align-items: center;
    gap: 30px;
    padding: 20px;
  }

  .avatar-container {
    margin-top: 0;
    width: 280px;
    height: 280px;
  }

  #chat-container {
    height: 80vh;
    max-width: 100%;
  }
}

@media (max-width: 768px) {
  .main-container {
    width: 100%;
    padding: 16px;
  }

  .avatar-container {
    width: 240px;
    height: 240px;
  }

  #chat-header {
    padding: 20px 24px;
    font-size: 1.3rem;
  }

  .header-actions {
    gap: 12px;
  }

  .action-button {
    padding: 10px 16px;
    font-size: 0.85rem;
  }

  #input-area {
    padding: 20px;
  }

  #user-input {
    padding: 16px 24px;
    font-size: 1rem;
  }

  .contact-buttons {
    gap: 12px;
  }

  .contact-button {
    width: 50px;
    height: 50px;
  }

  .avatar-title {
    font-size: 1.7rem;
  }

  .message {
    padding: 16px 20px;
    max-width: 90%;
  }
}

@media (max-width: 480px) {
  #chat-container {
    height: 85vh;
    border-radius: 20px;
  }

  #chat-output {
    padding: 24px 20px;
  }

  .message {
    max-width: 95%;
    padding: 14px 18px;
  }

  #send-button {
    padding: 0 24px;
  }
}

/* Loading animation */
@keyframes shimmer {
  0% {
    background-position: -200px 0;
  }
  100% {
    background-position: calc(200px + 100%) 0;
  }
}

.loading {
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.1),
    transparent
  );
  background-size: 200px 100%;
  animation: shimmer 2s infinite;
}
