/* Avatar Experience Styles */

/* Embedded Avatar Widget */
.embedded-avatar {
  position: fixed;
  bottom: 20px;
  left: 20px;
  width: 320px;
  height: 240px;
  z-index: 999999999;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(10px);
  background: rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: all 0.3s ease;
  opacity: 0;
  transform: translateY(20px);
  pointer-events: none;
  /* Performance optimizations */
  will-change: transform, opacity;
  contain: layout style paint;
  content-visibility: auto;
  transform: translateZ(0); /* Force hardware acceleration */
}

.embedded-avatar.visible {
  opacity: 1;
  transform: translateY(0) translateZ(0);
  pointer-events: auto; /* Enable on desktop */
}

/* Completely disable pointer events on mobile devices to ensure smooth scrolling */
@media (max-width: 768px), (hover: none) and (pointer: coarse) {
  .embedded-avatar,
  .embedded-avatar.visible {
    pointer-events: auto !important; /* Allow touch events for tap detection */
    touch-action: pan-y pan-x; /* Allow scrolling but capture touch events */
  }
  
  /* Only enable pointer events when fully expanded */
  .embedded-avatar.expanded {
    pointer-events: auto !important;
    touch-action: manipulation; /* Full interaction when expanded */
  }
  
  /* Ensure iframe inside expanded avatar is interactive */
  .embedded-avatar.expanded iframe {
    pointer-events: auto !important;
    touch-action: manipulation !important;
  }
}

/* Remove CSS hover states - we'll handle this with JavaScript */
.embedded-avatar.visible:not(.expanded)::before,
.embedded-avatar.visible:not(.expanded)::after {
  display: none;
}

/* Manual hover state controlled by JavaScript */
.embedded-avatar.visible:not(.expanded).js-hover {
  transform: translateY(-4px) translateZ(0);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
  width: 450px;
  height: 340px;
}

/* Prevent hover effects on touch devices to avoid sticky states */
@media (hover: none) and (pointer: coarse) {
  .embedded-avatar.visible:hover:not(.expanded) {
    transform: translateY(0) translateZ(0);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    width: 320px;
    height: 240px;
  }
}

.embedded-avatar-container {
  width: 100%;
  height: 100%;
  position: relative;
  transition: opacity 0.2s ease; /* Faster transition */
  /* Performance optimizations */
  will-change: opacity;
  contain: layout;
}

.embedded-avatar iframe {
  width: 100%;
  height: 100%;
  border: none;
  border-radius: 12px;
  background: transparent;
  transition: opacity 0.2s ease; /* Faster transition */
  /* Performance optimizations */
  will-change: opacity;
  transform: translateZ(0); /* Force hardware acceleration */
}

/* Ensure iframe doesn't interfere with scrolling on mobile */
@media (max-width: 768px), (hover: none) and (pointer: coarse) {
  .embedded-avatar iframe {
    pointer-events: auto !important;
    touch-action: pan-y !important;
  }
}

/* Loading state for iframe */
.embedded-avatar iframe:not([src]) {
  opacity: 0.5;
}

/* Mobile positioning - move to bottom center and make smaller */
@media (max-width: 768px) {
  .embedded-avatar {
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: 320px;
    height: 240px;
    border-radius: 10px;
  }
  
  .embedded-avatar.visible {
    transform: translateX(-50%) translateY(0);
  }
  
  /* Mobile hover state controlled by JavaScript */
  .embedded-avatar.visible:not(.expanded).js-hover {
    transform: translateX(-50%) translateY(-4px);
    width: 340px;
    height: 260px;
  }
  
  .embedded-avatar iframe {
    border-radius: 10px;
  }
}

/* Disable hover effects on touch devices to prevent scrolling interference */
@media (max-width: 768px) and (hover: none) and (pointer: coarse) {
  .embedded-avatar.visible:hover:not(.expanded) {
    transform: translateX(-50%) translateY(0) !important;
    width: 320px !important;
    height: 240px !important;
  }
}

