/* auction-process.css v2 — 경매 진행 프로세스 플로우차트 페이지
 * 모든 색상은 bn-tokens.css 토큰 사용 (daylight/vault 자동 대응)
 */

.ap-container { max-width: 980px; margin: 0 auto; padding: 24px 20px 80px; }

/* ===== 히어로 ===== */
.ap-hero { text-align: center; margin: 30px 0 22px; }
.ap-hero .ap-label { color: var(--bn-primary); font-weight: 600; font-size: 0.85em; letter-spacing: 0.1em; margin-bottom: 12px; }
.ap-hero h1 { font-size: 2.2em; font-weight: 800; color: var(--bn-ink); margin-bottom: 16px; }
.ap-hero p { font-size: 1.05em; color: var(--bn-muted); max-width: 660px; margin: 0 auto; line-height: 1.6; }

/* ===== 매도자 유형 탭 ===== */
.ap-tabs { display: flex; justify-content: center; gap: 0; margin: 0 0 24px; }
.ap-tab { padding: 10px 26px; font-size: 0.95em; font-weight: 700; cursor: pointer; background: var(--bn-surface); color: var(--bn-muted); border: 1px solid var(--bn-line); transition: all 0.2s; }
.ap-tab:first-child { border-radius: 10px 0 0 10px; }
.ap-tab:last-child { border-radius: 0 10px 10px 0; border-left: none; }
.ap-tab.is-active { background: var(--bn-primary); color: var(--bn-primaryFg); border-color: var(--bn-primary); }
.ap-tab:not(.is-active):hover { color: var(--bn-ink); }

/* variant 전환 */
[data-seller-type="general"] .ap-v[data-v="dealer"] { display: none; }
[data-seller-type="dealer"] .ap-v[data-v="general"] { display: none; }
.ap-v { transition: opacity 0.25s; }
.ap-container.ap-switching .ap-v { opacity: 0; }

/* ===== 자동재생 요약도 ===== */
.ap-summary { background: var(--bn-bg); border: 1px solid var(--bn-line); border-radius: 16px; box-shadow: var(--bn-shadow); padding: 18px 14px 8px; margin-bottom: 18px; }
.ap-summary-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
#ap-svg { display: block; width: 100%; min-width: 620px; height: auto; }

.ap-sm-trunk { fill: none; stroke: color-mix(in srgb, var(--bn-primary) 30%, transparent); stroke-width: 4; stroke-linecap: round; }
.ap-sm-trunk.is-lit { stroke: var(--bn-primary); }

.ap-sm-branch { fill: none; stroke-width: 2.5; stroke-dasharray: 6 5; stroke-linecap: round; opacity: 0.55; }
.ap-sm-branch--risk { stroke: var(--bn-up); }
.ap-sm-branch--alt { stroke: var(--bn-warn); }
.ap-sm-branch.is-lit { opacity: 1; }

.ap-sm-chip rect { fill: var(--bn-surface); stroke-width: 1.5; }
.ap-sm-chip text { font-size: 13px; font-weight: 700; }
.ap-sm-chip--risk rect { stroke: var(--bn-up); }
.ap-sm-chip--risk text { fill: var(--bn-up); }
.ap-sm-chip--alt rect { stroke: var(--bn-warn); }
.ap-sm-chip--alt text { fill: var(--bn-warn); }
.ap-sm-chip { opacity: 0.65; transition: opacity 0.2s; }
.ap-sm-chip.is-lit { opacity: 1; }
.ap-sm-chip.is-pulse { animation: ap-chip-pulse 0.9s ease-in-out 2; }
@keyframes ap-chip-pulse { 50% { opacity: 0.25; } }

.ap-sm-node circle, .ap-sm-node rect { fill: var(--bn-bg); stroke-width: 3.5; transition: fill 0.25s; }
.ap-sm-node--st circle { stroke: var(--bn-primary); }
.ap-sm-node--dc rect { stroke: var(--bn-warn); }
.ap-sm-node text { font-size: 14px; font-weight: 700; fill: var(--bn-muted); transition: fill 0.25s; }
.ap-sm-node.is-lit circle { fill: var(--bn-primary); }
.ap-sm-node.is-lit rect { fill: var(--bn-warn); }
.ap-sm-node.is-lit text { fill: var(--bn-ink); }
.ap-sm-node.is-current text { fill: var(--bn-primary); }

