/* مساعد بورتوفيق — مركز ذكاء فضائي */
.page-assistant {
  --asst-bg: #030508;
  --asst-surface: rgba(8, 14, 28, 0.78);
  --asst-border: rgba(0, 245, 212, 0.22);
  --asst-glow: rgba(0, 245, 212, 0.35);
  --asst-accent: #c42a52;
  --asst-text: #e8f4ff;
  --asst-muted: #7a8eb5;
  background: var(--asst-bg);
  color: var(--asst-text);
}

.page-assistant::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(0, 245, 212, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 245, 212, 0.03) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 90% 80% at 50% 40%, black 20%, transparent 75%);
}

.page-assistant::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.03) 2px,
    rgba(0, 0, 0, 0.03) 4px
  );
  opacity: 0.4;
}

.page-assistant .ambient-bg {
  display: none;
}

.assistant-particles {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 1;
}

.assistant-glow {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 100% 60% at 50% 110%, rgba(196, 42, 82, 0.28) 0%, transparent 50%),
    radial-gradient(ellipse 70% 50% at 15% 60%, rgba(0, 245, 212, 0.08) 0%, transparent 45%),
    radial-gradient(ellipse 60% 45% at 88% 35%, rgba(140, 120, 255, 0.12) 0%, transparent 50%),
    radial-gradient(ellipse 50% 40% at 50% 0%, rgba(12, 40, 80, 0.5) 0%, transparent 60%);
}

.page-assistant .site-header {
  z-index: 10;
  background: rgba(3, 5, 10, 0.82);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(0, 245, 212, 0.12);
  box-shadow: 0 4px 32px rgba(0, 0, 0, 0.5);
}

.page-assistant .site-header .logo {
  color: var(--asst-text);
  text-shadow: 0 0 20px var(--asst-glow);
}

.page-assistant .site-header .logo span {
  color: #ff6b9d;
}

.page-assistant .menu-btn {
  background: rgba(196, 42, 82, 0.2);
  border: 1px solid var(--asst-border);
}

.page-assistant .menu-btn span {
  background: var(--asst-text);
}

.assistant-hero {
  position: relative;
  z-index: 5;
  text-align: center;
  padding: calc(var(--header-h) + 20px) 20px 16px;
}

.assistant-hero h1 {
  font-size: 1.5rem;
  font-weight: 800;
  background: linear-gradient(120deg, #fff 0%, #00f5d4 35%, #ff6b9d 70%, #c9a0ff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin-bottom: 0;
  filter: drop-shadow(0 0 24px rgba(0, 245, 212, 0.25));
}

.page-assistant .chat-page {
  position: relative;
  z-index: 5;
  padding-bottom: calc(24px + var(--safe-bottom));
  max-width: 520px;
}

.page-assistant .chat-suggestions {
  margin-bottom: 14px;
}

.page-assistant .chat-chip {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--asst-border);
  color: #ffc4d6;
  backdrop-filter: blur(8px);
}

.page-assistant .chat-chip:active {
  background: rgba(196, 42, 82, 0.25);
}

.page-assistant .chat-shell {
  position: relative;
  overflow: hidden;
  background: var(--asst-surface);
  border: 1px solid var(--asst-border);
  border-radius: 24px;
  box-shadow:
    0 0 0 1px rgba(0, 245, 212, 0.06) inset,
    0 0 60px rgba(0, 245, 212, 0.06),
    0 24px 60px rgba(0, 0, 0, 0.55),
    0 0 80px rgba(196, 42, 82, 0.1);
  backdrop-filter: blur(24px);
}

.chat-inner-particles {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.55;
}

.chat-log-zone {
  position: relative;
  z-index: 1;
  overflow: hidden;
}

/* توهج متنفس تحت الرسائل — أسلوب AI */
.chat-ai-pulse {
  position: absolute;
  left: -10%;
  right: -10%;
  bottom: 0;
  height: 72px;
  pointer-events: none;
  opacity: 0;
  z-index: 0;
  background: linear-gradient(
    90deg,
    rgba(0, 245, 212, 0) 0%,
    rgba(0, 245, 212, 0.35) 20%,
    rgba(196, 42, 82, 0.45) 45%,
    rgba(180, 130, 255, 0.4) 70%,
    rgba(255, 120, 180, 0.3) 85%,
    rgba(0, 245, 212, 0) 100%
  );
  background-size: 220% 100%;
  filter: blur(18px);
  transform: translateY(20px) scaleY(0.5);
  transition: opacity 0.45s ease;
}

