/* ==========================================================================
   BUTTERCUP STUDIO - UNIVERSAL 3D IRIDESCENT AI ASSISTANT & PARTICLE SYSTEM
   ========================================================================== */

/* Outer Widget Wrapper (Anchored bottom-right across the entire website) - HIDDEN per user request */
.btr-ai-orb-widget {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

/* Ambient Siri Resonance & Diamond Stardust Canvas (Centered symmetrically) */
.btr-ai-sparks-canvas {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 220px;
  height: 220px;
  pointer-events: none;
  z-index: 1;
  overflow: visible;
  filter: drop-shadow(0 0 16px rgba(168, 85, 247, 0.55));
}

/* Apple Intelligence Fluid Aura Halo */
.btr-ai-orb-halo {
  position: absolute;
  inset: -14px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(168, 85, 247, 0.45) 0%, rgba(56, 189, 248, 0.3) 42%, rgba(244, 63, 94, 0.18) 64%, transparent 75%);
  filter: blur(14px);
  pointer-events: none;
  z-index: 2;
  animation: btr-halo-siri 4.2s infinite ease-in-out;
}

@keyframes btr-halo-siri {
  0%, 100% {
    transform: scale(0.92);
    opacity: 0.65;
  }
  50% {
    transform: scale(1.18);
    opacity: 0.95;
  }
}

/* Iridescent 3D Orb Button (Interactive Trigger) */
.em-orb-toggle,
.btr-ai-orb-button {
  position: relative;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: transparent;
  border: none;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  outline: none;
  pointer-events: auto;
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), filter 0.4s ease;
  padding: 0;
  margin: 0;
  animation: btr-orb-float 4.2s infinite ease-in-out;
}

@keyframes btr-orb-float {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-5px);
  }
}

.em-orb-toggle:hover,
.btr-ai-orb-button:hover {
  transform: scale(1.12) translateY(-3px);
}

/* Canvas containing the 3D Iridescent Holographic Butterfly */
.em-orb-canvas,
.btr-ai-orb-canvas {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 4px 18px rgba(168, 85, 247, 0.65)) drop-shadow(0 0 28px rgba(236, 72, 153, 0.45));
  display: block;
  pointer-events: none;
}

/* ==========================================================================
   DYNAMIC CONVERSATIONAL POP BUBBLE (Cycles every 3 seconds)
   ========================================================================== */
.em-ai-bubble,
.btr-ai-bubble {
  position: absolute;
  top: 50%;
  right: calc(100% + 14px);
  transform: translateY(-50%) translateX(16px) scale(0.85);
  background: rgba(14, 8, 26, 0.94);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  color: #ffffff;
  padding: 0.65rem 1.15rem;
  border-radius: 9999px;
  border: 1px solid rgba(168, 85, 247, 0.45);
  font-family: 'MG12', 'Figtree', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 0.76rem;
  font-weight: 500;
  letter-spacing: 0.035em;
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.45), 0 0 25px rgba(168, 85, 247, 0.28);
  z-index: 99999;
  pointer-events: none;
  cursor: pointer;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: transform 0.38s cubic-bezier(0.34, 1.56, 0.64, 1), 
              opacity 0.25s ease, 
              visibility 0.25s ease, 
              border-color 0.3s ease, 
              box-shadow 0.3s ease;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  user-select: none;
}

@keyframes btr-bubble-gentle-float {
  0%, 100% {
    transform: translateY(-50%) translateX(0) scale(1);
  }
  50% {
    transform: translateY(-54%) translateX(0) scale(1.02);
  }
}

/* POPPED IN STATE (Every 4s for ~1.2s OR on hover) */
.btr-ai-bubble.is-visible,
.em-ai-bubble.is-visible {
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
  transform: translateY(-50%) translateX(0) scale(1) !important;
  animation: btr-bubble-gentle-float 4.2s infinite ease-in-out;
}