.ap-sm-marker { fill: var(--bn-primary); stroke: var(--bn-bg); stroke-width: 2.5; filter: drop-shadow(0 0 6px color-mix(in srgb, var(--bn-primary) 70%, transparent)); }

.ap-summary-bar { display: flex; align-items: center; gap: 12px; padding: 8px 6px 6px; border-top: 1px solid var(--bn-lineSoft); margin-top: 8px; }
.ap-caption { flex: 1; margin: 0; font-size: 0.95em; font-weight: 600; color: var(--bn-ink2); line-height: 1.5; min-height: 1.5em; transition: opacity 0.2s; }
.ap-caption.is-fading { opacity: 0; }
.ap-play { width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--bn-line); background: var(--bn-surface); color: var(--bn-ink2); font-size: 0.95em; cursor: pointer; flex-shrink: 0; }
.ap-play:hover { border-color: var(--bn-primary); color: var(--bn-primary); }

/* ===== 범례 ===== */
.ap-legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px 18px; margin: 0 0 36px; font-size: 0.85em; color: var(--bn-muted); }
.ap-legend span { display: inline-flex; align-items: center; gap: 6px; }
.ap-legend i { width: 18px; height: 0; border-top: 3px solid; border-radius: 2px; }
.ap-legend .ap-lg-main i { border-color: var(--bn-primary); }
.ap-legend .ap-lg-dc i { border-color: var(--bn-warn); }
.ap-legend .ap-lg-risk i { border-color: var(--bn-up); border-top-style: dashed; }
.ap-legend .ap-lg-alt i { border-color: var(--bn-warn); border-top-style: dashed; }

/* ===== 상세 노선도 ===== */
.ap-flow { position: relative; }
.ap-line-track { position: absolute; left: 27px; top: 20px; bottom: 20px; width: 4px; border-radius: 2px; background: color-mix(in srgb, var(--bn-primary) 22%, transparent); }
.ap-line-fill { width: 100%; height: 0; border-radius: 2px; background: var(--bn-primary); transition: height 0.15s linear; }

.ap-line { position: relative; list-style: none; margin: 0; padding: 8px 0; }

/* 페이즈 헤더 */
.ap-phase { position: relative; padding: 6px 0 18px 64px; }
.ap-phase:not(:first-child) { padding-top: 22px; }
.ap-phase-label { display: inline-block; font-family: 'JetBrains Mono', monospace; font-size: 0.72em; font-weight: 600; letter-spacing: 0.08em; color: var(--bn-primaryFg); background: var(--bn-primary); padding: 3px 10px; border-radius: 999px; margin-right: 8px; vertical-align: middle; }
.ap-phase-title { font-size: 1.05em; font-weight: 800; color: var(--bn-ink); vertical-align: middle; }

/* 역 (station) */
.ap-station { position: relative; padding: 0 0 30px 64px; opacity: 0.55; transition: opacity 0.4s; }
.ap-station.is-passed { opacity: 1; }
.ap-node { position: absolute; left: 18px; top: 8px; width: 22px; height: 22px; border-radius: 50%; background: var(--bn-bg); border: 4px solid color-mix(in srgb, var(--bn-primary) 45%, var(--bn-line)); box-sizing: border-box; z-index: 1; transition: background 0.3s, border-color 0.3s; }
.ap-station.is-passed .ap-node { border-color: var(--bn-primary); }
.ap-station:has(.ap-details[open]) .ap-node { background: var(--bn-primary); border-color: var(--bn-primary); animation: ap-pulse 2s ease-in-out infinite; }

@keyframes ap-pulse {
    0%   { box-shadow: 0 0 0 0 color-mix(in srgb, var(--bn-primary) 50%, transparent); }
    70%  { box-shadow: 0 0 0 9px color-mix(in srgb, var(--bn-primary) 0%, transparent); }
    100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--bn-primary) 0%, transparent); }
}

/* 단계 카드 (아코디언) */
.ap-details { background: var(--bn-bg); border: 1px solid var(--bn-line); border-radius: 14px; box-shadow: var(--bn-shadow); transition: border-color 0.2s; }
.ap-details:hover { border-color: var(--bn-primary); }
.ap-details[open] { border-color: var(--bn-primary); }

