/* ═══════════════════════════════════════════════════════════
   PREMIUM HOLOGRAPHIC AI WIDGET "AL-MUTAHADDI"
   الشكل الأصلي — نافذة هولوغرافية داكنة مع فيديو
   ═══════════════════════════════════════════════════════════ */

/* ── 1. Launcher Button ── */
.ai-launcher {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: auto;
  height: 54px;
  background: linear-gradient(135deg, #E8833A 0%, #c96d28 100%);
  border-radius: 100px;
  cursor: pointer;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  border: none;
  box-shadow: 0 6px 24px rgba(232, 131, 58, 0.45), 0 2px 8px rgba(0, 0, 0, 0.25);
  padding: 0 22px;
}

.ai-launcher:hover {
  transform: scale(1.05) translateY(-2px);
  box-shadow: 0 12px 32px rgba(232, 131, 58, 0.55), 0 4px 12px rgba(0, 0, 0, 0.3);
}

.ai-launcher-content {
  display: flex;
  align-items: center;
  gap: 10px;
  direction: rtl;
}

.ai-launcher-text {
  color: #ffffff;
  font-family: 'Graphik Arabic', 'Tajawal', sans-serif;
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
}

.ai-launcher-icon {
  width: 20px;
  height: 20px;
  color: #ffffff;
  flex-shrink: 0;
}

/* ── 2. Overlay ── */
.ai-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 16, 26, 0.4);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 10000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease;
}

.ai-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

/* ── 3. Chat Drawer ── */
.ai-drawer {
  position: fixed;
  top: 8px;
  bottom: 6px;
  right: 30px;
  width: 370px;
  background: linear-gradient(160deg, #0d1522 0%, #141f31 60%, #0a1018 100%);
  border-radius: 28px;
  border: 1px solid rgba(232, 131, 58, 0.18);
  box-shadow:
    0 32px 80px rgba(0, 0, 0, 0.7),
    0 0 0 1px rgba(255, 255, 255, 0.04),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  z-index: 10001;
  display: none;
  flex-direction: column;
  overflow: hidden;
}

.ai-drawer.active {
  display: flex;
  animation: drawerOpen 0.45s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.ai-drawer.collapsing {
  animation: drawerClose 0.35s cubic-bezier(0.4, 0, 1, 1) forwards;
}

@keyframes drawerOpen {
  from {
    opacity: 0;
    transform: scale(0.88) translateY(24px);
  }

  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes drawerClose {
  from {
    opacity: 1;
    transform: scale(1) translateY(0);
  }

  to {
    opacity: 0;
    transform: scale(0.88) translateY(24px);
  }
}

/* ── 4. Header ── */
.ai-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
  direction: rtl;
}

.ai-header-title {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #ffffff;
  font-family: 'Graphik Arabic', 'Tajawal', sans-serif;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.ai-header-status {
  width: 9px;
  height: 9px;
  background: #00e5a0;
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(0, 229, 160, 0.9);
  animation: statusPulse 2.2s ease-in-out infinite;
}

@keyframes statusPulse {

  0%,
  100% {
    opacity: 1;
    box-shadow: 0 0 6px rgba(0, 229, 160, 0.7);
  }

  50% {
    opacity: 0.7;
    box-shadow: 0 0 14px rgba(0, 229, 160, 1);
  }
}

.ai-close-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.55);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 17px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.25s ease;
  line-height: 1;
  padding: 0;
}

.ai-close-btn:hover {
  background: rgba(232, 131, 58, 0.18);
  color: #E8833A;
  border-color: rgba(232, 131, 58, 0.35);
}

/* ── 5. Avatar / Video Container ── */
.ai-avatar-container {
  width: 100%;
  flex: 0 0 50%;
  height: 50%;
  overflow: hidden;
  position: relative;
  background: #070e1a;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Gradient fade at bottom of avatar */
.ai-avatar-container::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 70px;
  background: linear-gradient(to top, #0d1522 0%, transparent 100%);
  pointer-events: none;
  z-index: 2;
}

/* Hologram Video */
.hologram-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  display: block;
}

/* SVG Mascot (fallback) */
.mascot {
  width: 155px;
  height: 205px;
  overflow: visible;
  position: relative;
  z-index: 1;
  filter: drop-shadow(0 6px 20px rgba(232, 131, 58, 0.12));
}

/* ── 6. SVG Mascot Animation States ── */
.g-bulb {
  display: none;
  transform: translateX(50px) translateY(7px);
}

.mascot.answering .g-bulb {
  display: block;
  animation: bulbAppear 0.4s ease forwards;
}

@keyframes bulbAppear {
  from {
    opacity: 0;
    transform: translateX(50px) translateY(7px) scale(0.5);
  }

  to {
    opacity: 1;
    transform: translateX(50px) translateY(7px) scale(1);
  }
}

.mascot.thinking .eyebrow-l {
  animation: thinkBrow 1.5s ease-in-out infinite;
}

.mascot.thinking .eyebrow-r {
  animation: thinkBrow 1.5s ease-in-out infinite 0.15s;
}

@keyframes thinkBrow {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-2px);
  }
}

