/* ============================================================
   taimurtools.com — Animated AI Chatbot preloader
   Original design provided by Taimur (2026-05). All rules are
   scoped to `.tt-preloader-overlay` so they can't bleed into
   the host page.
   ============================================================ */

.tt-preloader-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  justify-content: center;
  align-items: center;
  background: radial-gradient(circle at center, #f8faff 0%, #eef2f7 100%);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  overflow: hidden;
  /* Fade-out controlled by JS via the .tt-preloader-hide class. */
  opacity: 1;
  transition: opacity .35s ease;
}
.tt-preloader-overlay.tt-preloader-hide { opacity: 0; pointer-events: none; }

/* Container centering the system */
.tt-preloader-overlay .stage {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 300px;
  height: 440px;
}

/* Floating Thought Bubble */
.tt-preloader-overlay .thought-bubble {
  position: absolute;
  top: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 50px;
  height: 35px;
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.06);
  animation: tt-bubble-float 3s ease-in-out infinite;
  z-index: 10;
}
.tt-preloader-overlay .thought-bubble::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  border-width: 6px 6px 0;
  border-style: solid;
  border-color: #ffffff transparent;
  display: block;
  width: 0;
}

/* Typing Dots Inside Bubble */
.tt-preloader-overlay .bubble-dot {
  width: 5px;
  height: 5px;
  background-color: #00cdfe;
  border-radius: 50%;
  animation: tt-dot-pulse 1.2s infinite ease-in-out;
}
.tt-preloader-overlay .bubble-dot:nth-child(2) { animation-delay: 0.2s; }
.tt-preloader-overlay .bubble-dot:nth-child(3) { animation-delay: 0.4s; }

/* Robot Body Rig */
.tt-preloader-overlay .robot-bot {
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: tt-bot-hover 3s ease-in-out infinite;
  z-index: 5;
}