/* Very small mobile screens */
@media (max-width: 480px) {
  .embedded-avatar {
    width: 280px;
    height: 200px;
    bottom: 8px;
  }
  
  /* Ensure no hover effects on very small touch devices, except when expanded */
  .embedded-avatar.visible:hover:not(.expanded) {
    transform: translateX(-50%) translateY(0) !important;
    width: 280px !important;
    height: 200px !important;
  }
}

/* Hide avatar when chatbot is open on mobile */
@media (max-width: 768px) {
  .embedded-avatar.chatbot-hidden-avatar,
  .avatar-swap-button.chatbot-hidden-avatar {
    opacity: 0 !important;
    pointer-events: none !important;
    transform: translateX(-50%) translateY(20px) scale(0.9) !important;
    transition: all 0.3s ease !important;
  }
}

/* Ensure avatar modal container centers properly on desktop */
.modal-container.avatar-modal-container {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: 100% !important;
  z-index: 1000 !important;
}

/* Intro Experience Overlay - Notification Style */
.intro-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: auto; /* Auto height for notification */
  background: transparent; /* No background overlay */
  z-index: 10000;
  display: none;
  align-items: flex-start; /* Align to top */
  justify-content: center;
  opacity: 0;
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  padding: 1rem; /* Padding around notification */
  pointer-events: none; /* Don't block interactions - ALWAYS */
}

.intro-overlay.show {
  display: flex;
  opacity: 1;
  pointer-events: none; /* Keep pointer events disabled to allow scrolling */
}

.intro-overlay.collapsing {
  animation: notificationSlideUp 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  pointer-events: none; /* Ensure no blocking during animation */
}

.intro-content {
  text-align: center;
  padding: 20px 30px 16px 30px; /* Compact padding */
  max-width: 500px; /* Smaller notification size */
  width: 90%; /* Responsive width */
  background: rgba(15, 23, 42, 0.95); /* Solid-ish background */
  border: 1px solid rgba(34, 192, 196, 0.3);
  border-radius: 16px; /* Modern rounded corners */
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25),
              0 8px 16px rgba(0, 0, 0, 0.15),
              0 0 30px rgba(34, 192, 196, 0.15);
  position: relative;
  overflow: hidden;
  transform: translateY(-100px); /* Start above viewport */
  animation: notificationSlideDown 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  pointer-events: auto; /* Only the content itself can receive interactions */
}

