/* ============================================================
   Workflow Diyagram Sistemi - Protez Takip
   Tab + Inline Panel + 4 Farkli Diyagram
   ============================================================ */

/* --- RENK DEGISKENLERI (Logo Bazli) --- */
:root {
  --pt-primary: #3b2a7e;
  --pt-primary-light: #5b4a9e;
  --pt-primary-lighter: #ebe7f6;
  --pt-secondary: #6cc8e8;
  --pt-secondary-light: #a8e2f6;
  --pt-secondary-lighter: #e8f7fc;
  --pt-accent: #8b5cf6;
  --pt-accent-light: #c4b5fd;
  --pt-node-bg: #f3f0ff;
  --pt-node-border: #ddd6fe;
  --pt-line: #7ed3f0;
  --pt-line-active: #0ea5e9;
  --pt-surface: #ffffff;
  --pt-surface-alt: #f8f7fc;
  --pt-text-dark: #1e1a2e;
  --pt-text-mid: #5b5675;
  --pt-text-light: #8f8aa3;

  /* === Workflow diyagram (Labtodent stili — cyan/turkuaz tema) === */
  --wf-cyan:        #6cc8e8;
  --wf-cyan-soft:   #a8e2f6;
  --wf-cyan-lighter:#e8f7fc;
  --wf-cyan-deep:   #0ea5e9;
  --wf-line:        #7ed3f0;
  --wf-line-soft:   #bfe7f5;
  --wf-card-border: #d6eef8;
  --wf-icon-bg:     #e0f2fe;
  --wf-icon-color:  #0369a1;
  --wf-entry:       #4a3795;
  --wf-entry-bg:    #f1edfb;
  --wf-final:       #10b981;
  --wf-final-bg:    #ecfdf5;
}

/* --- STEP ITEMS OVERRIDE: TIKLANABILIR TABLAR --- */
.step-grid {
  position: relative;
}

.step-item {
  cursor: pointer;
  transition: transform 0.3s ease, background 0.3s ease, box-shadow 0.3s ease;
  position: relative;
  border: none;
  border-radius: var(--radius-lg, 1rem);
}

.step-item:hover {
  transform: translateY(-2px);
}

.step-item.wf-tab-active {
  background: transparent;
  box-shadow: none;
}

.step-item.wf-tab-active .step-number {
  background: var(--pt-primary) !important;
  color: #fff !important;
}

.step-item.wf-tab-active .text-gradient {
  background: linear-gradient(135deg, var(--pt-primary), var(--pt-accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Aktif tab altinda ucgen isareti */
.step-item::after {
  content: '';
  position: absolute;
  bottom: -14px;
  left: 50%;
  transform: translateX(-50%) scaleY(0);
  width: 0;
  height: 0;
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-top: 10px solid var(--pt-accent);
  transition: transform 0.3s ease;
  transform-origin: top center;
}

.step-item.wf-tab-active::after {
  transform: translateX(-50%) scaleY(1);
}

/* --- INLINE PANEL --- */
.wf-panel-container {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.5s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.4s ease,
              margin 0.4s ease;
  opacity: 0;
  margin-top: 0;
  background: var(--pt-surface);
  border-radius: 16px;
  border: 1.5px solid var(--pt-node-border);
  box-shadow: 0 8px 32px rgba(59, 42, 126, 0.08);
}

.wf-panel-container.wf-panel-open {
  max-height: 1500px;
  opacity: 1;
  margin-top: 2rem;
}

.wf-panel {
  padding: 2.5rem;
  position: relative;
}

.wf-panel-content {
  display: none;
  animation: wfFadeIn 0.4s ease forwards;
}

.wf-panel-content.wf-content-active {
  display: block;
}

@keyframes wfFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Panel ust bar */
.wf-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--pt-node-border);
}

.wf-panel-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--pt-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.wf-panel-title i {
  width: 20px;
  height: 20px;
  color: var(--pt-accent);
}

.wf-panel-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--pt-node-border);
  background: var(--pt-surface-alt);
  color: var(--pt-text-mid);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: all 0.2s;
}

