/*!
 * ==============================================================
 * ELAHE EKBATANI® Enterprise Platform
 * Module    : Robot
 * File      : robot.css
 * Author    : Elahe Ekbatani
 * Copyright : © 2026 Elahe Ekbatani. All Rights Reserved.
 * ==============================================================
 */

.elahe-robot {
  --robot-size: 68px;
  --robot-color: #c89b5d;
  --robot-dark: #8a5a3d;
  --robot-light: #f0d59e;
  --robot-face: #fff8ee;

  position: fixed;
  right: 22px;
  top: 120px;
  z-index: 9999;
  width: var(--robot-size);
  height: calc(var(--robot-size) * 1.35);
  pointer-events: auto;
  cursor: pointer;
  transition: top 0.45s cubic-bezier(0.22, 1, 0.36, 1);
  user-select: none;
  -webkit-user-select: none;
}

.elahe-robot__body {
  position: relative;
  width: 100%;
  height: 100%;
}

/* سر */
.elahe-robot__head {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 42px;
  height: 42px;
  background: linear-gradient(145deg, var(--robot-light), var(--robot-color));
  border-radius: 50%;
  box-shadow:
    0 4px 12px rgba(90, 55, 30, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.4);
  z-index: 3;
}

/* صورت */
.elahe-robot__face {
  position: absolute;
  inset: 8px;
  background: var(--robot-face);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

/* چشم‌ها */
.elahe-robot__eye {
  width: 6px;
  height: 6px;
  background: #3a2a1f;
  border-radius: 50%;
  transition: all 0.25s ease;
}

/* دهان */
.elahe-robot__mouth {
  position: absolute;
  bottom: 7px;
  left: 50%;
  transform: translateX(-50%);
  width: 10px;
  height: 4px;
  border-bottom: 2px solid #3a2a1f;
  border-radius: 0 0 8px 8px;
  transition: all 0.3s ease;
}

/* آنتن */
.elahe-robot__antenna {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  width: 3px;
  height: 12px;
  background: var(--robot-dark);
  border-radius: 2px;
}

.elahe-robot__antenna::after {
  content: "";
  position: absolute;
  top: -5px;
  left: 50%;
  transform: translateX(-50%);
  width: 8px;
  height: 8px;
  background: var(--robot-color);
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(200, 155, 93, 0.7);
  animation: robotAntennaPulse 2s ease-in-out infinite;
}

/* بدن */
.elahe-robot__torso {
  position: absolute;
  top: 38px;
  left: 50%;
  transform: translateX(-50%);
  width: 36px;
  height: 32px;
  background: linear-gradient(145deg, var(--robot-color), var(--robot-dark));
  border-radius: 10px 10px 14px 14px;
  box-shadow: 0 6px 14px rgba(70, 40, 20, 0.2);
  z-index: 2;
}

/* دست‌ها */
.elahe-robot__arm {
  position: absolute;
  top: 42px;
  width: 8px;
  height: 22px;
  background: var(--robot-dark);
  border-radius: 4px;
  z-index: 1;
  transform-origin: top center;
  transition: transform 0.35s ease;
}

.elahe-robot__arm--left {
  left: 6px;
}

.elahe-robot__arm--right {
  right: 6px;
}

/* حباب پیام */
.elahe-robot__bubble {
  position: absolute;
  bottom: calc(100% + 12px);
  right: 0;
  min-width: 90px;
  padding: 8px 12px;
  background: #fffaf4;
  border: 1px solid rgba(168, 93, 56, 0.25);
  border-radius: 12px 12px 4px 12px;
  box-shadow: 0 8px 20px rgba(70, 40, 20, 0.12);
  font-size: 11px;
  font-weight: 600;
  color: #5c3c2b;
  opacity: 0;
  transform: translateY(8px) scale(0.9);
  pointer-events: none;
  transition: all 0.3s ease;
  white-space: nowrap;
}

.elahe-robot__bubble.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* =========================================================
   حالت‌های رفتاری
========================================================= */

/* دست تکان دادن */
.elahe-robot.is-waving .elahe-robot__arm--right {
  animation: robotWave 0.6s ease-in-out infinite;
}

/* لبخند */
.elahe-robot.is-smiling .elahe-robot__mouth {
  width: 14px;
  height: 7px;
  border-bottom: 2.5px solid #3a2a1f;
  border-radius: 0 0 12px 12px;
}

/* چشمک */
.elahe-robot.is-winking .elahe-robot__eye--right {
  height: 2px;
  border-radius: 2px;
}

/* خواب */
.elahe-robot.is-sleeping .elahe-robot__eye {
  height: 2px;
  border-radius: 2px;
  background: #8a6a4f;
}

.elahe-robot.is-sleeping .elahe-robot__mouth {
  width: 8px;
  height: 3px;
  border-radius: 4px;
  border-bottom: none;
  background: #8a6a4f;
}

.elahe-robot.is-sleeping .elahe-robot__antenna::after {
  animation: none;
  opacity: 0.4;
}

/* هیجان‌زده */
.elahe-robot.is-excited .elahe-robot__eye {
  width: 7px;
  height: 7px;
  background: #5a3829;
}

.elahe-robot.is-excited .elahe-robot__mouth {
  width: 12px;
  height: 8px;
  border-radius: 50%;
  border-bottom: none;
  background: #3a2a1f;
}

/* اشاره کردن */
.elahe-robot.is-pointing .elahe-robot__arm--right {
  transform: rotate(35deg) translateY(-4px);
}

/* =========================================================
   انیمیشن‌ها
========================================================= */

@keyframes robotWave {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(25deg); }
  75% { transform: rotate(-15deg); }
}

@keyframes robotAntennaPulse {
  0%, 100% { opacity: 0.7; transform: translateX(-50%) scale(1); }
  50% { opacity: 1; transform: translateX(-50%) scale(1.15); }
}

/* ریسپانسیو */
@media (max-width: 768px) {
  .elahe-robot {
    right: 12px;
    --robot-size: 56px;
  }
}

@media (max-width: 480px) {
  .elahe-robot {
    display: none; /* در موبایل خیلی کوچک مخفی می‌شود */
  }
}

@media (prefers-reduced-motion: reduce) {
  .elahe-robot,
  .elahe-robot * {
    animation: none !important;
    transition: none !important;
  }
}