/* Approval Pathway Editor (issue #363). Shared styling for the decomposed pathway components
   (PathwaySubHeader / PathwayCanvas / PathwayStepProperties + the host composition). High-fidelity
   to the design handoff. Review accent is CYAN (#0891b2) — ENGAGE never uses purple/indigo. */

.pw-editor { display: flex; flex-direction: column; background: #f9fafb; }

/* ── Top action bar (Discard / Save pathway) ─────────────────────────────── */
.pw-editor-bar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 8px 20px;
}
.pw-editor-title { font-size: 15px; font-weight: 600; color: #111827; }
.pw-editor-bar-actions { display: flex; gap: 10px; }
/* Prominent top-bar actions (Discard / Save pathway) — larger than the default in-page button. */
.pw-bar-btn {
    padding: 10px 20px; font-size: 14px; font-weight: 600; border-radius: 8px;
    display: inline-flex; align-items: center; gap: 8px;
}

/* ── Sub-header: editable name/description + status chips ─────────────────── */
.pw-subheader {
    display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
    padding: 14px 16px; background: #fff;
    border: 1px solid #e5e7eb; border-radius: 8px;
}
.pw-subheader-titles { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.pw-title-input {
    border: none; outline: none; padding: 2px 0; background: transparent;
    font-size: 20px; font-weight: 600; color: #111827; width: 100%;
}
.pw-title-input::placeholder { color: #9ca3af; }
.pw-desc-input {
    border: none; outline: none; padding: 2px 0; background: transparent;
    font-size: 13px; color: #6b7280; width: 100%;
}
.pw-subheader-status { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.pw-chip {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 10px; border-radius: 9999px; font-size: 12px; font-weight: 600; white-space: nowrap;
}
.pw-chip .pw-dot { width: 6px; height: 6px; border-radius: 9999px; background: currentColor; }
.pw-chip-neutral { background: #f3f4f6; color: #6b7280; }
.pw-chip-ready   { background: #d1fae5; color: #059669; }
.pw-chip-warn    { background: #fef3c7; color: #d97706; }

/* ── Body: canvas area + slide-in properties panel ───────────────────────── */
.pw-body { display: flex; align-items: stretch; gap: 0; margin-top: 12px; }
.pw-canvas-area { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 12px; }

.pw-hint {
    display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
    font-size: 12px; color: #6b7280; padding: 0 4px;
}
.pw-legend { display: flex; align-items: center; gap: 14px; }
.pw-legend-item { display: inline-flex; align-items: center; gap: 6px; }
.pw-legend-dot { width: 10px; height: 10px; border-radius: 9999px; border: 2px solid; }
.pw-legend-dot.kind-approval { border-color: #d1d5db; }
.pw-legend-dot.kind-review   { border-color: #0891b2; }
.pw-legend-dot.kind-reject   { border-color: #dc2626; background: repeating-linear-gradient(90deg,#dc2626 0 3px,transparent 3px 6px); }

/* ── Canvas board ────────────────────────────────────────────────────────── */
.pw-canvas-wrap {
    overflow-x: auto; overflow-y: hidden;
    border: 1px solid #e5e7eb; border-radius: 12px; box-shadow: 0 1px 3px rgba(0,0,0,.05);
    background: #fff;
}
.pw-canvas {
    position: relative;
    background-image: radial-gradient(circle, #e5e7eb 1px, transparent 1px);
    background-size: 22px 22px;
    min-width: 100%;
}
.pw-overlay { position: absolute; inset: 0; pointer-events: none; }

/* ── Step bubbles ────────────────────────────────────────────────────────── */
.pw-bubble-group {
    position: absolute; width: 168px;
    transform: translate(-50%, -28px);
    display: flex; flex-direction: column; align-items: center;
}
.pw-bubble {
    position: relative; width: 56px; height: 56px; border-radius: 9999px;
    background: #fff; border: 2px solid #d1d5db; cursor: grab;
    display: flex; align-items: center; justify-content: center;
    transition: box-shadow .15s, transform .15s, background .15s, border-color .15s;
    padding: 0;
}
.pw-bubble:active { cursor: grabbing; }
.pw-bubble.kind-approval  { border-color: #d1d5db; }
.pw-bubble.kind-review,
.pw-bubble.kind-external  { border-color: #0891b2; }
.pw-bubble.kind-signature { border-color: #2563eb; }
.pw-bubble-num { font-size: 18px; font-weight: 700; color: #6b7280; }

.pw-bubble.is-selected {
    background: #2563eb; border-color: #2563eb;
    box-shadow: 0 0 0 5px #dbeafe, 0 4px 12px rgba(0,0,0,.08);
}
.pw-bubble.is-selected .pw-bubble-num { color: #fff; }
.pw-bubble.is-dragging { opacity: .4; }
.pw-bubble.is-dragover { box-shadow: 0 0 0 4px #cffafe; }
.pw-bubble.is-popping { animation: pw-pop .24s cubic-bezier(.4,0,1,1) forwards; }

@keyframes pw-pop {
    0%   { transform: scale(1); }
    28%  { transform: scale(1.2); }
    100% { transform: scale(0); opacity: 0; }
}

/* Kind badge pill at the bubble's top-right */
.pw-bubble-badge {
    position: absolute; top: -9px; right: -4px;
    padding: 1px 5px; border-radius: 9999px;
    font-size: 8.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .02em;
    white-space: nowrap; line-height: 1.4;
    background: #fff; border: 1px solid #d1d5db; color: #6b7280;
}
.pw-bubble-badge.kind-review,
.pw-bubble-badge.kind-external { border-color: #0891b2; color: #0891b2; }
.pw-bubble-badge.kind-signature { border-color: #2563eb; color: #2563eb; }
.pw-bubble.is-selected .pw-bubble-badge { background: #2563eb; border-color: #fff; color: #fff; }

/* Caption under the bubble */
.pw-caption { margin-top: 12px; text-align: center; width: 168px; }
.pw-caption-name { font-size: 13px; font-weight: 600; color: #111827; overflow-wrap: anywhere; }
.pw-caption-assignee { font-size: 11px; color: #6b7280; overflow-wrap: anywhere; }
.pw-add-label { color: #6b7280; font-weight: 500; }

/* Add-step + insert affordances */
.pw-bubble.pw-add {
    border: 2px dashed #d1d5db; background: transparent; color: #9ca3af; cursor: pointer;
}
.pw-bubble.pw-add:hover { border-color: #2563eb; color: #2563eb; }
.pw-insert {
    position: absolute; width: 20px; height: 20px; border-radius: 9999px;
    border: 1px solid #d1d5db; background: #fff; color: #9ca3af; cursor: pointer;
    display: flex; align-items: center; justify-content: center; font-size: 10px; padding: 0;
    transition: border-color .15s, color .15s, transform .15s;
}
.pw-insert:hover { border-color: #2563eb; color: #2563eb; transform: scale(1.12); }

/* "on reject" pill at each arc apex */
.pw-reject-pill {
    position: absolute; transform: translate(-50%, -50%);
    padding: 1px 7px; border-radius: 9999px;
    background: #fff; border: 1px solid #fecaca; color: #dc2626;
    font-size: 9px; font-weight: 700; white-space: nowrap; pointer-events: none;
}
.pw-reject-pill.is-dim { opacity: .3; }

/* ── Properties side panel (slides in) ───────────────────────────────────── */
.pw-panel {
    width: 372px; flex-shrink: 0; background: #fff;
    border: 1px solid #e5e7eb; border-radius: 8px; margin-left: 12px;
    display: flex; flex-direction: column; align-self: flex-start;
    animation: pw-slidein .2s cubic-bezier(.4,0,.2,1);
}
@keyframes pw-slidein { from { transform: translateX(16px); opacity: 0; } to { transform: none; opacity: 1; } }
.pw-panel-head {
    display: flex; align-items: center; gap: 10px;
    padding: 14px 16px; border-bottom: 1px solid #e5e7eb;
}
.pw-panel-index {
    width: 24px; height: 24px; border-radius: 9999px; background: #2563eb; color: #fff;
    display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700;
}
.pw-panel-head h4 { margin: 0; flex: 1; font-size: 14px; font-weight: 600; color: #111827; }
.pw-panel-close {
    border: none; background: transparent; color: #9ca3af; cursor: pointer; padding: 4px; border-radius: 6px;
}
.pw-panel-close:hover { background: #f3f4f6; color: #374151; }

.pw-panel-body { padding: 18px 18px 22px; display: flex; flex-direction: column; gap: 16px; }
.pw-field { display: flex; flex-direction: column; gap: 6px; }
.pw-label { font-size: 12px; font-weight: 600; color: #374151; }
.pw-input {
    width: 100%; padding: 8px 10px; border: 1px solid #d1d5db; border-radius: 7px;
    font-size: 13px; color: #111827; background: #fff; outline: none;
}
.pw-input:focus { border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,.1); }
.pw-input[readonly] { background: #f9fafb; color: #6b7280; }

/* 4-kind type control (kept all four kinds; #363 decision) */
.pw-kind-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.pw-kind {
    padding: 8px 10px; border: 1px solid #d1d5db; border-radius: 7px; background: #fff;
    font-size: 12px; font-weight: 600; color: #6b7280; cursor: pointer; text-align: center;
    transition: border-color .15s, color .15s, background .15s;
}
.pw-kind:hover { border-color: #9ca3af; }
.pw-kind.is-active { background: #2563eb; border-color: #2563eb; color: #fff; }
.pw-kind.kind-review.is-active, .pw-kind.kind-external.is-active { background: #0891b2; border-color: #0891b2; }

/* User | Group segmented toggle */
.pw-seg { display: inline-flex; border: 1px solid #d1d5db; border-radius: 7px; overflow: hidden; width: 100%; }
.pw-seg-btn {
    flex: 1; padding: 7px 10px; border: none; background: #fff; color: #6b7280;
    font-size: 12px; font-weight: 600; cursor: pointer; transition: background .15s, color .15s;
}
.pw-seg-btn + .pw-seg-btn { border-left: 1px solid #d1d5db; }
.pw-seg-btn.is-active { background: #2563eb; color: #fff; }

/* Permission / notification cards */
.pw-card { background: #f9fafb; border: 1px solid #e5e7eb; border-radius: 8px; padding: 12px 14px; display: flex; flex-direction: column; gap: 12px; }
.pw-check { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; }
.pw-check input { margin-top: 2px; }
.pw-check span { display: flex; flex-direction: column; gap: 2px; }
.pw-check strong { font-size: 13px; font-weight: 600; color: #111827; }
.pw-check small { font-size: 11px; color: #6b7280; }

.pw-reject-none { font-size: 12px; color: #6b7280; padding: 6px 0; }

.pw-remove {
    margin-top: 4px; padding: 9px 12px; border-radius: 7px;
    background: #fef2f2; border: 1px solid #fecaca; color: #b91c1c;
    font-size: 13px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; justify-content: center;
}
.pw-remove:hover:not(:disabled) { background: #fee2e2; }
.pw-remove:disabled { opacity: .5; cursor: not-allowed; }

/* Applies-To card under the canvas */
.pw-applies { margin-top: 4px; }

@media (max-width: 900px) {
    .pw-body { flex-direction: column; }
    .pw-panel { width: 100%; margin-left: 0; margin-top: 12px; }
}