.wf-panel-close:hover {
  background: var(--pt-primary-lighter);
  color: var(--pt-primary);
  border-color: var(--pt-accent-light);
}

/* ============================================================
   ORTAK DIYAGRAM STILLERI
   ============================================================ */

/* Diyagram kapsayicisi */
.wf-diagram {
  position: relative;
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 0;
  min-height: 220px;
  overflow: visible;
  padding: 1.5rem 0;
}

/* Linear panel: yatay scroll gerekebilir (mobil) */
.wf-diagram.wf-linear { overflow-x: auto; overflow-y: visible; }
.wf-diagram::-webkit-scrollbar { height: 4px; }
.wf-diagram::-webkit-scrollbar-track { background: transparent; }
.wf-diagram::-webkit-scrollbar-thumb { background: var(--wf-cyan-soft); border-radius: 2px; }

/* === Node — Beyaz kart stili (Labtodent gorseli) === */
.wf-node {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  text-align: center;
  flex-shrink: 0;
  gap: 0.4rem;
  padding: 0.95rem 1rem 1rem;
  min-width: 118px;
  max-width: 148px;
  min-height: 150px;
  background: var(--pt-surface);
  border: 1.5px solid var(--wf-card-border);
  border-radius: 14px;
  box-shadow: 0 2px 10px rgba(13, 71, 116, 0.05);
  opacity: 0;
  transform: translateY(12px);
  transition: opacity .4s ease, transform .25s ease, border-color .25s ease, box-shadow .25s ease;
}

.wf-content-active .wf-node {
  opacity: 1;
  transform: translateY(0);
}

.wf-node:hover {
  border-color: var(--wf-cyan);
  box-shadow: 0 6px 22px rgba(14, 165, 233, 0.12);
  transform: translateY(-2px);
}

/* Staggered animasyon */
.wf-content-active .wf-node:nth-child(1) { transition-delay: 0.05s; }
.wf-content-active .wf-node:nth-child(2) { transition-delay: 0.10s; }
.wf-content-active .wf-node:nth-child(3) { transition-delay: 0.15s; }
.wf-content-active .wf-node:nth-child(4) { transition-delay: 0.20s; }
.wf-content-active .wf-node:nth-child(5) { transition-delay: 0.25s; }
.wf-content-active .wf-node:nth-child(6) { transition-delay: 0.30s; }
.wf-content-active .wf-node:nth-child(7) { transition-delay: 0.35s; }

.wf-node__icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--wf-icon-bg) !important;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--wf-icon-color) !important;
  margin: 0 auto 0.1rem;
  box-shadow: none;
  flex-shrink: 0;
  transition: transform .2s ease;
}

.wf-node:hover .wf-node__icon {
  transform: scale(1.06);
  box-shadow: none;
}

.wf-node__icon svg,
.wf-node__icon i {
  width: 20px;
  height: 20px;
  stroke-width: 2;
}

.wf-node__title {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--pt-text-dark);
  margin-bottom: 0.15rem;
  line-height: 1.25;
  max-width: 120px;
}

.wf-node__desc {
  font-size: 0.68rem;
  color: var(--pt-text-light);
  line-height: 1.4;
  max-width: 120px;
  font-weight: 500;
}