.mascot.thinking .pupil {
  animation: thinkGaze 2s ease-in-out infinite;
}

@keyframes thinkGaze {

  0%,
  100% {
    transform: translate(0, 0);
  }

  30% {
    transform: translate(-1px, -1px);
  }

  70% {
    transform: translate(1px, -1px);
  }
}

.mascot.answering .mouth {
  animation: talkMouth 0.3s ease-in-out infinite alternate;
}

@keyframes talkMouth {
  from {
    d: path("M42,71 Q50,77 58,71");
  }

  to {
    d: path("M43,72 Q50,78 57,72");
  }
}

.sp {
  opacity: 0;
}

.mascot.answering .sp:nth-child(1) {
  animation: sparkle 1.2s ease-in-out infinite;
}

.mascot.answering .sp:nth-child(2) {
  animation: sparkle 1.2s ease-in-out infinite 0.3s;
}

.mascot.answering .sp:nth-child(3) {
  animation: sparkle 1.2s ease-in-out infinite 0.6s;
}

@keyframes sparkle {

  0%,
  100% {
    opacity: 0;
    transform: scale(0.5);
  }

  50% {
    opacity: 1;
    transform: scale(1.2);
  }
}

/* ── 7. Chat Body ── */
.ai-chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px 14px 6px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  direction: rtl;
  scrollbar-width: thin;
  scrollbar-color: rgba(232, 131, 58, 0.25) transparent;
  min-height: 0;
}

.ai-chat-body::-webkit-scrollbar {
  width: 3px;
}

.ai-chat-body::-webkit-scrollbar-track {
  background: transparent;
}

.ai-chat-body::-webkit-scrollbar-thumb {
  background: rgba(232, 131, 58, 0.3);
  border-radius: 3px;
}

/* ── 8. Messages ── */
.ai-message {
  max-width: 90%;
  border-radius: 16px;
  padding: 11px 15px;
  font-family: 'Graphik Arabic', 'Tajawal', sans-serif;
  font-size: 13px;
  line-height: 1.75;
  animation: msgSlideIn 0.3s ease forwards;
}

@keyframes msgSlideIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.ai-message p {
  margin: 0 0 5px 0;
}

.ai-message p:last-child {
  margin-bottom: 0;
}

.ai-message strong {
  color: #E8833A;
  font-weight: 700;
}

.ai-message.bot {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.07);
  color: rgba(255, 255, 255, 0.85);
  align-self: flex-end;
  border-radius: 4px 16px 16px 16px;
}

.ai-message.user {
  background: linear-gradient(135deg, rgba(232, 131, 58, 0.22), rgba(232, 131, 58, 0.08));
  border: 1px solid rgba(232, 131, 58, 0.28);
  color: #ffffff;
  align-self: flex-start;
  border-radius: 16px 4px 16px 16px;
}

/* ── 9. Typing Indicator ── */
.ai-typing {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 4px 14px 14px 14px;
  align-self: flex-end;
  width: fit-content;
}

.ai-typing span {
  width: 7px;
  height: 7px;
  background: rgba(232, 131, 58, 0.7);
  border-radius: 50%;
  animation: typingBounce 1.2s ease-in-out infinite;
}

.ai-typing span:nth-child(2) {
  animation-delay: 0.2s;
}

.ai-typing span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typingBounce {

  0%,
  60%,
  100% {
    transform: translateY(0);
    opacity: 0.5;
  }

  30% {
    transform: translateY(-5px);
    opacity: 1;
  }
}

