/* المساعد الذكي — واجهة حية وطويلة */
.phms-assistant {
  font-family: "Cairo", sans-serif;
  font-weight: 500;
  backdrop-filter: blur(8px);
}

.phms-assistant__panel {
  position: relative;
  overflow: hidden;
  width: min(1140px, 98vw);
  height: min(92vh, 980px);
  min-height: min(88vh, 900px);
  max-height: 96vh;
  border-radius: 28px;
  border: 1px solid rgba(129, 140, 248, 0.35);
  background: #0a0f1e;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.05) inset,
    0 48px 120px rgba(0, 0, 0, 0.5);
}

.phms-assistant__aurora {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.phms-assistant__orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(48px);
  opacity: 0.55;
  animation: asstOrbFloat 14s ease-in-out infinite;
}

.phms-assistant__orb--1 {
  width: 320px;
  height: 320px;
  top: -80px;
  right: -60px;
  background: #6366f1;
  animation-delay: 0s;
}

.phms-assistant__orb--2 {
  width: 280px;
  height: 280px;
  bottom: -100px;
  left: -40px;
  background: #06b6d4;
  animation-delay: -4s;
}

.phms-assistant__orb--3 {
  width: 220px;
  height: 220px;
  top: 40%;
  left: 35%;
  background: #a855f7;
  animation-delay: -8s;
}

@keyframes asstOrbFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(24px, -18px) scale(1.08); }
  66% { transform: translate(-20px, 14px) scale(0.94); }
}

.phms-assistant__panel-inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

.phms-assistant__head {
  flex-shrink: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 22px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(10, 15, 30, 0.45);
  backdrop-filter: blur(12px);
}

.phms-assistant__brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}