@keyframes notificationSlideDown {
  from {
    transform: translateY(-100px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes notificationSlideUp {
  from {
    transform: translateY(0);
    opacity: 1;
  }
  to {
    transform: translateY(-100px);
    opacity: 0;
  }
}

/* Subtle gradient border effect for notification */
.intro-content::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: 16px;
  padding: 1px;
  background: linear-gradient(135deg, 
    rgba(34, 192, 196, 0.4) 0%, 
    rgba(255, 255, 255, 0.2) 50%, 
    rgba(34, 192, 196, 0.4) 100%);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask-composite: xor;
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  z-index: -1;
}

.intro-text {
  font-size: 1.4rem; /* Smaller for notification */
  font-weight: 400;
  line-height: 1.3;
  color: #fff;
  max-width: 100%;
  word-wrap: break-word;
  margin-bottom: 12px; /* Tight spacing */
}

.intro-word {
  display: inline-block;
  opacity: 0;
  transform: translateY(10px) scale(0.95);
  margin: 0 0.12em; /* Tight word spacing */
  animation: wordPop 0.3s ease-out forwards;
  text-shadow: 0 0 12px rgba(34, 192, 196, 0);
}

/* Logo in intro text - smaller for notification */
.intro-logo-word {
  vertical-align: middle;
  margin: 0 0.2em;
}

.intro-logo {
  height: 0.9em; /* Smaller for notification */
  width: auto;
  vertical-align: middle;
  display: inline-block;
  opacity: 0.95;
  filter: drop-shadow(0 0 12px rgba(34, 192, 196, 0.5));
}

/* Subtle Progress bar - very minimal */
.intro-progress-container {
  margin-top: 8px; /* Minimal spacing */
  width: 100%;
  position: relative;
}

.intro-progress-bar {
  width: 100%;
  height: 2px; /* Very thin for subtlety */
  background: rgba(255, 255, 255, 0.15);
  border-radius: 2px;
  overflow: hidden;
  position: relative;
}

.intro-progress-fill {
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, 
    #22C0C4 0%, 
    #00ffff 50%, 
    #1F74BC 100%);
  border-radius: 2px;
  transition: width 5s linear; /* 5 second linear progress */
  position: relative;
  box-shadow: 0 0 8px rgba(34, 192, 196, 0.4);
}

@keyframes wordPop {
  0% {
    opacity: 0;
    transform: translateY(10px) scale(0.95);
    text-shadow: 0 0 12px rgba(34, 192, 196, 0);
  }
  50% {
    text-shadow: 0 0 20px rgba(34, 192, 196, 0.6),
                 0 0 30px rgba(34, 192, 196, 0.4);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
    text-shadow: 0 0 12px rgba(34, 192, 196, 0.4),
                 0 0 20px rgba(34, 192, 196, 0.2);
  }
}

/* Fast stagger animation for notification style */
.intro-word:nth-child(1) { animation-delay: 0.05s; }
.intro-word:nth-child(2) { animation-delay: 0.10s; }
.intro-word:nth-child(3) { animation-delay: 0.15s; }
.intro-word:nth-child(4) { animation-delay: 0.20s; }
.intro-word:nth-child(5) { animation-delay: 0.25s; }
.intro-word:nth-child(6) { animation-delay: 0.30s; }
.intro-word:nth-child(7) { animation-delay: 0.35s; }
.intro-word:nth-child(8) { animation-delay: 0.40s; }
.intro-word:nth-child(9) { animation-delay: 0.45s; }
.intro-word:nth-child(10) { animation-delay: 0.50s; }
.intro-word:nth-child(11) { animation-delay: 0.55s; }
.intro-word:nth-child(12) { animation-delay: 0.60s; }

/* Avatar Experience Button */
.avatar-button-container {
  display: flex;
  justify-content: center;
  margin: 0.5rem 0;
  z-index: 10;
  position: relative;
  flex-shrink: 0; /* Prevent button from shrinking */
}

/* Hide avatar button on smaller viewports to save space */
@media (max-height: 800px) and (max-width: 1024px) {
  .avatar-button-container {
    margin: 0.25rem 0;
  }
  
  .avatar-experience-btn {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
  }
}

/* Removed height restriction to allow avatar button on all devices */

.avatar-experience-btn {
  position: relative;
  background: linear-gradient(135deg, #00ffff, #0080ff);
  border: none;
  padding: 1rem 2rem;
  border-radius: 50px;
  color: white;
  font-size: 1.1rem;
  font-weight: 500;
  cursor: pointer;
  overflow: hidden;
  transition: all 0.3s ease;
  box-shadow: none; /* Remove all shadow/glow effects */
  animation: buttonAppear 0.5s ease-out;
  outline: none; /* Remove any default browser outline */
  -webkit-appearance: none; /* Remove webkit default styling */
  -moz-appearance: none; /* Remove firefox default styling */
  -webkit-tap-highlight-color: transparent; /* Remove tap highlight on mobile */
  isolation: isolate; /* Create new stacking context to prevent visual glitches */
}

@keyframes buttonAppear {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.avatar-experience-btn:hover {
  transform: translateY(-2px);
  box-shadow: none; /* Remove hover glow effect */
}

.avatar-experience-btn:focus {
  outline: none;
  box-shadow: none; /* Remove focus glow effect */
}

.avatar-experience-btn:active {
  transform: translateY(0px);
  box-shadow: none; /* Remove active glow effect */
}

.btn-glow {
  display: none; /* Completely hide the glow element to fix corner issues */
}

/* Removed glowPulse animation as glow element is now hidden */

.btn-text {
  position: relative;
  z-index: 1;
}

/* Removed the problematic ::before pseudo-element that was creating a box effect */

/* Avatar Modal Specific Styles - Updated for proper iframe display */
.avatar-modal {
  max-width: 95vw;
  max-height: 95vh;
  width: auto;
  height: auto;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 15px; /* Increased padding around the entire modal */
  position: absolute !important;
  top: 50% !important;
  left: 50% !important;
  transform: translate(-50%, -50%) !important;
  margin: 0 !important; /* Remove any margin that might offset the centering */
}

/* Ensure avatar modal content doesn't scroll */
.avatar-modal .modal-content {
  padding: 0 !important;
  overflow: hidden !important;
  max-height: none !important;
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.avatar-modal-content {
  padding: 0;
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  flex: 1;
}

.avatar-toggle-buttons {
  display: flex;
  gap: 0.75rem;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.1);
  border-radius: 10px 10px 0 0;
  flex-shrink: 0;
  min-height: 60px;
  max-height: 80px;
}

.avatar-toggle-btn {
  flex: 1;
  padding: 0.6rem 1rem;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 5px;
  color: #fff;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.3s ease;
  white-space: nowrap;
  text-align: center;
}

.avatar-toggle-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

.avatar-toggle-btn.active {
  background: linear-gradient(135deg, #00ffff, #0080ff);
  border-color: transparent;
  box-shadow: 0 2px 10px rgba(0, 255, 255, 0.4);
}

/* Updated iframe container with increased internal padding */
.avatar-iframe-container {
  position: relative;
  width: 100%;
  background: #000;
  border-radius: 0 0 10px 10px;
  overflow: hidden;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 400px;
  padding: 35px; /* Increased internal padding even more for full visibility */
  box-sizing: border-box;
}

/* Animated background for TouchCast */
.avatar-background {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #0a1628 0%, #000000 50%, #1a2332 100%);
  z-index: 1;
  overflow: hidden;
}

.avatar-background::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: 
    radial-gradient(circle at 20% 30%, rgba(34, 192, 196, 0.15) 0%, transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(31, 116, 188, 0.12) 0%, transparent 50%),
    radial-gradient(circle at 40% 80%, rgba(34, 192, 196, 0.08) 0%, transparent 50%),
    radial-gradient(circle at 90% 20%, rgba(31, 116, 188, 0.1) 0%, transparent 50%),
    radial-gradient(circle at 10% 90%, rgba(34, 192, 196, 0.06) 0%, transparent 50%);
  animation: backgroundPulse 8s ease-in-out infinite;
}

.avatar-background::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    radial-gradient(circle at 60% 40%, rgba(34, 192, 196, 0.1) 0%, transparent 60%),
    radial-gradient(circle at 30% 60%, rgba(31, 116, 188, 0.08) 0%, transparent 60%),
    radial-gradient(circle at 70% 20%, rgba(34, 192, 196, 0.05) 0%, transparent 60%);
  animation: backgroundPulse 12s ease-in-out infinite reverse;
}

@keyframes backgroundPulse {
  0%, 100% {
    opacity: 0.6;
    transform: scale(1) rotate(0deg);
  }
  25% {
    opacity: 0.8;
    transform: scale(1.05) rotate(1deg);
  }
  50% {
    opacity: 0.7;
    transform: scale(1.1) rotate(0deg);
  }
  75% {
    opacity: 0.9;
    transform: scale(1.03) rotate(-1deg);
  }
}

/* Hide background when HeyGen is active */
.avatar-embed#heygen-container.active ~ .avatar-background,
.avatar-embed#heygen-container.active + .avatar-background {
  display: none;
}

.avatar-embed {
  position: absolute;
  top: 35px; /* Account for increased padding */
  left: 35px; /* Account for increased padding */
  right: 35px; /* Account for increased padding */
  bottom: 35px; /* Account for increased padding */
  width: calc(100% - 70px); /* Subtract total horizontal padding */
  height: calc(100% - 70px); /* Subtract total vertical padding */
  display: none;
  border-radius: 8px; /* Add slight rounding to the iframe area */
  overflow: hidden;
  z-index: 2; /* Above the background */
}

.avatar-embed.active {
  display: block;
}

.avatar-embed iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
  border-radius: 8px; /* Match the container rounding */
  background: transparent; /* Allow background to show through */
  touch-action: manipulation; /* Improve touch interaction */
  -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
}

/* Mobile-specific iframe optimizations */
@media (max-width: 768px) {
  .avatar-modal {
    max-width: 400px !important;
    width: 100vw !important;
  }
  .avatar-iframe-container {
    display: block;
    text-align: center;
    padding-left: 0;
    padding-right: 0;
  }
  .avatar-embed {
    display: none;
    width: auto;
    max-width: 340px;
    margin: 0 auto 12px auto;
    float: none;
    vertical-align: top;
  }
  .avatar-embed.active {
    display: inline-block;
  }
  .avatar-embed iframe {
    width: 100%;
    display: block;
  }
  
  /* Specific centering fix for HeyGen on mobile */
  #heygen-container.avatar-embed {
    margin-left: 0 !important; /* Remove specific offsets, rely on parent centering */
    margin-right: 0 !important;
    padding-right: 0 !important; /* Remove specific padding */
  }
  
  #heygen-container #heygen-streaming-embed {
    margin-left: 0;
    padding-right: 0 !important;
    margin-right: 0;
  }
}

