/*═══════════════════════════════════════════════════════════════
  ROBOT MASCOT v3 — Premium 3D with personality
═══════════════════════════════════════════════════════════════*/

.robot-mascot {
  position: relative;
  width: 110px;
  height: 140px;
  margin: 1.5rem auto 1rem auto;
  cursor: default;
  user-select: none;
  filter: drop-shadow(0 10px 24px rgba(212, 175, 55, 0.4));
  transition: filter 0.4s ease;
  animation: robot-idle-float 4s ease-in-out infinite;
}

@keyframes robot-idle-float {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  25%       { transform: translateY(-3px) rotate(-0.8deg); }
  75%       { transform: translateY(-2px) rotate(0.8deg); }
}

/* ─── جسم الروبوت (3D) ─── */
.robot-body {
  position: absolute;
  width: 72px;
  height: 72px;
  left: 50%;
  top: 50px;
  transform: translateX(-50%);
  background: radial-gradient(ellipse at 30% 25%, #fff5c8 0%, #ffd97a 25%, #d4af37 60%, #8b6f00 100%);
  border-radius: 18px 18px 26px 26px;
  border: 2px solid rgba(255, 235, 153, 0.8);
  box-shadow:
    inset -6px -8px 14px rgba(0, 0, 0, 0.3),
    inset 4px 5px 10px rgba(255, 255, 255, 0.45),
    inset 0 0 0 2px rgba(184, 148, 31, 0.4),
    0 4px 10px rgba(0, 0, 0, 0.2);
  animation: robot-breath 3.5s ease-in-out infinite;
}

@keyframes robot-breath {
  0%, 100% { transform: translateX(-50%) scale(1); }
  50%       { transform: translateX(-50%) scale(1.02); }
}

/* LEDs على الجسم */
.robot-body::before {
  content: '';
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  bottom: 12px;
  left: 18px;
  background: radial-gradient(circle, #ff4444 0%, #aa0000 100%);
  box-shadow:
    16px 0 0 -1px #4ade80,
    32px 0 0 -1px #60a5fa,
    0 0 4px rgba(255, 68, 68, 0.6),
    16px 0 4px rgba(74, 222, 128, 0.6),
    32px 0 4px rgba(96, 165, 250, 0.6);
  animation: robot-leds 2s ease-in-out infinite;
}

@keyframes robot-leds {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.5; }
}

/* قدمان */
.robot-body::after {
  content: '';
  position: absolute;
  width: 18px;
  height: 8px;
  background: linear-gradient(145deg, #b8941f, #8b6f00);
  border-radius: 4px;
  bottom: -6px;
  left: 8px;
  box-shadow: 28px 0 0 0 #b8941f, 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* شاشة الجسم مع نص متحرك */
.robot-screen {
  position: absolute;
  width: 42px;
  height: 18px;
  left: 50%;
  top: 18px;
  transform: translateX(-50%);
  background: linear-gradient(180deg, #001a0a 0%, #002a0e 50%, #001a0a 100%);
  border-radius: 4px;
  border: 1.5px solid rgba(212, 175, 55, 0.6);
  overflow: hidden;
  box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.8), inset 0 1px 2px rgba(212, 175, 55, 0.4);
}

.robot-screen::before {
  content: '01010 11001 00110';
  position: absolute;
  color: #4ade80;
  font-family: 'JetBrains Mono', monospace;
  font-size: 5px;
  font-weight: bold;
  text-shadow: 0 0 3px #4ade80;
  top: 6px;
  white-space: nowrap;
  animation: robot-screen-scroll 4s linear infinite;
}

@keyframes robot-screen-scroll {
  0%   { transform: translateX(50px); }
  100% { transform: translateX(-120px); }
}

/* ─── الرأس (3D) ─── */
.robot-head {
  position: absolute;
  width: 64px;
  height: 50px;
  left: 50%;
  top: 14px;
  transform: translateX(-50%);
  background: radial-gradient(ellipse at 30% 25%, #fff5c8 0%, #ffd97a 30%, #d4af37 70%, #b8941f 100%);
  border-radius: 18px 18px 14px 14px;
  border: 2px solid rgba(255, 235, 153, 0.8);
  box-shadow:
    inset -4px -5px 10px rgba(0, 0, 0, 0.25),
    inset 4px 4px 8px rgba(255, 255, 255, 0.45),
    0 3px 8px rgba(0, 0, 0, 0.2);
  z-index: 2;
}

/* الأذنان */
.robot-head::before,
.robot-head::after {
  content: '';
  position: absolute;
  width: 7px;
  height: 18px;
  background: linear-gradient(145deg, #d4af37, #8b6f00);
  border-radius: 3px;
  top: 14px;
  border: 1px solid rgba(255, 235, 153, 0.5);
  box-shadow: inset -1px 0 2px rgba(0, 0, 0, 0.3);
}

.robot-head::before { left: -6px; }
.robot-head::after  { right: -6px; }

/* ─── Antenna (3D) ─── */
.robot-antenna {
  position: absolute;
  width: 3px;
  height: 16px;
  left: 50%;
  top: -4px;
  transform: translateX(-50%);
  background: linear-gradient(to bottom, #ffd97a, #b8941f);
  border-radius: 2px;
}

.robot-antenna::before {
  content: '';
  position: absolute;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  background: radial-gradient(circle at 35% 30%, #ffffff 0%, #fff0b4 30%, #ffd97a 70%);
  box-shadow:
    0 0 14px rgba(255, 217, 122, 1),
    0 0 24px rgba(255, 217, 122, 0.6),
    inset -2px -2px 3px rgba(184, 148, 31, 0.5);
  animation: robot-antenna-glow 2s ease-in-out infinite;
}

@keyframes robot-antenna-glow {
  0%, 100% {
    box-shadow:
      0 0 14px rgba(255, 217, 122, 1),
      0 0 24px rgba(255, 217, 122, 0.6);
  }
  50% {
    box-shadow:
      0 0 20px rgba(255, 217, 122, 1),
      0 0 36px rgba(255, 217, 122, 0.8),
      0 0 50px rgba(255, 217, 122, 0.3);
  }
}

/* ─── العيون (3D) ─── */
.robot-eyes {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 12px;
  z-index: 3;
}

.robot-eye {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #2a2a2a 0%, #000 60%, #1a1a1a 100%);
  position: relative;
  overflow: hidden;
  box-shadow:
    inset -1px -1px 2px rgba(255, 255, 255, 0.15),
    inset 1px 1px 2px rgba(0, 0, 0, 0.8),
    0 1px 2px rgba(0, 0, 0, 0.3);
  transition: height 0.1s ease, border-radius 0.1s ease;
}

/* بؤبؤ العين */
.robot-eye::before {
  content: '';
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #ffd97a 0%, #d4af37 60%, #8b6f00 100%);
  top: 50%;
  left: 50%;
  transform: translate(calc(-50% + var(--pupil-x, 0px)), calc(-50% + var(--pupil-y, 0px)));
  transition: transform 0.12s ease-out;
  box-shadow: 0 0 4px rgba(212, 175, 55, 0.7);
}

/* لمعة العين */
.robot-eye::after {
  content: '';
  position: absolute;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  top: 2px;
  left: 3px;
  z-index: 2;
}

/* طرف دوري */
.robot-mascot:not(.robot-error):not(.robot-success):not(.robot-sending) .robot-eye {
  animation: robot-blink 5s ease-in-out infinite;
}

@keyframes robot-blink {
  0%, 92%, 100% { height: 14px; }
  94%, 96%      { height: 2px; }
}

/* ─── الفم ─── */
.robot-mouth {
  position: absolute;
  width: 20px;
  height: 5px;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  background: #1a1a1a;
  border-radius: 0 0 10px 10px;
  transition: all 0.3s ease;
  z-index: 3;
}

/* ─── الذراعان — ثابتتان دائماً ─── */
.robot-arm {
  position: absolute;
  width: 9px;
  height: 28px;
  background: linear-gradient(145deg, #ffd97a 0%, #d4af37 50%, #8b6f00 100%);
  border-radius: 5px;
  top: 60px;
  border: 1.5px solid rgba(255, 235, 153, 0.5);
  box-shadow: inset -1px 0 3px rgba(0, 0, 0, 0.3), inset 1px 0 2px rgba(255, 255, 255, 0.2);
}

.robot-arm.left  { left: 12px; }
.robot-arm.right { right: 12px; }

/* اليدان */
.robot-arm::after {
  content: '';
  position: absolute;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #ffd97a, #b8941f 70%, #8b6f00);
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  box-shadow: inset -2px -2px 3px rgba(0, 0, 0, 0.3), inset 1px 1px 2px rgba(255, 255, 255, 0.4);
}

/* ─────────────────────────────────────────────
   SPEECH BUBBLE
   ───────────────────────────────────────────── */

.robot-bubble {
  position: absolute;
  top: 0;
  right: -180px;
  min-width: 140px;
  max-width: 190px;
  background: linear-gradient(135deg, rgba(28, 22, 12, 0.97), rgba(40, 32, 18, 0.97));
  color: #ffd97a;
  padding: 0.55rem 0.85rem;
  border-radius: 14px 14px 14px 4px;
  border: 1.5px solid rgba(212, 175, 55, 0.65);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  line-height: 1.4;
  opacity: 0;
  transform: translateX(-12px) scale(0.88);
  transition: opacity 0.35s ease, transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
  z-index: 20;
  box-shadow:
    0 4px 16px rgba(212, 175, 55, 0.25),
    inset 0 1px 2px rgba(255, 255, 255, 0.08);
}

.robot-bubble.show {
  opacity: 1;
  transform: translateX(0) scale(1);
}

/* ذيل الفقاعة */
.robot-bubble::before {
  content: '';
  position: absolute;
  left: -9px;
  bottom: 10px;
  border: 6px solid transparent;
  border-right-color: rgba(212, 175, 55, 0.65);
}

.robot-bubble::after {
  content: '';
  position: absolute;
  left: -6px;
  bottom: 10px;
  border: 6px solid transparent;
  border-right-color: rgba(40, 32, 18, 0.97);
}

/* RTL (للعربية) */
html[lang="ar"] .robot-bubble,
[dir="rtl"] .robot-bubble {
  right: auto;
  left: -180px;
  border-radius: 14px 14px 4px 14px;
  transform: translateX(12px) scale(0.88);
}

html[lang="ar"] .robot-bubble.show,
[dir="rtl"] .robot-bubble.show {
  transform: translateX(0) scale(1);
}

html[lang="ar"] .robot-bubble::before,
[dir="rtl"] .robot-bubble::before {
  left: auto;
  right: -9px;
  border-right-color: transparent;
  border-left-color: rgba(212, 175, 55, 0.65);
}

html[lang="ar"] .robot-bubble::after,
[dir="rtl"] .robot-bubble::after {
  left: auto;
  right: -6px;
  border-right-color: transparent;
  border-left-color: rgba(40, 32, 18, 0.97);
}

/* ══════════════════════════════════════════
   STATES
══════════════════════════════════════════ */

/* ─── ERROR ─── */
.robot-mascot.robot-error {
  filter: drop-shadow(0 8px 18px rgba(239, 68, 68, 0.55));
  animation: robot-shake 0.5s ease, robot-idle-float 4s ease-in-out 0.5s infinite;
}

@keyframes robot-shake {
  0%, 100% { transform: translateX(0); }
  20%       { transform: translateX(-6px); }
  40%       { transform: translateX(6px); }
  60%       { transform: translateX(-4px); }
  80%       { transform: translateX(4px); }
}

.robot-mascot.robot-error .robot-eye::before {
  background: radial-gradient(circle, #fca5a5, #ef4444);
  box-shadow: 0 0 4px rgba(239, 68, 68, 0.8);
}

.robot-mascot.robot-error .robot-mouth {
  width: 18px;
  height: 6px;
  border-radius: 8px 8px 0 0;
  bottom: 6px;
}

.robot-mascot.robot-error .robot-antenna::before {
  background: radial-gradient(circle, #fca5a5, #ef4444);
  box-shadow: 0 0 12px rgba(239, 68, 68, 1), 0 0 20px rgba(239, 68, 68, 0.5);
  animation: robot-antenna-error 0.3s ease-in-out infinite;
}

@keyframes robot-antenna-error {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.3; }
}

/* ─── VALID ─── */
.robot-mascot.robot-valid {
  filter: drop-shadow(0 8px 18px rgba(34, 197, 94, 0.55));
  animation: robot-nod 0.6s ease, robot-idle-float 4s ease-in-out 0.6s infinite;
}

@keyframes robot-nod {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-10px); }
}

.robot-mascot.robot-valid .robot-eye {
  height: 8px;
  border-radius: 50% 50% 0 0;
  transform: rotate(180deg);
}

.robot-mascot.robot-valid .robot-eye::before,
.robot-mascot.robot-valid .robot-eye::after { display: none; }

.robot-mascot.robot-valid .robot-mouth {
  width: 22px;
  height: 11px;
  border-radius: 0 0 22px 22px;
  bottom: 6px;
}

.robot-mascot.robot-valid .robot-antenna::before {
  background: radial-gradient(circle, #86efac, #22c55e);
  box-shadow: 0 0 14px rgba(34, 197, 94, 1), 0 0 22px rgba(34, 197, 94, 0.6);
}

/* ─── SENDING ─── */
.robot-mascot.robot-sending .robot-antenna::before {
  animation: robot-spinning 0.7s linear infinite;
}

@keyframes robot-spinning {
  to { transform: translateX(-50%) rotate(360deg); }
}

.robot-mascot.robot-sending .robot-eye::before {
  animation: robot-eye-loading 1.2s ease-in-out infinite;
}

@keyframes robot-eye-loading {
  0%, 100% {
    background: radial-gradient(circle, #d4af37, #8b6f00);
    box-shadow: 0 0 6px #d4af37;
  }
  50% {
    background: radial-gradient(circle, #fff0b4, #ffd97a);
    box-shadow: 0 0 10px #ffd97a;
  }
}

.robot-mascot.robot-sending .robot-mouth {
  width: 12px;
  height: 4px;
  border-radius: 3px;
}

/* ─── SUCCESS — يقفز عمودياً، الذراعان ثابتتان ─── */
.robot-mascot.robot-success {
  filter: drop-shadow(0 12px 30px rgba(212, 175, 55, 0.75));
  animation: robot-jump 0.5s ease-in-out 4;
}

@keyframes robot-jump {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-16px); }
}

.robot-mascot.robot-success .robot-eye {
  height: 9px;
  border-radius: 50% 50% 0 0;
  transform: rotate(180deg);
}

.robot-mascot.robot-success .robot-eye::before,
.robot-mascot.robot-success .robot-eye::after { display: none; }

.robot-mascot.robot-success .robot-mouth {
  width: 26px;
  height: 13px;
  border-radius: 0 0 26px 26px;
}

.robot-mascot.robot-success .robot-antenna::before {
  background: radial-gradient(circle, #fff0b4, #ffd97a);
  box-shadow: 0 0 20px rgba(255, 217, 122, 1), 0 0 36px rgba(212, 175, 55, 0.8);
  animation: robot-antenna-celebrate 0.3s ease-in-out infinite;
}

@keyframes robot-antenna-celebrate {
  0%, 100% { transform: translateX(-50%) scale(1); }
  50%       { transform: translateX(-50%) scale(1.8); }
}

.robot-mascot.robot-success::before,
.robot-mascot.robot-success::after {
  content: '✨';
  position: absolute;
  font-size: 20px;
  opacity: 0;
  animation: robot-sparkle 1.2s ease-out infinite;
  pointer-events: none;
  z-index: 10;
}

.robot-mascot.robot-success::before { top: -8px; left: -10px; animation-delay: 0.1s; }
.robot-mascot.robot-success::after  { top: -8px; right: -10px; animation-delay: 0.4s; }

@keyframes robot-sparkle {
  0%   { opacity: 0; transform: scale(0) rotate(0deg); }
  50%  { opacity: 1; transform: scale(1.4) rotate(180deg); }
  100% { opacity: 0; transform: scale(0.4) rotate(360deg); }
}

/* ══════════════════════════════════════════
   FORM INPUT GLOW
══════════════════════════════════════════ */

.feat-input-glow {
  border: 1.5px solid rgba(212, 175, 55, 0.45) !important;
  box-shadow:
    0 0 0 1px rgba(212, 175, 55, 0.1),
    0 0 14px rgba(212, 175, 55, 0.12),
    0 2px 8px rgba(0, 0, 0, 0.2) !important;
  animation: feat-input-pulse 3.5s ease-in-out infinite;
  transition: border-color 0.35s ease, box-shadow 0.35s ease !important;
}

@keyframes feat-input-pulse {
  0%, 100% {
    border-color: rgba(212, 175, 55, 0.38);
    box-shadow: 0 0 0 1px rgba(212, 175, 55, 0.08), 0 0 10px rgba(212, 175, 55, 0.08), 0 2px 8px rgba(0, 0, 0, 0.2);
  }
  50% {
    border-color: rgba(255, 217, 122, 0.72);
    box-shadow: 0 0 0 1px rgba(212, 175, 55, 0.22), 0 0 18px rgba(212, 175, 55, 0.22), 0 2px 10px rgba(0, 0, 0, 0.25);
  }
}

.feat-input-glow:focus {
  border-color: rgba(255, 217, 122, 1) !important;
  box-shadow: 0 0 0 1.5px rgba(212, 175, 55, 0.5), 0 0 22px rgba(212, 175, 55, 0.32), 0 4px 12px rgba(0, 0, 0, 0.3) !important;
  animation-play-state: paused;
  outline: none;
}

input.feat-email-invalid.feat-input-glow { border-color: rgba(239, 68, 68, 0.7) !important; animation: none !important; }
input.feat-email-valid.feat-input-glow   { border-color: rgba(34, 197, 94, 0.7) !important;  animation: none !important; }

body:not(.dark-theme) .feat-input-glow {
  border-color: rgba(139, 111, 0, 0.55) !important;
  animation: feat-input-pulse-light 3.5s ease-in-out infinite;
}

@keyframes feat-input-pulse-light {
  0%, 100% {
    border-color: rgba(139, 111, 0, 0.45);
    box-shadow: 0 0 0 1px rgba(139, 111, 0, 0.12), 0 0 10px rgba(184, 148, 31, 0.15), 0 2px 8px rgba(0, 0, 0, 0.1);
  }
  50% {
    border-color: rgba(184, 148, 31, 0.9);
    box-shadow: 0 0 0 1.5px rgba(139, 111, 0, 0.35), 0 0 20px rgba(184, 148, 31, 0.4), 0 2px 10px rgba(0, 0, 0, 0.15);
  }
}

body:not(.dark-theme) .feat-input-glow:focus { border-color: rgba(139, 111, 0, 1) !important; }

/* ─── Light mode robot ─── */
body:not(.dark-theme) .robot-mascot { filter: drop-shadow(0 8px 18px rgba(139, 111, 0, 0.4)); }
body:not(.dark-theme) .robot-body,
body:not(.dark-theme) .robot-head {
  background: radial-gradient(ellipse at 30% 25%, #d4af37 0%, #b8941f 50%, #8b6f00 100%);
  border-color: rgba(139, 111, 0, 0.6);
}

/* ─── reduced-motion ─── */
@media (prefers-reduced-motion: reduce) {
  .robot-mascot, .robot-body, .robot-antenna::before,
  .robot-screen::before, .robot-eye, .feat-input-glow { animation: none !important; }
}

/* ─── موبايل ─── */
@media (max-width: 767px) {
  .robot-mascot  { width: 90px; height: 115px; }
  .robot-bubble  { right: -140px; max-width: 155px; font-size: 0.62rem; }
  html[lang="ar"] .robot-bubble,
  [dir="rtl"] .robot-bubble { left: -140px; }
  .feat-input-glow { animation-duration: 4s; }
}