.em-ai-bubble:hover,
.btr-ai-bubble:hover {
  transform: translateY(-50%) translateX(0) scale(1.06) !important;
  border-color: rgba(56, 189, 248, 0.7) !important;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.55), 0 0 30px rgba(56, 189, 248, 0.4) !important;
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
}

.btr-ai-bubble.is-popping {
  transform: translateY(-50%) translateX(0) scale(1.08) !important;
  box-shadow: 0 16px 45px rgba(0, 0, 0, 0.6), 0 0 35px rgba(168, 85, 247, 0.55) !important;
}

.btr-ai-bubble.is-hidden {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
  transform: translateY(-50%) translateX(16px) scale(0.85) !important;
}

.btr-bubble-pulse {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 10px #10b981, 0 0 4px #34d399;
  display: inline-block;
  flex-shrink: 0;
  animation: btr-pulse-beacon 2s infinite ease-in-out;
}

@keyframes btr-pulse-beacon {
  0%, 100% {
    opacity: 0.65;
    transform: scale(0.85);
  }
  50% {
    opacity: 1;
    transform: scale(1.3);
  }
}

.btr-bubble-text {
  display: inline-block;
  color: #f1f5f9;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.btr-bubble-spark {
  color: #d8b4fe;
  font-size: 0.85rem;
  line-height: 1;
  display: inline-block;
  animation: btr-spark-shimmer 2.5s infinite ease-in-out;
}

@keyframes btr-spark-shimmer {
  0%, 100% {
    transform: rotate(0deg) scale(1);
    opacity: 0.85;
  }
  50% {
    transform: rotate(15deg) scale(1.25);
    opacity: 1;
  }
}

.em-ai-bubble::after,
.btr-ai-bubble::after {
  content: "";
  position: absolute;
  top: 50%;
  right: -5px;
  transform: translateY(-50%) rotate(45deg);
  width: 10px;
  height: 10px;
  background: rgba(14, 8, 26, 0.96);
  border-right: 1px solid rgba(168, 85, 247, 0.45);
  border-top: 1px solid rgba(168, 85, 247, 0.45);
}

/* Mobile responsive placement */
@media (max-width: 768px) {
  .em-ai-bubble,
  .btr-ai-bubble {
    display: none !important;
  }
  .btr-ai-orb-widget {
    bottom: 1.25rem;
    right: 1.25rem;
    width: 52px;
    height: 52px;
  }
  .em-orb-toggle,
  .btr-ai-orb-button {
    width: 52px;
    height: 52px;
  }
  .btr-ai-sparks-canvas {
    bottom: -20px;
    right: -45px;
    width: 140px;
    height: 220px;
  }
}

/* ==========================================================================
   FULL-SCREEN L.I.S.A. 3D AI ASSISTANT OVERLAY
   ========================================================================== */

.em-ai-overlay {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 9999999;
  background: radial-gradient(circle at 62% 44%, #d4d1cc 0%, #b4b1ab 48%, #88857f 100%);
  display: block;
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.4s;
  overflow: hidden;
  color: #0a0a0a;
  user-select: none;
  -webkit-font-smoothing: antialiased;
}

.em-ai-overlay.is-open {
  opacity: 1;
  pointer-events: auto;
  visibility: visible;
}

/* Ensure custom cursor dot/ring always render above AI modal */
.custom-cursor-dot,
.custom-cursor-ring {
  z-index: 2147483647 !important;
  pointer-events: none !important;
}

/* When AI modal is open — restore native cursor so user can always see it.
   This overrides the global cursor:none from extra.css (ai-assistant.css loads after extra.css). */
html.em-modal-open .em-ai-overlay,
html.em-modal-open .em-ai-overlay * {
  cursor: auto !important;
}
html.em-modal-open .em-ai-overlay input,
html.em-modal-open .em-ai-overlay textarea {
  cursor: text !important;
}
html.em-modal-open .em-ai-overlay button,
html.em-modal-open .em-ai-overlay a,
html.em-modal-open .em-ai-overlay [role="button"] {
  cursor: pointer !important;
}

.em-ai-overlay * {
  box-sizing: border-box;
}

.em-ai-overlay input {
  cursor: text !important;
  user-select: text !important;
}

.em-ai-overlay button,
.em-ai-overlay a,
.em-ai-chip,
.em-ai-sound-pill {
  cursor: pointer !important;
}

/* 3D WebGL Canvas (Full-screen background behind UI) */
.em-ai-webgl-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  display: block;
  pointer-events: none;
}

