/* =============================================================
   Page /product-builder/workflow — diagramme Mermaid interactif
   Classes préfixées .pbw-* pour éviter collision avec product-builder.css
   Réutilise les design tokens globaux (--accent, --line, --font-*, etc.).
   ============================================================= */

.pbw-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding-top: 96px;
    position: relative;
    z-index: 1; /* au-dessus de la sphère hero fixed z-index 0 */
}

/* ===== Header (titre + hint) ===== */
.pbw-head {
    padding-bottom: 20px;
    flex-shrink: 0;
}
.pbw-back {
    display: inline-flex; align-items: center; gap: 6px;
    font-family: var(--font-mono); font-size: 11px;
    letter-spacing: 0.14em; text-transform: uppercase;
    color: var(--text-dim);
    padding: 6px 12px; border-radius: 999px;
    border: 0.5px solid var(--line);
    background: rgb(var(--tint) / 0.04);
    transition: all 240ms ease;
    margin-bottom: 18px;
}
.pbw-back:hover { color: var(--text); background: rgb(var(--tint) / 0.08); }

.pbw-eyebrow {
    font-family: var(--font-mono); font-size: 11px;
    letter-spacing: 0.14em; text-transform: uppercase;
    color: var(--text-dim);
    display: inline-flex; align-items: center; gap: 10px;
}
.pbw-eyebrow::before {
    content: ""; width: 6px; height: 6px; border-radius: 50%;
    background: var(--accent); box-shadow: 0 0 12px var(--accent);
}
.pbw-title {
    font-size: clamp(22px, 2.6vw, 32px);
    font-weight: 500; letter-spacing: -0.02em; line-height: 1.15;
    margin: 12px 0 10px;
    text-wrap: balance;
}
.pbw-hint {
    font-family: var(--font-mono); font-size: 11px;
    letter-spacing: 0.06em;
    color: var(--text-dim);
    display: inline-flex; align-items: center; gap: 8px;
    margin: 0;
}
.pbw-hint-dot {
    width: 7px; height: 7px; border-radius: 50%;
    background: var(--accent); box-shadow: 0 0 8px var(--accent);
    opacity: 0.85;
}

/* ===== Main : canvas full-width ===== */
.pbw-main {
    flex: 1; display: flex; flex-direction: column;
    padding: 0 clamp(20px, 4vw, 40px) 32px;
    min-height: 0;
}
.pbw-canvas {
    flex: 1;
    position: relative;
    overflow: hidden;
    border-radius: 16px;
    border: 0.5px solid var(--line);
    background: rgba(15, 15, 15, 0.6);
    backdrop-filter: blur(12px) saturate(150%);
    -webkit-backdrop-filter: blur(12px) saturate(150%);
    cursor: grab;
    min-height: 500px;
}
.pbw-canvas.is-dragging { cursor: grabbing; }
/* .mermaid fill le canvas (position absolute pour neutraliser le sizing intrinsèque
   du SVG injecté par Mermaid, qui sinon le bloque à ~200px). */
.pbw-canvas .mermaid {
    position: absolute;
    inset: 0;
    width: 100%; height: 100%;
}
.pbw-canvas svg {
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    max-height: none !important;
    display: block;
}

/* ===== HUD zoom (bouton +/- /reset) ===== */
.pbw-hud {
    position: absolute; right: 16px; bottom: 16px;
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    z-index: 2;
}
.pbw-hud-btn {
    width: 32px; height: 32px;
    background: rgba(30, 30, 35, 0.9);
    backdrop-filter: blur(12px);
    border: 0.5px solid var(--line-strong, rgb(var(--tint) / 0.14));
    border-radius: 8px;
    color: var(--text); font-size: 16px;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all 200ms ease;
    user-select: none;
    font-family: inherit;
}
.pbw-hud-btn:hover {
    background: rgba(50, 50, 60, 0.95);
    border-color: var(--accent);
}
.pbw-hud-btn--small { font-size: 12px; }
.pbw-hud-pct {
    font-family: var(--font-mono); font-size: 10px;
    color: var(--text-dim); text-align: center;
    min-width: 32px;
    letter-spacing: 0.05em;
}

/* ===== Popup agent IA ===== */
.pbw-popup {
    position: fixed; z-index: 100;
    background: rgba(18, 18, 18, 0.94);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 0.5px solid var(--accent);
    border-radius: 14px;
    padding: 16px 18px;
    width: 300px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(0, 113, 227, 0.15);
    opacity: 0;
    pointer-events: none;
    transform: translateY(6px);
    transition: opacity 220ms ease, transform 220ms ease;
}
.pbw-popup[data-visible="true"] {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}
.pbw-popup-top {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 10px;
}
.pbw-popup-badge {
    font-family: var(--font-mono);
    font-size: 10px; font-weight: 500;
    letter-spacing: 0.14em; text-transform: uppercase;
    color: var(--accent);
    display: inline-flex; align-items: center; gap: 6px;
}
.pbw-popup-badge::before { content: '🤖'; font-size: 13px; }
.pbw-popup-close {
    background: none; border: none;
    color: var(--text-dim);
    font-size: 18px; line-height: 1;
    padding: 2px 6px; border-radius: 4px;
    cursor: pointer;
    transition: color 200ms ease, background 200ms ease;
}
.pbw-popup-close:hover { color: var(--text); background: rgb(var(--tint) / 0.06); }
.pbw-popup-name {
    font-size: 15px; font-weight: 600;
    color: var(--text);
    margin-bottom: 8px;
    letter-spacing: -0.01em;
}
.pbw-popup-desc {
    font-size: 13px;
    color: var(--text-dim);
    line-height: 1.55;
}

/* ===== Mobile (tactile sans drag/wheel, on adapte) ===== */
@media (max-width: 760px) {
    .pbw-page { padding-top: 80px; }
    .pbw-canvas { min-height: 420px; }
    .pbw-hud { right: 12px; bottom: 12px; }
    .pbw-popup { width: calc(100vw - 32px); max-width: 320px; }
}