.chat-ai-pulse--2 {
  bottom: 12px;
  height: 48px;
  filter: blur(28px);
  opacity: 0;
  animation: none;
}

.page-assistant .chat-shell.is-thinking {
  border-color: rgba(0, 245, 212, 0.45);
  box-shadow:
    0 0 0 1px rgba(0, 245, 212, 0.15),
    0 0 40px rgba(196, 42, 82, 0.2),
    0 0 60px rgba(0, 245, 212, 0.12),
    inset 0 0 48px rgba(0, 245, 212, 0.04);
  animation: shellThinkGlow 2.2s ease-in-out infinite;
}

@keyframes shellThinkGlow {
  0%, 100% {
    box-shadow:
      0 0 0 1px rgba(0, 245, 212, 0.12),
      0 0 32px rgba(196, 42, 82, 0.18),
      inset 0 0 40px rgba(0, 245, 212, 0.03);
  }
  50% {
    box-shadow:
      0 0 0 1px rgba(255, 120, 180, 0.2),
      0 0 52px rgba(0, 245, 212, 0.22),
      inset 0 0 56px rgba(196, 42, 82, 0.06);
  }
}

.page-assistant.is-assistant-thinking .assistant-glow {
  opacity: 1;
  animation: assistantGlowPulse 2.4s ease-in-out infinite;
}

@keyframes assistantGlowPulse {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.12); }
}

.page-assistant .chat-shell.is-thinking .chat-inner-particles {
  opacity: 1;
}

.page-assistant .chat-shell.is-thinking .chat-ai-pulse {
  opacity: 1;
  animation: aiPulseFlow 1.8s ease-in-out infinite, aiPulseBreathe 1.1s ease-in-out infinite;
}

.page-assistant .chat-shell.is-thinking .chat-ai-pulse--2 {
  opacity: 0.95;
  animation: aiPulseBreathe 1.1s ease-in-out infinite reverse;
}

@keyframes aiPulseFlow {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

@keyframes aiPulseBreathe {
  0%, 100% {
    transform: translateY(18px) scaleY(0.45);
    opacity: 0.55;
  }
  50% {
    transform: translateY(8px) scaleY(1);
    opacity: 1;
  }
}

.page-assistant .chat-shell::before {
  content: "";
  position: absolute;
  top: 0;
  left: 16px;
  right: 16px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(0, 245, 212, 0.5), transparent);
  pointer-events: none;
}

.page-assistant .chat-log {
  position: relative;
  z-index: 1;
  min-height: 340px;
  max-height: 55dvh;
  padding: 18px 16px 28px;
  gap: 16px;
}

.page-assistant .chat-shell.is-thinking .chat-log {
  box-shadow: inset 0 -32px 48px -10px rgba(0, 245, 212, 0.14);
}

.page-assistant .chat-label {
  color: var(--asst-muted);
  font-size: 0.68rem;
  letter-spacing: 0.02em;
}

.page-assistant .chat-row-user .chat-label {
  color: #ff8eb3;
}

.page-assistant .chat-bubble {
  border-radius: 20px;
  font-size: 0.94rem;
  line-height: 1.6;
  animation: asstBubbleIn 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes asstBubbleIn {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.94);
    filter: blur(4px);
  }
  to {
    opacity: 1;
    transform: none;
    filter: none;
  }
}

.page-assistant .chat-user {
  background: linear-gradient(135deg, var(--burgundy-shine) 0%, var(--burgundy) 50%, var(--burgundy-dark) 100%);
  color: #fff;
  border-bottom-left-radius: 6px;
  box-shadow: 0 6px 20px rgba(196, 42, 82, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.page-assistant .chat-bot {
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.04) 100%);
  color: var(--asst-text);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-bottom-right-radius: 6px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.page-assistant .chat-bot.is-revealing {
  opacity: 0;
}

.page-assistant .chat-bot.is-visible {
  opacity: 1;
  transition: opacity 0.42s ease;
}

.page-assistant .chat-bot .chat-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 6px;
  padding: 8px 12px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(0, 245, 212, 0.18), rgba(196, 42, 82, 0.22));
  border: 1px solid rgba(0, 245, 212, 0.35);
  color: #7efce8;
  font-weight: 700;
  font-size: 0.88rem;
  text-decoration: none;
  box-shadow: 0 4px 14px rgba(0, 245, 212, 0.15);
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  word-break: break-word;
}