/* UI Overlay Layer */
.em-ai-ui-layer {
  position: absolute;
  inset: 0;
  z-index: 10;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: clamp(1.8rem, 3.5vw, 3rem) clamp(2rem, 4.5vw, 4rem);
}

/* Top Bar */
.em-ai-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  pointer-events: auto !important;
  position: relative;
  z-index: 100 !important;
}

.em-ai-logo-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: clamp(1.2rem, 1.8vw, 1.55rem);
  font-weight: 600;
  letter-spacing: -0.025em;
  color: #0a0a0a !important;
  text-decoration: none !important;
  cursor: pointer !important;
  pointer-events: auto !important;
  transition: opacity 0.2s ease, transform 0.2s ease;
  user-select: none;
  position: relative;
  z-index: 110 !important;
}

.em-ai-logo-wrap:hover {
  opacity: 0.7;
  transform: scale(1.02);
}

.em-ai-star-mark {
  font-size: 0.95rem;
  opacity: 0.75;
}

.em-ai-top-right {
  display: flex;
  align-items: center;
  gap: 1.6rem;
  pointer-events: auto !important;
  position: relative;
  z-index: 110 !important;
}

.em-ai-talk-link {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: clamp(1.05rem, 1.4vw, 1.3rem);
  font-weight: 500;
  color: #0a0a0a !important;
  text-decoration: none !important;
  cursor: pointer !important;
  pointer-events: auto !important;
  transition: opacity 0.2s ease;
}

.em-ai-talk-link:hover {
  opacity: 0.6;
}

.em-ai-close-btn {
  width: 44px !important;
  height: 44px !important;
  border-radius: 50% !important;
  background: rgba(0, 0, 0, 0.08) !important;
  border: 1px solid rgba(0, 0, 0, 0.08) !important;
  cursor: pointer !important;
  pointer-events: auto !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  color: #0a0a0a !important;
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1) !important;
  outline: none !important;
  position: relative !important;
  z-index: 120 !important;
}

.em-ai-close-btn:hover {
  background: rgba(0, 0, 0, 0.18) !important;
  transform: scale(1.1) rotate(90deg) !important;
}

.em-ai-close-btn svg {
  pointer-events: none !important;
}

/* Left Content Area */
.em-ai-content-area {
  display: flex;
  flex-direction: column;
  max-width: 470px;
  margin-top: auto;
  margin-bottom: auto;
  padding-top: 1rem;
  pointer-events: auto;
}

.em-ai-whisper-text {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: clamp(0.92rem, 1.2vw, 1.1rem);
  color: #444444;
  line-height: 1.45;
  margin-bottom: 1.25rem;
  font-weight: 400;
  letter-spacing: -0.01em;
}

.em-ai-headline-wrap {
  margin-bottom: 1.6rem;
}

.em-ai-headline {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: clamp(1.85rem, 3.1vw, 3.15rem);
  font-weight: 600;
  line-height: 1.12;
  letter-spacing: -0.035em;
  color: #0a0a0a;
  margin: 0;
  transition: opacity 0.2s ease;
}

.em-ai-response-details {
  margin-top: 0.9rem;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  padding: 1.1rem 1.35rem;
  border-radius: 18px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.06);
  font-size: 0.94rem;
  line-height: 1.55;
  color: #1f1f1f;
  max-height: 200px;
  overflow-y: auto;
  pointer-events: auto;
  user-select: text;
  scrollbar-width: thin;
}

