/* ════════════════════════════════════════════════════════════════
   tp-visual-journey.css — Visual Story Journey Layer v1.0
   Pure presentation — no impact on pricing or tracking logic
   ════════════════════════════════════════════════════════════════ */

/* ── Keyframes ── */
@keyframes vj-float {
  0%, 100% { transform: translateY(0px) rotate(-1deg); }
  50%       { transform: translateY(-8px) rotate(1deg); }
}

@keyframes vj-glow-pulse {
  0%, 100% { box-shadow: 0 4px 24px var(--vj-glow, rgba(124,58,237,0.2)); }
  50%       { box-shadow: 0 8px 40px var(--vj-glow, rgba(124,58,237,0.45)); }
}

@keyframes vj-bounce-in {
  0%   { opacity: 0; transform: scale(0.6) translateY(20px); }
  70%  { transform: scale(1.07) translateY(-3px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes vj-slide-in-right {
  from { opacity: 0; transform: translateX(30px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes vj-progress-grow {
  from { width: 0% !important; }
}

@keyframes vj-shimmer {
  0%   { background-position: -200% center; }
  100% { background-position: 200% center; }
}

@keyframes vj-spin-slow {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

@keyframes vj-highlight-pulse {
  0%, 100% { outline: 3px solid transparent; }
  50%       { outline: 3px solid #7C3AED; outline-offset: 4px; }
}

/* ── Root Container ── */
.vj-root {
  position: relative;
  background: linear-gradient(145deg, #FAFAF9 0%, #F5F3FF 40%, #ECFDF5 100%);
  border-radius: 20px;
  border: 1px solid rgba(124,58,237,0.1);
  padding: 1.5rem 1.25rem 1rem;
  margin: 1.25rem 0;
  overflow: hidden;
  font-family: 'Cairo', sans-serif;
  direction: rtl;
}

/* ── Path background decoration ── */
.vj-path-bg {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}
.vj-path-svg {
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0; left: 0;
}

/* ── Header ── */
.vj-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
  position: relative;
  z-index: 1;
}
.vj-header-icon {
  font-size: 2rem;
  line-height: 1;
  flex-shrink: 0;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.15));
  animation: vj-spin-slow 30s linear infinite;
}
.vj-header-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: #1C1917;
  margin: 0 0 .15rem;
  letter-spacing: -.3px;
}
.vj-header-sub {
  font-size: .8rem;
  color: #78716C;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .3rem;
}

/* Status badges in header */
.vj-plan-status-done {
  display: inline-flex; align-items: center; gap: .25rem;
  background: #DCFCE7; color: #16A34A;
  padding: .15rem .55rem; border-radius: 999px;
  font-size: .72rem; font-weight: 700;
}
.vj-plan-status-active {
  display: inline-flex; align-items: center; gap: .25rem;
  background: #EDE9FE; color: #7C3AED;
  padding: .15rem .55rem; border-radius: 999px;
  font-size: .72rem; font-weight: 700;
}
.vj-plan-status-archived {
  display: inline-flex; align-items: center; gap: .25rem;
  background: #F5F5F4; color: #78716C;
  padding: .15rem .55rem; border-radius: 999px;
  font-size: .72rem; font-weight: 700;
}

/* ── Stages Track ── */
.vj-stages-track {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 0;
  overflow-x: auto;
  padding-bottom: .75rem;
  position: relative;
  z-index: 1;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: rgba(124,58,237,0.3) transparent;
}
.vj-stages-track::-webkit-scrollbar {
  height: 4px;
}
.vj-stages-track::-webkit-scrollbar-thumb {
  background: rgba(124,58,237,0.3);
  border-radius: 99px;
}

/* ── Stage Wrap (card + connector) ── */
.vj-stage-wrap {
  display: flex;
  flex-direction: row;
  align-items: center;
  flex-shrink: 0;
  scroll-snap-align: start;
}

/* ── Card ── */
.vj-card {
  position: relative;
  width: 160px;
  min-height: 240px;
  background: var(--vj-gradient, #FAFAF9);
  border: 2px solid var(--vj-border, #E5E7EB);
  border-radius: 18px;
  padding: 1rem .85rem .85rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  cursor: pointer;
  user-select: none;
  transition:
    transform 0.28s cubic-bezier(.34,1.56,.64,1),
    box-shadow 0.28s ease,
    border-color 0.2s ease;
  box-shadow: 0 3px 14px var(--vj-glow, rgba(0,0,0,0.08));
  outline: none;
}
.vj-card:hover,
.vj-card:focus {
  transform: scale(1.05) translateY(-4px);
  box-shadow: 0 10px 36px var(--vj-glow, rgba(0,0,0,0.18));
  border-color: var(--vj-color, #7C3AED);
  animation: vj-glow-pulse 2.5s ease-in-out infinite;
}
.vj-card:active {
  transform: scale(0.97) translateY(0);
}

/* Completed card shimmer */
.vj-card-completed {
  background: linear-gradient(135deg,
    var(--vj-light, #D1FAE5) 0%,
    rgba(255,255,255,0.9) 50%,
    var(--vj-light, #D1FAE5) 100%);
  background-size: 200% auto;
  animation: vj-shimmer 4s linear infinite;
}

/* Active card slight glow */
.vj-card-active {
  animation: vj-glow-pulse 3s ease-in-out infinite;
}

/* Upcoming card — muted */
.vj-card-upcoming {
  opacity: 0.88;
  filter: saturate(0.7);
}
.vj-card-upcoming:hover {
  opacity: 1;
  filter: saturate(1);
}

/* ── Stage number badge ── */
.vj-stage-num {
  position: absolute;
  top: -10px;
  right: -10px;  /* RTL: top-right = top-left in LTR */
  width: 24px;
  height: 24px;
  border-radius: 50%;
  color: #fff;
  font-size: .72rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.18);
  z-index: 2;
}
[dir="rtl"] .vj-stage-num { right: -10px; left: auto; }

/* ── Status badge ── */
.vj-status-badge {
  display: inline-flex;
  align-items: center;
  gap: .2rem;
  font-size: .62rem;
  font-weight: 700;
  padding: .15rem .5rem;
  border-radius: 999px;
  margin-bottom: .5rem;
  flex-shrink: 0;
}
.vj-badge-done     { background:#DCFCE7; color:#16A34A; }
.vj-badge-active   { background:#EDE9FE; color:#7C3AED; }
.vj-badge-upcoming { background:#F5F5F4; color:#78716C; }

/* ── Character ── */
.vj-char-wrap {
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: .25rem 0 .5rem;
  flex-shrink: 0;
}
.vj-char-img {
  width: 80px;
  height: 80px;
  object-fit: contain;
  border-radius: 12px;
  animation: vj-float 4s ease-in-out infinite;
  filter: drop-shadow(0 4px 12px var(--vj-glow, rgba(0,0,0,0.15)));
}
.vj-card-upcoming .vj-char-img {
  animation-play-state: paused;
  opacity: 0.7;
}
.vj-card-active .vj-char-img,
.vj-card-completed .vj-char-img {
  animation-play-state: running;
}
.vj-char-emoji {
  font-size: 3.2rem;
  line-height: 1;
  animation: vj-float 4s ease-in-out infinite;
  display: block;
}

/* ── Card Body ── */
.vj-card-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .3rem;
  width: 100%;
}
.vj-visual-label {
  font-size: .68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .5px;
  opacity: 0.85;
}
.vj-stage-name {
  font-size: .78rem;
  font-weight: 700;
  color: #1C1917;
  margin: 0;
  line-height: 1.35;
  word-break: break-word;
}
.vj-stage-desc {
  font-size: .65rem;
  color: #78716C;
  margin: 0;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── Service chips ── */
.vj-svc-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: .2rem;
  margin-top: .15rem;
}
.vj-svc-chip {
  display: inline-flex;
  align-items: center;
  gap: .15rem;
  font-size: .58rem;
  font-weight: 700;
  padding: .12rem .38rem;
  border-radius: 999px;
}
.vj-svc-indiv  { background:#EEF2FF; color:#4F46E5; }
.vj-svc-parent { background:#F0FDF4; color:#16A34A; }
.vj-svc-group  { background:#FFF7ED; color:#EA580C; }
.vj-svc-home   { background:#F5F3FF; color:#7C3AED; }

/* ── Progress bar ── */
.vj-progress-wrap {
  width: 100%;
  display: flex;
  align-items: center;
  gap: .35rem;
  margin-top: .3rem;
}
.vj-progress-track {
  flex: 1;
  height: 5px;
  background: rgba(0,0,0,0.08);
  border-radius: 99px;
  overflow: hidden;
}
.vj-progress-fill {
  height: 100%;
  border-radius: 99px;
  transition: width 0.8s cubic-bezier(.4,0,.2,1);
  min-width: 2px;
}
.vj-progress-label {
  font-size: .6rem;
  font-weight: 700;
  flex-shrink: 0;
  opacity: 0.9;
}

/* ── Connector between cards ── */
.vj-connector {
  width: 36px;
  height: 80px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.vj-conn-svg {
  width: 36px;
  height: 80px;
}

/* ── Footer note ── */
.vj-footer-note {
  text-align: center;
  font-size: .68rem;
  color: #A8A29E;
  margin-top: .75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .3rem;
  position: relative;
  z-index: 1;
}
.vj-footer-note i {
  color: #7C3AED;
  opacity: 0.7;
}

/* ── Entrance animations ── */
.vj-stage-wrap {
  animation: vj-bounce-in 0.5s cubic-bezier(.34,1.56,.64,1) both;
}
.vj-stage-wrap:nth-child(1)  { animation-delay: 0.05s; }
.vj-stage-wrap:nth-child(2)  { animation-delay: 0.15s; }
.vj-stage-wrap:nth-child(3)  { animation-delay: 0.25s; }
.vj-stage-wrap:nth-child(4)  { animation-delay: 0.35s; }
.vj-stage-wrap:nth-child(5)  { animation-delay: 0.45s; }
.vj-stage-wrap:nth-child(6)  { animation-delay: 0.55s; }

/* ── Highlight pulse (scroll target) ── */
.vj-highlight-pulse {
  animation: vj-highlight-pulse 0.6s ease-in-out 3 !important;
}

/* ── Container placement ── */
#vj-visual-journey-container {
  margin-bottom: .5rem;
}
#vj-visual-journey-container:empty {
  display: none;
}

/* ════════════════════════════
   RESPONSIVE — MOBILE
   ════════════════════════════ */

/* On mobile: vertical stack */
@media (max-width: 640px) {
  .vj-stages-track {
    flex-direction: column;
    align-items: stretch;
    overflow-x: visible;
    gap: 0;
    scroll-snap-type: none;
  }

  .vj-stage-wrap {
    flex-direction: column;
    align-items: center;
    width: 100%;
  }

  .vj-card {
    width: 100%;
    max-width: 100%;
    min-height: unset;
    flex-direction: row;
    text-align: right;
    padding: .85rem 1rem;
    align-items: flex-start;
    gap: .85rem;
  }
  [dir="rtl"] .vj-card {
    flex-direction: row-reverse;
    text-align: right;
  }

  .vj-char-wrap {
    width: 64px;
    height: 64px;
    flex-shrink: 0;
    margin: 0;
  }
  .vj-char-img  { width: 64px; height: 64px; }
  .vj-char-emoji { font-size: 2.5rem; }

  .vj-card-body {
    align-items: flex-start;
    flex: 1;
  }
  .vj-stage-num {
    top: -8px;
    right: -8px;
  }
  [dir="rtl"] .vj-stage-num { right: -8px; left: auto; }

  .vj-connector {
    width: 3px;
    height: 32px;
    flex-direction: column;
  }
  .vj-conn-svg {
    width: 3px;
    height: 32px;
  }

  .vj-status-badge { margin-bottom: .25rem; }

  .vj-stage-wrap {
    animation: vj-slide-in-right 0.4s ease both;
  }
  .vj-stage-wrap:nth-child(1) { animation-delay: 0.05s; }
  .vj-stage-wrap:nth-child(2) { animation-delay: 0.12s; }
  .vj-stage-wrap:nth-child(3) { animation-delay: 0.19s; }
  .vj-stage-wrap:nth-child(4) { animation-delay: 0.26s; }
  .vj-stage-wrap:nth-child(5) { animation-delay: 0.33s; }
  .vj-stage-wrap:nth-child(6) { animation-delay: 0.40s; }
}

/* ── Tablets: 2-column grid ── */
@media (min-width: 641px) and (max-width: 900px) {
  .vj-stages-track {
    flex-wrap: wrap;
    overflow-x: visible;
    justify-content: center;
    gap: .75rem;
  }
  .vj-stage-wrap {
    flex-direction: column;
    align-items: center;
  }
  .vj-card { width: 145px; }
  .vj-connector { display: none; }
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  .vj-char-img,
  .vj-char-emoji,
  .vj-header-icon,
  .vj-card-completed,
  .vj-card-active {
    animation: none !important;
    transition: opacity 0.2s ease !important;
  }
  .vj-progress-fill {
    transition: none !important;
  }
}

/* ── Print: hide visual journey to keep reports clean ── */
@media print {
  .vj-root { display: none !important; }
}