/* Responsive adjustments for welcome popup */
@media (max-width: 768px) {
  .intro-overlay {
    padding: 0.75rem;
    pointer-events: none !important; /* Force no pointer events on mobile */
    touch-action: none; /* Prevent any touch handling by overlay */
  }
  
  .intro-content {
    padding: 16px 24px 12px 24px;
    max-width: 420px;
    width: 95%;
    border-radius: 14px;
    pointer-events: auto; /* Only content can receive touch events */
    touch-action: manipulation; /* Allow normal touch interactions on content */
  }
  
  .intro-text {
    font-size: 1.2rem;
    line-height: 1.25;
    margin-bottom: 10px;
  }
  
  .intro-logo {
    height: 0.85em;
  }
  
  .intro-progress-container {
    margin-top: 6px;
  }
  
  .intro-progress-bar {
    height: 2px;
  }
  
  /* Adjust gradient border for mobile */
  .intro-content::before {
    border-radius: 14px;
  }
}

@media (max-width: 480px) {
  .intro-overlay {
    padding: 0.5rem;
    pointer-events: none !important; /* Force no pointer events on small mobile */
    touch-action: none; /* Prevent any touch handling by overlay */
  }
  
  .intro-content {
    padding: 14px 20px 10px 20px;
    max-width: 360px;
    width: 98%;
    border-radius: 12px;
    pointer-events: auto; /* Only content can receive touch events */
    touch-action: manipulation; /* Allow normal touch interactions on content */
  }
  
  .intro-text {
    font-size: 1.1rem;
    line-height: 1.2;
    margin-bottom: 8px;
  }
  
  .intro-word {
    margin: 0 0.1em;
  }
  
  .intro-logo {
    height: 0.8em;
  }
  
  .intro-progress-container {
    margin-top: 5px;
  }
  
  .intro-progress-bar {
    height: 1.5px;
  }
  
  .intro-progress-fill {
    border-radius: 1.5px;
  }
  
  /* Adjust gradient border for small screens */
  .intro-content::before {
    border-radius: 12px;
  }
}