/* Head */
.tt-preloader-overlay .bot-head {
  position: relative;
  width: 150px;
  height: 110px;
  background: linear-gradient(to bottom, #ffffff 0%, #e2e6f0 100%);
  border-radius: 46px;
  box-shadow: 0 10px 25px rgba(180, 190, 210, 0.4),
              inset 0 4px 2px rgba(255, 255, 255, 0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 3;
}
.tt-preloader-overlay .bot-head::before,
.tt-preloader-overlay .bot-head::after {
  content: '';
  position: absolute;
  top: 40px;
  width: 14px;
  height: 28px;
  background: #d4d9e5;
  border-radius: 6px;
}
.tt-preloader-overlay .bot-head::before { left: -10px; border-radius: 8px 0 0 8px; }
.tt-preloader-overlay .bot-head::after  { right: -10px; border-radius: 0 8px 8px 0; }

/* Visor */
.tt-preloader-overlay .bot-visor {
  position: relative;
  width: 122px;
  height: 82px;
  background: linear-gradient(135deg, #152030 0%, #0a0f18 100%);
  border-radius: 32px;
  box-shadow: inset 0 3px 8px rgba(0, 0, 0, 0.8),
              0 2px 3px rgba(255, 255, 255, 0.3);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 6px;
  overflow: hidden;
}

/* Eyes + Mouth */
.tt-preloader-overlay .face-matrix {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 22px;
  margin-top: 8px;
  animation: tt-face-blink 4s ease-in-out infinite;
}
.tt-preloader-overlay .eye {
  width: 20px;
  height: 14px;
  background-color: #00f3ff;
  border-radius: 50% 50% 30% 30%;
  box-shadow: 0 0 12px rgba(0, 243, 255, 0.8), 0 0 20px rgba(0, 243, 255, 0.4);
}
.tt-preloader-overlay .mouth {
  width: 16px;
  height: 8px;
  background-color: #00f3ff;
  border-radius: 0 0 12px 12px;
  box-shadow: 0 0 10px rgba(0, 243, 255, 0.8);
  margin-top: 2px;
}

/* Neck */
.tt-preloader-overlay .bot-neck {
  width: 32px;
  height: 16px;
  background: linear-gradient(to right, #bcbfc9, #dcdfe7, #bcbfc9);
  margin-top: -6px;
  border-radius: 4px;
  z-index: 2;
}

/* Torso + Arms */
.tt-preloader-overlay .bot-body-wrapper {
  position: relative;
  display: flex;
  justify-content: center;
  width: 160px;
}
.tt-preloader-overlay .bot-torso {
  width: 105px;
  height: 95px;
  background: linear-gradient(135deg, #ffffff 0%, #e1e5f2 100%);
  border-radius: 50% 50% 45% 45%;
  box-shadow: 0 10px 20px rgba(180, 190, 210, 0.4),
              inset 0 3px 4px rgba(255, 255, 255, 0.9);
  z-index: 2;
}
.tt-preloader-overlay .bot-torso::after {
  content: '';
  position: absolute;
  top: 60px;
  left: 45px;
  width: 70px;
  height: 30px;
  border: 2px solid #cbd2e1;
  border-bottom: none;
  border-radius: 12px 12px 0 0;
  opacity: 0.7;
}
.tt-preloader-overlay .arm {
  position: absolute;
  top: 10px;
  width: 24px;
  height: 65px;
  background: linear-gradient(to bottom, #ffffff 0%, #d6dbf0 100%);
  border-radius: 14px;
  box-shadow: 0 6px 12px rgba(180, 190, 210, 0.3);
  z-index: 1;
  transform-origin: top center;
}
.tt-preloader-overlay .arm-left {
  left: 10px;
  transform: rotate(8deg);
  animation: tt-arm-left 3s ease-in-out infinite alternate;
}
.tt-preloader-overlay .arm-right {
  right: 10px;
  transform: rotate(-8deg);
  animation: tt-arm-right 3s ease-in-out infinite alternate;
}

/* Floor shadow */
.tt-preloader-overlay .floor-shadow {
  width: 80px;
  height: 12px;
  background: rgba(160, 175, 200, 0.35);
  border-radius: 50%;
  margin-top: 25px;
  filter: blur(2px);
  animation: tt-shadow-scale 3s ease-in-out infinite;
}

/* Loading text */
.tt-preloader-overlay .loading-text {
  margin-top: 25px;
  color: #7a869a;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 3px;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 2px;
  animation: tt-text-breathe 2s ease-in-out infinite;
}
.tt-preloader-overlay .loading-dots span {
  display: inline-block;
  animation: tt-text-dots 1.4s infinite ease-in-out both;
}
.tt-preloader-overlay .loading-dots span:nth-child(1) { animation-delay: 0s; }
.tt-preloader-overlay .loading-dots span:nth-child(2) { animation-delay: 0.16s; }
.tt-preloader-overlay .loading-dots span:nth-child(3) { animation-delay: 0.32s; }

/* ─── Keyframes (prefixed so they can't collide with host-page keyframes) ─── */
@keyframes tt-bot-hover {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-12px); }
}
@keyframes tt-bubble-float {
  0%, 100% { transform: translateY(0) scale(1); }
  50%      { transform: translateY(-6px) scale(1.03); }
}
@keyframes tt-face-blink {
  0%, 92%, 100% { transform: scaleY(1); }
  96%           { transform: scaleY(0.08); }
}
@keyframes tt-dot-pulse {
  0%, 100% { transform: scale(0.7); opacity: 0.3; }
  50%      { transform: scale(1.2); opacity: 1; }
}
@keyframes tt-arm-left {
  0%   { transform: rotate(6deg)  translateY(0); }
  100% { transform: rotate(11deg) translateY(2px); }
}
@keyframes tt-arm-right {
  0%   { transform: rotate(-6deg)  translateY(0); }
  100% { transform: rotate(-11deg) translateY(2px); }
}
@keyframes tt-shadow-scale {
  0%, 100% { transform: scale(1); opacity: 0.8; filter: blur(2px); }
  50%      { transform: scale(0.78); opacity: 0.4; filter: blur(4px); }
}
@keyframes tt-text-breathe {
  0%, 100% { opacity: 0.6; color: #7a869a; }
  50%      { opacity: 1;   color: #4b5565; }
}
@keyframes tt-text-dots {
  0%, 80%, 100% { opacity: 0.2; transform: scale(0.8); }
  40%           { opacity: 1; transform: scale(1.2); color: #00cdfe; }
}

/* Respect reduced-motion users — show a static version instead of constant motion. */
@media (prefers-reduced-motion: reduce) {
  .tt-preloader-overlay *,
  .tt-preloader-overlay *::before,
  .tt-preloader-overlay *::after { animation: none !important; }
}