.ap-summary-row { display: block; padding: 16px 20px; cursor: pointer; list-style: none; position: relative; }
.ap-summary-row::-webkit-details-marker { display: none; }
.ap-summary-row::after { content: ''; position: absolute; right: 20px; top: 24px; width: 9px; height: 9px; border-right: 2px solid var(--bn-mutedSoft); border-bottom: 2px solid var(--bn-mutedSoft); transform: rotate(45deg); transition: transform 0.2s; }
.ap-details[open] .ap-summary-row::after { transform: rotate(225deg); top: 28px; }

.ap-head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; padding-right: 28px; }
.ap-head .ap-v { display: inline-flex; align-items: center; gap: 8px 12px; flex-wrap: wrap; }
[data-seller-type="general"] .ap-head .ap-v[data-v="dealer"],
[data-seller-type="dealer"] .ap-head .ap-v[data-v="general"] { display: none; }
.ap-no { font-family: 'JetBrains Mono', monospace; font-size: 0.8em; font-weight: 600; color: var(--bn-primary); }
.ap-title { font-size: 1.15em; font-weight: 800; color: var(--bn-ink); }
.ap-deadline { display: inline-block; padding: 3px 10px; border-radius: 999px; background: var(--bn-primaryWk); color: var(--bn-primary); font-size: 0.78em; font-weight: 600; white-space: nowrap; }
.ap-brief { display: block; margin-top: 6px; font-size: 0.9em; color: var(--bn-muted); line-height: 1.5; padding-right: 28px; }

/* 상세 패널 */
.ap-panel { padding: 4px 20px 20px; border-top: 1px solid var(--bn-lineSoft); }
.ap-panel h3 { font-size: 0.95em; font-weight: 700; color: var(--bn-ink2); margin: 18px 0 10px; padding-left: 10px; border-left: 3px solid var(--bn-primary); }
.ap-panel p { font-size: 0.92em; color: var(--bn-ink2); line-height: 1.7; margin: 0 0 4px; }

.ap-checklist { list-style: none; margin: 0; padding: 0; }
.ap-checklist li { position: relative; padding: 4px 0 4px 26px; font-size: 0.92em; color: var(--bn-ink2); line-height: 1.6; }
.ap-checklist li::before { content: ''; position: absolute; left: 4px; top: 11px; width: 10px; height: 5px; border-left: 2px solid var(--bn-ok); border-bottom: 2px solid var(--bn-ok); transform: rotate(-45deg); }