/* Adjust hero section spacing */
.hero-header {
  margin-bottom: 0.5rem;
}

.hero-description {
  margin-bottom: 0;
}

/* Fix hero panels spacing */
.hero-panels {
  margin-top: 0.5rem;
}

/* Avatar Loading Bar */
.avatar-loading-container {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: rgba(0, 0, 0, 0.2);
  z-index: 1000;
  overflow: hidden;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.avatar-loading-container.show {
  opacity: 1;
}

.avatar-loading-bar {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #22C0C4 0%, #1F74BC 50%, #22C0C4 100%);
  background-size: 200% 100%;
  transition: width 4.5s cubic-bezier(0.4, 0, 0.2, 1);
  animation: shimmerLoading 1.5s linear infinite;
  box-shadow: 0 0 10px rgba(34, 192, 196, 0.5);
}

@keyframes shimmerLoading {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

.avatar-loading-bar.complete {
  width: 100% !important;
}

/* Loading text that appears below the bar */
.avatar-loading-text {
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.7);
  font-weight: 500;
  letter-spacing: 0.05em;
  opacity: 0;
  transition: opacity 0.3s ease;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  z-index: 1001;
}

.avatar-loading-container.show .avatar-loading-text {
  opacity: 1;
}

/* Avatar Swap Button */
.avatar-swap-button {
  position: fixed;
  bottom: 290px; /* Position above the avatar widget with more space */
  left: 30px; /* More padding from the edge */
  z-index: 999999999;
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.3s ease;
  pointer-events: none;
}

.avatar-swap-button.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.swap-avatar-btn {
  background: linear-gradient(135deg, #00ffff, #0080ff);
  border: none;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  position: relative;
  overflow: hidden;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  gap: 6px;
  /* Ensure proper touch handling */
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.swap-avatar-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), transparent);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.swap-avatar-btn:hover::before {
  opacity: 1;
}

.swap-avatar-btn:hover {
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 8px 24px rgba(0, 255, 255, 0.3);
  background: linear-gradient(135deg, #22ffff, #2090ff);
}

.swap-avatar-btn:active {
  transform: translateY(0) scale(0.95);
  transition: all 0.1s ease;
}

/* Disable hover effects on touch devices for swap button */
@media (hover: none) and (pointer: coarse) {
  .swap-avatar-btn:hover {
    transform: none;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    background: linear-gradient(135deg, #00ffff, #0080ff);
  }
  
  .swap-avatar-btn:hover::before {
    opacity: 0;
  }
}

.swap-avatar-btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.swap-btn-text {
  font-size: 12px;
  font-weight: 500;
}

/* Mobile positioning for swap button */
@media (max-width: 768px) {
  .avatar-swap-button {
    bottom: 290px; /* Adjust for larger mobile avatar positioning */
    left: calc(50% + 120px); /* Adjusted for wider button with text */
    transform: translateX(-50%) translateY(20px);
  }
  
  .avatar-swap-button.visible {
    transform: translateX(-50%) translateY(0);
  }
}

/* Very small mobile screens */
@media (max-width: 480px) {
  .avatar-swap-button {
    bottom: 250px;
    left: calc(50% + 100px); /* Adjusted for wider button on small screens */
  }
}

/* Avatar Expand Button (Mobile Only) */
.avatar-expand-button {
  position: fixed;
  bottom: 240px; /* Position below the swap button */
  left: calc(50% + 140px); /* Align with swap button */
  z-index: 999999999;
  opacity: 0;
  transform: translateX(-50%) translateY(20px);
  transition: all 0.3s ease;
  pointer-events: none;
  display: none; /* Hidden by default, shown only on mobile */
}

.avatar-expand-button.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}

.expand-avatar-btn {
  background: linear-gradient(135deg, #00ffff, #0080ff);
  border: none;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  position: relative;
  overflow: hidden;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  /* Ensure proper touch handling */
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.expand-avatar-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), transparent);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.expand-avatar-btn:hover::before {
  opacity: 1;
}

.expand-avatar-btn:hover {
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 8px 24px rgba(0, 255, 255, 0.3);
  background: linear-gradient(135deg, #22ffff, #2090ff);
}

.expand-avatar-btn:active {
  transform: translateY(0) scale(0.95);
  transition: all 0.1s ease;
}

/* Disable hover effects on touch devices for expand button */
@media (hover: none) and (pointer: coarse) {
  .expand-avatar-btn:hover {
    transform: none;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    background: linear-gradient(135deg, #00ffff, #0080ff);
  }
  
  .expand-avatar-btn:hover::before {
    opacity: 0;
  }
}

.expand-btn-text {
  font-size: 12px;
  font-weight: 500;
}

/* Show expand button only on mobile */
@media (max-width: 768px) {
  .avatar-expand-button {
    display: block;
    bottom: 240px; /* Position below swap button */
    left: calc(50% + 120px); /* Align with updated swap button position */
    transform: translateX(-50%) translateY(20px);
  }
  
  .avatar-expand-button.visible {
    transform: translateX(-50%) translateY(0);
  }
}

/* Very small mobile screens */
@media (max-width: 480px) {
  .avatar-expand-button {
    bottom: 200px; /* Position below swap button */
    left: calc(50% + 100px); /* Align with updated swap button position */
  }
}

/* Hide expand button when chatbot is open on mobile */
@media (max-width: 768px) {
  .avatar-expand-button.chatbot-hidden-avatar {
    opacity: 0 !important;
    pointer-events: none !important;
    transform: translateX(-50%) translateY(20px) scale(0.9) !important;
    transition: all 0.3s ease !important;
  }
}

/* Expanded avatar state */
.embedded-avatar.expanded {
  width: 85vw !important;
  height: 75vh !important;
  bottom: 50% !important;
  left: 50% !important;
  transform: translate(-50%, 50%) !important;
  z-index: 999999999;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  /* Disable ALL hover effects when expanded */
  pointer-events: auto !important;
}

.embedded-avatar.expanded iframe {
  border-radius: 16px;
  /* Ensure iframe is fully interactive */
  pointer-events: auto !important;
  touch-action: manipulation !important;
}

/* Completely disable hover effects when avatar is expanded */
.embedded-avatar.expanded:hover {
  transform: translate(-50%, 50%) !important;
  width: 85vw !important;
  height: 75vh !important;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5) !important;
}

/* Force disable hover on touch devices when expanded */
@media (hover: none) and (pointer: coarse) {
  .embedded-avatar.expanded:hover {
    transform: translate(-50%, 50%) !important;
    width: 85vw !important;
    height: 75vh !important;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5) !important;
  }
}

/* Modal Logo Styles */
.modal-logo {
  height: 32px;
  width: auto;
  opacity: 0.9;
}

.auth-logo {
  text-align: center;
  margin-bottom: 20px;
}

.swap-logo {
  text-align: center;
  margin-bottom: 16px;
}

/* Avatar Swap Confirmation Modal */
.avatar-swap-confirmation {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(5px);
  z-index: 9999999999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.avatar-swap-confirmation.show {
  opacity: 1;
  visibility: visible;
}

.swap-confirmation-content {
  background: rgba(20, 20, 20, 0.95);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 20px;
  max-width: 320px;
  width: 90%;
  text-align: center;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
  transform: scale(0.9) translateY(20px);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.avatar-swap-confirmation.show .swap-confirmation-content {
  transform: scale(1) translateY(0);
}

.swap-confirmation-title {
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 8px 0;
}

.swap-confirmation-message {
  color: rgba(255, 255, 255, 0.8);
  font-size: 14px;
  line-height: 1.4;
  margin: 0 0 20px 0;
}

.swap-confirmation-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.swap-confirm-btn,
.swap-cancel-btn {
  padding: 10px 20px;
  border-radius: 8px;
  border: none;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  min-width: 100px;
}

.swap-confirm-btn {
  background: linear-gradient(135deg, #00ffff, #0080ff);
  color: white;
}

.swap-confirm-btn:hover {
  background: linear-gradient(135deg, #22ffff, #2090ff);
  transform: translateY(-1px);
}

.swap-cancel-btn {
  background: rgba(255, 255, 255, 0.1);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.swap-cancel-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}

/* Mobile adjustments for confirmation modal */
@media (max-width: 480px) {
  .swap-confirmation-content {
    max-width: 280px;
    padding: 16px;
  }
  
  .swap-confirmation-buttons {
    flex-direction: column;
    gap: 8px;
  }
  
  .swap-confirm-btn,
  .swap-cancel-btn {
    width: 100%;
  }
}

/* Compact layout when the viewport height is limited */
@media (max-height: 850px) {
  .avatar-button-container {
    margin: 0.25rem 0;
  }
}

/* NOTE: Removed all blur-related CSS (deck.blurred, deck.blurred-smooth, deck.blurred-upper) 
   since we're using notification style without blur effects */

/* Avatar Loading Bar */

/* Avatar error message styling */
.avatar-error-message {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.8);
  border-radius: 10px;
  color: white;
  font-family: var(--font-main);
  max-width: 90%;
  width: 300px;
}

.avatar-error-message p {
  margin: 10px 0;
  font-size: 14px;
  line-height: 1.5;
}

.avatar-error-message button {
  margin-top: 15px;
  padding: 10px 20px;
  background: var(--color-accent);
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.3s ease;
}

.avatar-error-message button:hover {
  background: var(--color-accent-hover, #0066cc);
}