/* ── 10. Footer ── */
.ai-footer {
  padding: 8px 12px 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(0, 0, 0, 0.12);
  flex-shrink: 0;
  direction: rtl;
}

/* Pills */
.ai-pills-wrapper {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 9px;
}

.ai-pills-arrow {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.09);
  color: rgba(255, 255, 255, 0.45);
  width: 26px;
  height: 26px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.22s ease;
  padding: 0;
  line-height: 1;
}

.ai-pills-arrow:hover {
  background: rgba(232, 131, 58, 0.12);
  color: #E8833A;
  border-color: rgba(232, 131, 58, 0.3);
}

.ai-quick-pills {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  flex: 1;
  scrollbar-width: none;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

.ai-quick-pills::-webkit-scrollbar {
  display: none;
}

.ai-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  padding: 5px 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 100px;
  color: rgba(255, 255, 255, 0.7);
  font-family: 'Graphik Arabic', 'Tajawal', sans-serif;
  font-size: 11.5px;
  cursor: pointer;
  transition: all 0.22s ease;
  flex-shrink: 0;
}

.ai-pill:hover {
  background: rgba(232, 131, 58, 0.13);
  border-color: rgba(232, 131, 58, 0.38);
  color: #E8833A;
  transform: translateY(-1px);
}

.ai-pill-icon {
  font-size: 12px;
}

/* Form */
.ai-form {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 5px 5px 10px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 100px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  transition: all 0.3s ease;
}

.ai-form:focus-within {
  border-color: rgba(232, 131, 58, 0.45);
  box-shadow: 0 0 14px rgba(232, 131, 58, 0.1);
  background: rgba(255, 255, 255, 0.06);
}

.ai-input {
  flex: 1;
  background: none;
  border: none;
  color: #ffffff;
  font-family: 'Graphik Arabic', 'Tajawal', sans-serif;
  font-size: 13px;
  direction: rtl;
  padding: 6px 2px;
}

.ai-input::placeholder {
  color: rgba(255, 255, 255, 0.3);
}

.ai-input:focus {
  outline: none;
}

.ai-send-btn {
  width: 36px;
  height: 36px;
  background: #E8833A;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  flex-shrink: 0;
  transition: all 0.3s ease;
}

.ai-send-btn:hover {
  background: #ff9a50;
  transform: scale(1.08);
  box-shadow: 0 4px 14px rgba(232, 131, 58, 0.5);
}

.ai-send-btn svg {
  width: 15px;
  height: 15px;
  transform: rotate(180deg);
}

/* ── 11. Responsive Mobile ── */
@media (max-width: 600px) {
  .ai-drawer {
    top: 6px;
    bottom: 4px;
    left: 10px;
    right: 10px;
    width: auto;
    border-radius: 22px;
  }

  .ai-launcher {
    bottom: 20px;
    right: 16px;
  }
}

/* ── 12. Responsive Widescreen & 16:9 Laptop Optimization ── */
/* يحل مشكلة ضيق الارتفاع في شاشات اللابتوب 16:9 العريضة دون التأثير إطلاقاً على الموبايل أو شاشات 4:3 */
@media (min-width: 860px) and (min-aspect-ratio: 1.4/1) {
  .ai-drawer {
    width: 420px;
    right: 25px;
    bottom: 12px;
    top: 12px;
    border-radius: 26px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.7), 0 0 24px rgba(232, 131, 58, 0.15);
  }

  .ai-avatar-container {
    flex: 0 0 45%;
    height: 45%;
    background: #070e1a;
    position: relative;
    overflow: hidden;
  }

  .ai-avatar-container::after {
    height: 45px;
    background: linear-gradient(to top, #0d1522 0%, transparent 100%);
  }

  .hologram-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 20%;
  }

  .ai-chat-body {
    flex: 1;
    padding: 14px 16px 8px;
    gap: 12px;
  }

  .ai-message {
    max-width: 92%;
    font-size: 13.5px;
    line-height: 1.75;
    padding: 12px 16px;
  }

  .ai-footer {
    padding: 8px 14px 12px;
  }
}

@media (min-width: 860px) and (max-height: 680px) {
  .ai-avatar-container {
    flex: 0 0 40%;
    height: 40%;
  }
}