.em-ai-response-details::-webkit-scrollbar {
  width: 4px;
}
.em-ai-response-details::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 4px;
}

/* Suggestion Chips */
.em-ai-chips-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-bottom: 1.4rem;
  pointer-events: auto;
}

.em-ai-chip {
  background: #ffffff;
  color: #111111;
  padding: 0.62rem 1.35rem;
  border-radius: 999px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 0.92rem;
  font-weight: 500;
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
  cursor: pointer;
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  outline: none;
}

.em-ai-chip:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.09);
  border-color: rgba(0, 0, 0, 0.22);
}

.em-ai-chip:active {
  transform: translateY(0);
}

/* Sleek Minimal Chat Input Form */
.em-ai-input-form {
  pointer-events: auto;
  margin-bottom: 1.3rem;
  width: 100%;
}

.em-ai-input-wrapper {
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 999px;
  padding: 0.32rem 0.45rem 0.32rem 0.85rem;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.05);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.em-ai-input-wrapper:focus-within {
  border-color: #0a0a0a;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.09);
  background: #ffffff;
}

.em-ai-input-field {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 0.92rem;
  color: #0a0a0a;
  padding: 0.35rem 0.5rem;
}

.em-ai-input-field::placeholder {
  color: #777777;
}

.em-ai-mic-btn {
  background: none;
  border: none;
  color: #555555;
  padding: 0.35rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s, transform 0.2s;
  outline: none;
  cursor: pointer;
}

.em-ai-mic-btn:hover {
  color: #000000;
  transform: scale(1.1);
}

.em-ai-mic-btn.is-listening {
  color: #e63946;
  animation: em-mic-pulse 1s infinite alternate;
}

.em-ai-send-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #000000;
  color: #ffffff;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s, opacity 0.2s;
  outline: none;
  cursor: pointer;
}

.em-ai-send-btn:hover {
  transform: scale(1.08);
  opacity: 0.88;
}

/* Write us row */
.em-ai-write-us {
  font-size: 0.88rem;
  color: #4a4a4a;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  pointer-events: auto;
}

.em-ai-write-us a {
  color: #111111;
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: opacity 0.2s;
}

.em-ai-write-us a:hover {
  opacity: 0.65;
}

.em-ai-copy-btn {
  background: none;
  border: none;
  color: #555555;
  padding: 0.2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: color 0.2s, transform 0.2s;
  outline: none;
}

.em-ai-copy-btn:hover {
  color: #000000;
  transform: scale(1.15);
}

/* Bottom Bar */
.em-ai-bottom-bar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  width: 100%;
  pointer-events: auto;
}

.em-ai-reset-btn {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: #000000;
  color: #ffffff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s;
  outline: none;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
}

.em-ai-reset-btn:hover {
  transform: scale(1.08) rotate(-45deg);
  opacity: 0.9;
}

.em-ai-sound-pill {
  background: #000000;
  color: #ffffff;
  width: 38px;
  height: 72px;
  border-radius: 999px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-around;
  padding: 0.45rem 0;
  cursor: pointer;
  transition: transform 0.2s, opacity 0.2s;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
  user-select: none;
  outline: none;
}

.em-ai-sound-pill:hover {
  transform: scale(1.05);
}

.em-ai-sound-icon {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.35;
  transition: opacity 0.2s;
}

.em-ai-sound-icon.is-active {
  opacity: 1;
}

/* Responsive */
@media (max-width: 900px) {
  .em-ai-ui-layer {
    padding: 1.5rem 1.5rem;
  }
  .em-ai-content-area {
    max-width: 100%;
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 1.2rem;
    border-radius: 20px;
    margin-top: auto;
    margin-bottom: 1rem;
  }
  .em-ai-headline {
    font-size: 1.65rem;
  }
}