.ap-cases { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.ap-case { background: var(--bn-surface); border: 1px solid var(--bn-lineSoft); border-radius: 10px; padding: 12px 14px; }
.ap-case b { display: block; font-size: 0.9em; color: var(--bn-ink); margin-bottom: 4px; }
.ap-case span { font-size: 0.88em; color: var(--bn-muted); line-height: 1.6; }

.ap-tips { list-style: none; margin: 0; padding: 0; }
.ap-tips li { position: relative; padding: 4px 0 4px 24px; font-size: 0.9em; color: var(--bn-muted); line-height: 1.6; }
.ap-tips li::before { content: '※'; position: absolute; left: 2px; top: 4px; color: var(--bn-warn); font-size: 0.9em; }

/* ===== 판단 노드 (decision) ===== */
.ap-decision { position: relative; padding: 4px 0 30px 64px; opacity: 0.55; transition: opacity 0.4s; }
.ap-decision.is-passed { opacity: 1; }
.ap-diamond { position: absolute; left: 17px; top: 10px; width: 24px; height: 24px; background: var(--bn-bg); border: 3.5px solid var(--bn-warn); border-radius: 4px; transform: rotate(45deg); box-sizing: border-box; z-index: 1; transition: background 0.3s; }
.ap-decision.is-passed .ap-diamond { background: var(--bn-warn); }

.ap-dec-body { background: color-mix(in srgb, var(--bn-warn) 6%, var(--bn-surface)); border: 1px dashed color-mix(in srgb, var(--bn-warn) 45%, var(--bn-line)); border-radius: 14px; padding: 14px 18px; }
.ap-q { font-size: 1.02em; font-weight: 800; color: var(--bn-ink); margin-bottom: 10px; }
.ap-q::before { content: 'Q'; display: inline-block; width: 20px; height: 20px; line-height: 20px; text-align: center; border-radius: 6px; background: var(--bn-warn); color: var(--bn-primaryFg); font-size: 0.75em; font-weight: 800; margin-right: 8px; vertical-align: 2px; }
.ap-yes { font-size: 0.92em; font-weight: 700; color: var(--bn-ok); margin-bottom: 10px; }
.ap-yes-mark { display: inline-block; font-weight: 800; }
.ap-yes-down { display: inline-block; font-weight: 800; }

.ap-alts { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.ap-alt { position: relative; background: var(--bn-bg); border: 1px solid var(--bn-lineSoft); border-left-width: 4px; border-radius: 10px; padding: 10px 14px 10px 36px; }
.ap-alt::before { content: '→'; position: absolute; left: 12px; top: 9px; font-weight: 800; font-size: 1.05em; }
.ap-alt--risk { border-left-color: var(--bn-up); }
.ap-alt--risk::before, .ap-alt--risk .ap-alt-label { color: var(--bn-up); }
.ap-alt--ok { border-left-color: var(--bn-ok); }
.ap-alt--ok::before, .ap-alt--ok .ap-alt-label { color: var(--bn-ok); }
.ap-alt--alt { border-left-color: var(--bn-warn); }
.ap-alt--alt::before, .ap-alt--alt .ap-alt-label { color: var(--bn-warn); }
.ap-alt-label { display: block; font-size: 0.9em; font-weight: 700; margin-bottom: 3px; }
.ap-alt-desc { display: block; font-size: 0.85em; color: var(--bn-muted); line-height: 1.55; }

/* 클릭 가능한 분기 → 해당 단계로 이동 */
.ap-alt[data-target] { cursor: pointer; transition: border-color 0.15s, box-shadow 0.15s; }
.ap-alt[data-target]:hover, .ap-alt[data-target]:focus-visible { box-shadow: var(--bn-shadow); }
.ap-alt--risk[data-target]:hover, .ap-alt--risk[data-target]:focus-visible { border-color: var(--bn-up); }
.ap-alt--ok[data-target]:hover, .ap-alt--ok[data-target]:focus-visible { border-color: var(--bn-ok); }
.ap-alt--alt[data-target]:hover, .ap-alt--alt[data-target]:focus-visible { border-color: var(--bn-warn); }
.ap-alt-go { display: block; margin-top: 6px; font-size: 0.8em; font-weight: 600; color: var(--bn-primary); }
.ap-alt[data-target]:hover .ap-alt-go { text-decoration: underline; }

/* 종착 */
.ap-terminal { position: relative; margin-top: 4px; padding-left: 64px; }
.ap-terminal span { display: inline-block; font-size: 0.9em; font-weight: 600; color: var(--bn-muted); padding: 6px 0; }

/* ===== 반응형 ===== */
@media (max-width: 768px) {
    .ap-container { padding: 20px 16px 60px; }
    .ap-line-track { left: 19px; }
    .ap-node { left: 11px; width: 18px; height: 18px; border-width: 3px; }
    .ap-diamond { left: 10px; width: 20px; height: 20px; border-width: 3px; }
    .ap-station, .ap-decision, .ap-phase { padding-left: 46px; }
    .ap-terminal { padding-left: 46px; }
}

@media (max-width: 640px) {
    .ap-hero h1 { font-size: 1.55em; }
    .ap-hero p { font-size: 0.95em; }
    .ap-tab { padding: 9px 18px; font-size: 0.88em; }
    .ap-title { font-size: 1.05em; }
    .ap-summary { padding: 12px 8px 6px; }
    .ap-caption { font-size: 0.85em; }
    .ap-summary-row { padding: 14px 14px; }
    .ap-summary-row::after { right: 14px; }
    .ap-panel { padding: 4px 14px 16px; }
    .ap-brief { font-size: 0.85em; }
    .ap-deadline { font-size: 0.72em; }
    .ap-dec-body { padding: 12px 14px; }
    .ap-alt-desc { font-size: 0.82em; }
}

/* ===== 모션 최소화 ===== */
@media (prefers-reduced-motion: reduce) {
    .ap-line-fill { transition: none; }
    .ap-station, .ap-decision, .ap-v, .ap-caption { transition: none; }
    .ap-station:has(.ap-details[open]) .ap-node { animation: none; }
    .ap-sm-chip.is-pulse { animation: none; }
}