/* === Node varyantlari (kart kenarliklari) === */
.wf-node--entry {
  border-color: var(--wf-entry);
  background: linear-gradient(150deg, #ffffff 55%, var(--wf-entry-bg));
  box-shadow: 0 3px 14px rgba(74, 55, 149, 0.10);
}

.wf-node--final {
  border-color: var(--wf-final);
  background: linear-gradient(150deg, #ffffff 55%, var(--wf-final-bg));
  box-shadow: 0 3px 14px rgba(16, 185, 129, 0.10);
}

.wf-node--final .wf-node__icon {
  background: #d1fae5 !important;
  color: #047857 !important;
}

.wf-node--exit {
  border-color: var(--wf-cyan);
  background: linear-gradient(150deg, #ffffff 55%, var(--wf-cyan-lighter));
}

/* === Ok / Baglanti cizgisi === */
.wf-arrow,
.wf-linear-line {
  color: var(--wf-line);
}

.wf-arrow svg,
.wf-linear-line svg {
  overflow: visible;
}

.wf-dash,
.wf-linear-line .wf-dash,
.wf-arrow .wf-dash {
  stroke: var(--wf-line);
  stroke-width: 1.6;
  stroke-dasharray: 5 4;
  fill: none;
  animation: wfDashFlow 1.4s linear infinite;
}

.wf-arrowhead,
.wf-linear-line .wf-arrowhead,
.wf-arrow .wf-arrowhead {
  stroke: var(--wf-cyan);
  stroke-width: 1.8;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

@keyframes wfDashFlow {
  to { stroke-dashoffset: -18; }
}

/* ============================================================
   PANEL 1: IS GIRISI & BARKOD - LINEER AKIS
   ============================================================ */

.wf-linear {
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 0;
  flex-wrap: nowrap;
}

.wf-linear .wf-node {
  min-width: 118px;
  max-width: 148px;
}

/* Animasyonlu noktali cizgi (yatay) — kart ortasina hizali */
.wf-linear-line {
  position: relative;
  width: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.wf-linear-line svg {
  overflow: visible;
}

/* ============================================================
   PANEL 2: URETIM ASAMALARI - OVAL HUB
   ============================================================ */

.wf-production {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  position: relative;
  min-height: 420px;
  padding: 40px 0 50px;
}

/* Oval Hub */
.wf-hub {
  position: relative;
  width: 320px;
  height: 320px;
  flex-shrink: 0;
}

.wf-hub__svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

/* Hub merkez etiketi */
.wf-hub__center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  z-index: 2;
  pointer-events: none;
}

.wf-hub__center-icon {
  width: 30px;
  height: 30px;
  margin: 0 auto 0.3rem;
  color: var(--wf-cyan);
  opacity: 0.7;
}

.wf-hub__center-text {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--pt-text-light);
  line-height: 1.3;
  letter-spacing: 0.02em;
}

/* === Hub node'lari (Beyaz kart, cyan kenarlik) === */
.wf-hub__node {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  z-index: 3;
  transform: translate(-50%, -50%);
  padding: 0.6rem 0.75rem 0.65rem;
  min-width: 92px;
  background: var(--pt-surface);
  border: 1.5px solid var(--wf-cyan-soft);
  border-radius: 12px;
  box-shadow: 0 2px 10px rgba(13, 71, 116, 0.06);
  transition: all 0.22s ease;
}

.wf-hub__node:hover {
  border-color: var(--wf-cyan-deep);
  box-shadow: 0 6px 22px rgba(14, 165, 233, 0.15);
  z-index: 5;
}

.wf-hub__node-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--wf-icon-bg);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--wf-icon-color);
  margin: 0 auto 0.3rem;
  transition: transform 0.2s;
  box-shadow: none;
}

.wf-hub__node:hover .wf-hub__node-icon {
  transform: scale(1.08);
  background: #d1edfa;
}

.wf-hub__node-icon svg,
.wf-hub__node-icon i {
  width: 18px;
  height: 18px;
  stroke-width: 2;
}

.wf-hub__node-title {
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--pt-text-dark);
  line-height: 1.2;
  margin-bottom: 0.2rem;
}

.wf-hub__node-sub {
  display: flex;
  gap: 3px;
  flex-wrap: wrap;
  justify-content: center;
}

.wf-hub__pill {
  font-size: 0.58rem;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 8px;
  background: var(--wf-cyan-lighter);
  color: var(--wf-cyan-deep);
  white-space: nowrap;
}

/* Hub node pozisyonlari (6 birim, dairesel) */
.wf-hub__node--n  { top: 6%;  left: 50%; }
.wf-hub__node--ne { top: 26%; left: 90%; }
.wf-hub__node--se { top: 74%; left: 90%; }
.wf-hub__node--s  { top: 94%; left: 50%; }
.wf-hub__node--sw { top: 74%; left: 10%; }
.wf-hub__node--nw { top: 26%; left: 10%; }