.phms-assistant__avatar {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  font-size: 1.45rem;
  background: linear-gradient(145deg, #22d3ee, #818cf8);
  box-shadow: 0 8px 24px rgba(34, 211, 238, 0.3);
}

.phms-assistant__titles {
  min-width: 0;
  flex: 1;
}

.phms-assistant__head h2 {
  margin: 0 0 4px;
  font-size: 1.22rem;
  font-weight: 800;
  line-height: 1.2;
  color: #f8fafc;
}

.phms-assistant__intro {
  margin: 0;
  font-size: 0.84rem;
  font-weight: 500;
  line-height: 1.45;
  color: rgba(226, 232, 240, 0.82);
  white-space: normal;
}

.phms-assistant__close {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #e2e8f0;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease;
}

.phms-assistant__close:hover {
  background: rgba(248, 113, 113, 0.25);
}

.phms-assistant__suggestions {
  flex-shrink: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 16px;
  background: rgba(0, 0, 0, 0.2);
}

.phms-assistant__chip {
  border: 1px solid rgba(129, 140, 248, 0.35);
  background: rgba(30, 41, 82, 0.5);
  color: #c7d2fe;
  padding: 7px 14px;
  font-size: 0.86rem;
  font-weight: 600;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease;
}

.phms-assistant__chip:hover {
  transform: translateY(-1px);
  background: rgba(99, 102, 241, 0.35);
  color: #eef2ff;
}

.phms-assistant__messages {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.phms-assistant__msg {
  max-width: 92%;
  padding: 0;
  border: none;
  background: transparent;
  font-size: 0.95rem;
  font-weight: 500;
}

.phms-assistant__msg--user {
  align-self: flex-end;
}

.phms-assistant__msg--bot {
  align-self: stretch;
  max-width: 100%;
  width: 100%;
}

.phms-assistant__msg--bot .phms-assistant__bubble-inner {
  width: 100%;
  box-sizing: border-box;
}

.phms-assistant__msg--user .phms-assistant__bubble-inner {
  background: linear-gradient(120deg, rgba(99, 102, 241, 0.85), rgba(6, 182, 212, 0.75));
  color: #fff;
  padding: 11px 15px;
  border-radius: 20px 20px 6px 20px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 8px 24px rgba(79, 70, 229, 0.2);
  backdrop-filter: blur(8px);
}

.phms-assistant__msg--bot .phms-assistant__bubble-inner {
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid rgba(148, 163, 184, 0.2);
  padding: 12px 15px;
  border-radius: 20px 20px 20px 6px;
  color: #e2e8f0;
  backdrop-filter: blur(10px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.phms-assistant__bubble-inner p {
  margin: 0;
  line-height: 1.6;
  font-weight: 500;
}

.phms-assistant__typing {
  font-weight: 500;
  font-style: italic;
  color: rgba(148, 163, 184, 0.9);
}

.phms-assistant__composer {
  flex-shrink: 0;
  padding: 14px 22px 18px;
  background: rgba(8, 12, 24, 0.65);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(12px);
}

.phms-assistant__composer-row {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  width: 100%;
}

.phms-assistant__composer textarea {
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
  min-height: 48px;
  border-radius: 14px;
  border: 1px solid rgba(129, 140, 248, 0.35);
  background: rgba(15, 23, 42, 0.7);
  color: #f1f5f9;
  padding: 12px 14px;
  font-weight: 500;
  font-size: 0.95rem;
}

.phms-assistant__composer .phms-assistant__send,
.phms-assistant__send.btn.primary.phms-assistant__send {
  width: auto;
  min-width: 100px;
  flex-shrink: 0;
}

.phms-assistant__send {
  width: auto;
  min-width: 100px;
  flex-shrink: 0;
  border-radius: 14px;
  border: none;
  background: linear-gradient(120deg, #22d3ee, #6366f1);
  color: #fff;
  font-weight: 700;
  font-size: 0.95rem;
  padding: 12px 18px;
  box-shadow: 0 8px 22px rgba(99, 102, 241, 0.35);
  cursor: pointer;
}

.phms-assistant__send:hover:not(:disabled) {
  filter: brightness(1.06);
}

/* مسار الخطوات */
.phms-assistant-flow {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed rgba(148, 163, 184, 0.2);
}

.phms-assistant-flow__head {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 10px;
  font-size: 0.92rem;
  font-weight: 700;
  color: #67e8f9;
}

.phms-assistant-flow__rail {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-bottom: 12px;
}

.phms-assistant-flow__rail .flow-step {
  padding: 5px 11px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  font-size: 0.8rem;
  font-weight: 600;
  color: #e2e8f0;
}

.phms-assistant-flow__rail .flow-step b {
  font-weight: 800;
}

.phms-assistant-flow__rail .flow-arrow {
  font-style: normal;
  opacity: 0.7;
  color: #67e8f9;
  font-weight: 700;
}

.phms-assistant-flow__cards {
  display: grid;
  gap: 8px;
}

.phms-assistant-step-card {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) minmax(120px, auto);
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(171, 220, 249, 0.88);
  border: 1px solid rgba(3, 57, 111, 0.1);
  overflow: hidden;
}

.phms-assistant-step-card__num {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 0.92rem;
  color: #fff;
  background: linear-gradient(145deg, #0369a1, #4f46e5);
}

.phms-assistant-step-card__body strong {
  display: block;
  font-size: 0.9rem;
  font-weight: 700;
  color: #03396f;
  margin-bottom: 2px;
}

.phms-assistant-step-card__body small {
  display: block;
  font-size: 0.82rem;
  font-weight: 500;
  color: rgb(0 0 0 / 78%);
  line-height: 1.4;
}

.phms-assistant-step-card__visual {
  min-width: 120px;
  max-width: 150px;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-shrink: 0;
}

.phms-assistant-mock {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  line-height: 1.25;
  text-align: center;
  white-space: normal;
  max-width: 100%;
  box-sizing: border-box;
  word-break: break-word;
}

.phms-assistant-mock--pill-warn {
  background: linear-gradient(135deg, rgb(220 38 38 / 75%), rgb(69 10 10 / 90%));
  color: #fff;
  border: 1px solid rgba(239, 68, 68, 0.45);
}

.phms-assistant-mock--pill {
  background: linear-gradient(135deg, #16a34a, #059669);
  color: #fff;
}

.phms-assistant-mock--pill-ok {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #fff;
}

.phms-assistant-mock--tile {
  background: #3b82f6;
  color: #fff;
}

.phms-assistant-mock--badge,
.phms-assistant-mock--screen {
  background: rgba(15, 39, 72, 0.9);
  color: #7dd3fc;
  border: 1px solid rgba(56, 189, 248, 0.3);
}

@media (max-width: 900px) {
  .phms-assistant__panel {
    width: min(100vw - 20px, 98vw);
    height: 96vh;
    min-height: 0;
  }

  .phms-assistant-step-card {
    grid-template-columns: 32px 1fr;
    grid-template-areas:
      "num body"
      "visual visual";
  }

  .phms-assistant-step-card__num {
    grid-area: num;
  }

  .phms-assistant-step-card__body {
    grid-area: body;
  }

  .phms-assistant-step-card__visual {
    grid-area: visual;
    min-width: 0;
    max-width: none;
    width: 100%;
    margin-top: 4px;
  }
}

/* الوضع الفاتح */
body.theme-light .phms-assistant__panel {
  background: #f0f9ff;
  border-color: #a5b4fc;
}

body.theme-light .phms-assistant__orb--1 { opacity: 0.35; background: #818cf8; }
body.theme-light .phms-assistant__orb--2 { opacity: 0.3; background: #22d3ee; }
body.theme-light .phms-assistant__orb--3 { opacity: 0.28; background: #c084fc; }

body.theme-light .phms-assistant__head {
  background: rgba(255, 255, 255, 0.55);
}

body.theme-light .phms-assistant__head h2 {
  color: #0f2748;
}

body.theme-light .phms-assistant__intro {
  color: #475569;
}

body.theme-light .phms-assistant__msg--bot .phms-assistant__bubble-inner {
  background: rgba(255, 255, 255, 0.85);
  color: #1e293b;
  border-color: #cbd5e1;
}

body.theme-light .phms-assistant__msg--user .phms-assistant__bubble-inner {
  color: #fff;
}

body.theme-light .phms-assistant__composer textarea {
  background: #fff;
  color: #0f2748;
  border-color: #93c5fd;
}

body.theme-light .phms-assistant-flow__head {
  color: #0284c7;
}