.page-assistant .chat-bot .chat-link:hover,
.page-assistant .chat-bot .chat-link:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(0, 245, 212, 0.28);
  background: linear-gradient(135deg, rgba(0, 245, 212, 0.28), rgba(196, 42, 82, 0.3));
  outline: none;
}

.page-assistant .chat-bot .chat-link:active {
  transform: scale(0.98);
}

/* تفكير — نقط وألوان متنفسة */
.chat-breathe {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  min-width: 160px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.03) 100%);
  border: 1px solid rgba(0, 245, 212, 0.2);
  border-radius: 20px;
  border-bottom-right-radius: 6px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2), 0 0 24px rgba(0, 245, 212, 0.08);
  overflow: hidden;
}

.chat-breathe-orbit {
  position: absolute;
  inset: -20%;
  background: conic-gradient(
    from 0deg,
    transparent,
    rgba(0, 245, 212, 0.12),
    rgba(196, 42, 82, 0.15),
    rgba(180, 130, 255, 0.12),
    transparent
  );
  animation: breatheOrbit 2.4s linear infinite;
  pointer-events: none;
}

.chat-breathe-core {
  position: absolute;
  width: 48px;
  height: 48px;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0, 245, 212, 0.25) 0%, transparent 70%);
  animation: breatheCore 1.4s ease-in-out infinite;
  pointer-events: none;
}

@keyframes breatheOrbit {
  to { transform: rotate(360deg); }
}

@keyframes breatheCore {
  0%, 100% { opacity: 0.4; transform: translateY(-50%) scale(0.85); }
  50% { opacity: 1; transform: translateY(-50%) scale(1.15); }
}

.chat-breathe-dots {
  display: flex;
  align-items: center;
  gap: 6px;
  position: relative;
  z-index: 1;
}

.chat-breathe-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: linear-gradient(180deg, #7efce8, #ff8eb3 50%, var(--burgundy));
  animation: breatheDot 1s ease-in-out infinite;
  box-shadow: 0 0 12px rgba(0, 245, 212, 0.5);
}

.chat-breathe-dot:nth-child(2) {
  animation-delay: 0.18s;
}

.chat-breathe-dot:nth-child(3) {
  animation-delay: 0.36s;
}

.chat-breathe-status {
  position: relative;
  z-index: 1;
  font-size: 0.78rem;
  font-weight: 700;
  color: rgba(126, 252, 232, 0.9);
  letter-spacing: 0.02em;
  animation: breatheStatus 1.6s ease-in-out infinite;
}

@keyframes breatheDot {
  0%, 100% {
    transform: scale(0.55);
    opacity: 0.4;
    filter: hue-rotate(0deg);
  }
  50% {
    transform: scale(1.2);
    opacity: 1;
    filter: hue-rotate(25deg);
  }
}

@keyframes breatheStatus {
  0%, 100% { opacity: 0.65; }
  50% { opacity: 1; }
}

.page-assistant .chat-typing-row {
  display: none !important;
}

.page-assistant .chat-form {
  position: relative;
  z-index: 2;
  background: rgba(0, 0, 0, 0.25);
  border-top: 1px solid var(--asst-border);
  padding: 14px 16px;
}

.page-assistant .chat-shell.is-thinking .chat-form {
  box-shadow: 0 -12px 40px rgba(196, 42, 82, 0.22);
  border-top-color: rgba(0, 245, 212, 0.35);
}

.page-assistant .chat-form input {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--asst-text);
  border-radius: 14px;
}

.page-assistant .chat-form input::placeholder {
  color: var(--asst-muted);
}

.page-assistant .chat-form input:focus {
  border-color: var(--burgundy-light);
  box-shadow: 0 0 0 3px rgba(196, 42, 82, 0.2);
}

.page-assistant .chat-form .btn-primary {
  background: linear-gradient(135deg, var(--burgundy-shine), var(--burgundy-dark));
  box-shadow: 0 4px 16px rgba(196, 42, 82, 0.45);
  border-radius: 14px;
}

.page-assistant .chat-note {
  color: var(--asst-muted);
}

.page-assistant .nav-panel {
  background: #0d1220;
  border-left: 1px solid var(--asst-border);
}

.page-assistant .nav-links a {
  color: var(--asst-text);
}

.page-assistant .nav-links a.active {
  color: #ff8eb3;
}