/* Hub ring (SVG ellipse) — cyan tema */
.wf-hub__svg ellipse[stroke],
.wf-hub__svg circle[stroke] {
  stroke: var(--wf-cyan-soft) !important;
}

.wf-hub__ring-anim {
  stroke: var(--wf-cyan) !important;
  opacity: 0.55 !important;
  animation: wfHubSpin 18s linear infinite;
  transform-origin: center;
}

.wf-hub__svg line[stroke] {
  stroke: var(--wf-line-soft) !important;
}

@keyframes wfHubSpin {
  to { stroke-dashoffset: -880; }
}

/* Giris/Cikis node'lari (hub disinda) */
.wf-production .wf-side-node {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  min-width: 90px;
}

/* ============================================================
   PANEL 3: KALITE KONTROL - DALLANMA
   ============================================================ */

.wf-quality {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  position: relative;
}

/* Buyuk kontrol node'u */
.wf-node--big .wf-node__icon {
  width: 64px;
  height: 64px;
}

.wf-node--big .wf-node__icon svg,
.wf-node--big .wf-node__icon i {
  width: 28px;
  height: 28px;
}

/* Dallanma grubu (Prova / Kontrol — dashed border container) */
.wf-branch {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 1rem;
  position: relative;
  padding: 1rem 1.25rem;
  background: rgba(126, 211, 240, 0.05);
  border: 1.5px dashed var(--wf-cyan-soft);
  border-radius: 16px;
}

.wf-branch-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Dongu oku (prova) */
.wf-loop-arrow {
  position: absolute;
  color: var(--pt-line-active, var(--pt-accent));
}

.wf-loop-arrow .wf-dash {
  stroke: var(--pt-accent);
  stroke-width: 1.5;
  stroke-dasharray: 5 4;
  animation: wfDashFlow 2s linear infinite;
}

/* ============================================================
   PANEL 4: TESLIMAT & FINANS - DIKEY + YATAY
   ============================================================ */

.wf-delivery {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
}

/* Dikey grup */
.wf-vgroup {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

.wf-vgroup .wf-node {
  min-width: 110px;
}

/* Dikey ok */
.wf-varrow {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 24px;
  color: var(--pt-line);
}

/* Yan dal (kuryeye atama, teslim alma) */
.wf-side-branch {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  position: relative;
}

/* Kuryeye atama ve teslim alma blogu */
.wf-courier-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  background: rgba(126, 211, 240, 0.05);
  border: 1.5px dashed var(--wf-cyan-soft);
  border-radius: 14px;
  padding: 0.85rem 1rem;
}

.wf-courier-block .wf-node {
  min-width: 100px;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 768px) {
  .wf-panel {
    padding: 1.5rem 1rem;
  }

  .wf-linear {
    gap: 0;
    overflow-x: auto;
    justify-content: flex-start;
    padding-bottom: 0.5rem;
  }

  .wf-production {
    flex-direction: column;
    gap: 1.5rem;
  }

  .wf-hub {
    width: 260px;
    height: 260px;
  }

  .wf-quality {
    flex-direction: column;
    gap: 1rem;
    align-items: center;
  }

  .wf-branch {
    align-items: center;
  }

  .wf-delivery {
    flex-direction: column;
    gap: 1rem;
  }

  .wf-delivery .wf-vgroup {
    flex-direction: row;
    gap: 0.5rem;
  }

  .wf-node__title {
    font-size: 0.72rem;
  }

  .wf-node__desc {
    font-size: 0.65rem;
  }
}

@media (max-width: 480px) {
  .wf-hub {
    width: 220px;
    height: 220px;
  }

  .wf-hub__node-icon {
    width: 36px;
    height: 36px;
  }

  .wf-hub__node-title {
    font-size: 0.65rem;
  }

  .wf-hub__pill {
    font-size: 0.52rem;
  }

  .wf-node__icon {
    width: 42px;
    height: 42px;
  }

  .wf-panel-container.wf-panel-open {
    max-height: 800px;
  }
}
