/* Build Guide — Layout (3-col desktop, single-col mobile) */

/* Print cover: screen-only hidden, shown only via @media print in _print.css */
.guide-print-cover {
    display: none;
}

.guide-page {
    --guide-nav-width: 220px;
    --guide-rail-width: 280px;
    --guide-topbar-h: 56px;
    --guide-progressbar-h: 32px;
    --guide-bottom-nav-h: 72px;
    /* Site header is sticky at top:0 with height 60px; guide bars stack below it */
    --site-header-h: 60px;
    min-height: 100vh;
    background: var(--bg-primary);
    color: var(--text-primary);
}

/* Admin bar adds 32px on top of site header */
.admin-bar .guide-page { --site-header-h: 92px; }

.guide-topbar {
    position: sticky;
    top: var(--site-header-h);
    z-index: 999;
    height: var(--guide-topbar-h);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 clamp(12px, 3vw, 24px);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    gap: 12px;
}

.guide-topbar__left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.guide-topbar__back {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm, 6px);
    color: var(--text-secondary);
    flex-shrink: 0;
    transition: background 0.15s, color 0.15s;
}

.guide-topbar__back:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.guide-topbar__title {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.guide-topbar__build-name {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 220px;
}

.guide-topbar__price {
    font-size: 0.75rem;
    color: var(--text-secondary);
    padding-left: 10px;
    border-left: 1px solid var(--border);
}

.guide-topbar__actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.guide-progress-bar {
    position: sticky;
    top: calc(var(--site-header-h) + var(--guide-topbar-h));
    z-index: 998;
    height: var(--guide-progressbar-h);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    display: flex;
    align-items: center;
    padding: 0 clamp(12px, 3vw, 24px);
    overflow: hidden;
}

.guide-progress-bar__fill {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    background: color-mix(in srgb, var(--accent) 30%, transparent);
    transition: width 0.4s ease;
    pointer-events: none;
}

.guide-progress-bar__label {
    position: relative;
    font-size: 0.75rem;
    color: var(--text-secondary);
    z-index: 1;
}

.guide-layout {
    display: grid;
    grid-template-columns: var(--guide-nav-width) 1fr var(--guide-rail-width);
    gap: 0;
    min-height: calc(100vh - var(--guide-topbar-h) - var(--guide-progressbar-h));
    max-width: 1400px;
    margin: 0 auto;
}

/* Left rail: step navigator */
.guide-stepnav {
    border-right: 1px solid var(--border);
    padding: 16px 0;
    position: sticky;
    top: calc(var(--site-header-h) + var(--guide-topbar-h) + var(--guide-progressbar-h));
    max-height: calc(100vh - var(--site-header-h) - var(--guide-topbar-h) - var(--guide-progressbar-h));
    overflow-y: auto;
    scrollbar-width: thin;
}

.guide-stepnav__section-label {
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    padding: 12px 16px 4px;
}

.guide-stepnav__item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    width: 100%;
    padding: 6px 16px;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    text-align: left;
    background: none;
    border: none;
    cursor: pointer;
    border-left: 3px solid transparent;
    transition: background 0.12s, color 0.12s, border-color 0.12s;
    line-height: 1.3;
}

.guide-stepnav__item:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.guide-stepnav__item--active {
    border-left-color: var(--accent);
    color: var(--accent);
    background: color-mix(in srgb, var(--accent) 8%, transparent);
    font-weight: 500;
    box-shadow: inset 3px 0 8px color-mix(in srgb, var(--accent) 12%, transparent);
    transition: background 0.2s, color 0.2s, box-shadow 0.2s;
}

/* Done checkmark on the right side of the nav item */
.guide-stepnav__item--done {
    position: relative;
}

.guide-stepnav__item--done::after {
    content: '✓';
    font-size: 0.6875rem;
    font-weight: 700;
    color: var(--success, #22c55e);
    margin-left: auto;
    padding-left: 6px;
}

.guide-stepnav__item--done .guide-stepnav__num {
    color: var(--success, #22c55e);
    font-weight: 700;
}

.guide-stepnav__item--done .guide-stepnav__title {
    opacity: 0.6;
}

.guide-stepnav__item--unchecked .guide-stepnav__num::after {
    content: '·';
    color: var(--text-muted);
}

.guide-stepnav__num {
    font-size: 0.6875rem;
    font-weight: 700;
    color: var(--text-muted);
    min-width: 18px;
    padding-top: 1px;
}

.guide-stepnav__title {
    line-height: 1.35;
}

/* Main content */
.guide-main {
    padding: clamp(16px, 3vw, 32px);
    border-right: 1px solid var(--border);
    padding-bottom: calc(var(--guide-bottom-nav-h) + 32px);
}

/* Mobile accordion toggle: hidden on desktop */
.guide-rail__toggle-header {
    display: none;
}

/* Right rail */
.guide-rail {
    padding: 16px;
    position: sticky;
    top: calc(var(--site-header-h) + var(--guide-topbar-h) + var(--guide-progressbar-h));
    max-height: calc(100vh - var(--site-header-h) - var(--guide-topbar-h) - var(--guide-progressbar-h));
    overflow-y: auto;
    scrollbar-width: thin;
}

.guide-rail__title {
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin: 0 0 12px;
}

/* Rail header — always visible above the x-show inner block */
.guide-rail__heading {
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin: 0 0 12px;
}

/* Empty state when no parts for this step */
.guide-rail__empty {
    font-size: 0.8125rem;
    color: var(--text-muted);
    font-style: italic;
    padding: 8px 0;
}

.guide-rail__part {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    padding: 8px 10px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm, 6px);
    border: 1px solid var(--border);
    transition: border-color 0.15s;
}

.guide-rail__part:hover {
    border-color: color-mix(in srgb, var(--accent) 30%, transparent);
}

.guide-rail__part-thumb {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm, 6px);
    flex-shrink: 0;
    background: var(--bg-tertiary);
}

.guide-rail__part-thumb--img {
    object-fit: contain;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    padding: 3px;
}

.guide-rail__part-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.guide-rail__part-name {
    font-size: 0.8125rem;
    color: var(--text-primary);
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.guide-rail__part-price {
    font-size: 0.75rem;
    color: var(--accent);
    font-weight: 600;
}

/* ===== STEP-LIST OVERLAY ===== */

.guide-steplist {
    position: fixed;
    inset: 0;
    z-index: 1100;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(2px);
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

@media (min-width: 640px) {
    .guide-steplist {
        align-items: center;
    }
}

.guide-steplist__panel {
    position: relative;
    width: 100%;
    max-height: 82vh;
    background: var(--bg-secondary);
    border-radius: 16px 16px 0 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 -4px 32px rgba(0, 0, 0, 0.45);
}

@media (min-width: 640px) {
    .guide-steplist__panel {
        max-width: 400px;
        max-height: 74vh;
        border-radius: 16px;
        box-shadow: 0 8px 40px rgba(0, 0, 0, 0.45);
    }
}

.guide-steplist__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 20px 14px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    position: relative;
}

.guide-steplist__header::before {
    content: '';
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 36px;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
}

@media (min-width: 640px) {
    .guide-steplist__header::before {
        display: none;
    }
}

.guide-steplist__header-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.guide-steplist__header-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 50%;
    color: var(--text-secondary);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    flex-shrink: 0;
}

.guide-steplist__header-close:hover {
    background: var(--bg-primary);
    color: var(--text-primary);
}

.guide-steplist__body {
    overflow-y: auto;
    flex: 1;
    padding: 8px 0 16px;
    scrollbar-width: thin;
}

.guide-steplist__section {
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: var(--text-muted);
    padding: 14px 20px 4px;
}

.guide-steplist__item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 9px 20px;
    background: none;
    border: none;
    border-left: 3px solid transparent;
    cursor: pointer;
    text-align: left;
    transition: background 0.1s, border-color 0.1s;
}

.guide-steplist__item:hover {
    background: var(--bg-tertiary);
}

.guide-steplist__item--active {
    background: color-mix(in srgb, var(--accent) 8%, transparent);
    border-left-color: var(--accent);
}

.guide-steplist__num {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6875rem;
    font-weight: 700;
    background: var(--bg-tertiary);
    color: var(--text-muted);
    flex-shrink: 0;
    transition: background 0.12s, color 0.12s;
    position: relative;
}

.guide-steplist__item--active .guide-steplist__num {
    background: var(--accent);
    color: #fff;
}

.guide-steplist__item--done .guide-steplist__num {
    background: color-mix(in srgb, var(--success, #22c55e) 15%, transparent);
    color: var(--success, #22c55e);
    font-size: 0;
}

.guide-steplist__item--done .guide-steplist__num::after {
    content: '✓';
    font-size: 0.75rem;
    color: var(--success, #22c55e);
    position: absolute;
}

.guide-steplist__label {
    flex: 1;
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.35;
}

.guide-steplist__item--active .guide-steplist__label {
    font-weight: 600;
    color: var(--accent);
}

.guide-steplist__item--done .guide-steplist__label {
    opacity: 0.6;
}

/* Overlay transitions */
.guide-steplist-enter {
    transition: opacity 0.2s ease;
}
.guide-steplist-enter-start { opacity: 0; }
.guide-steplist-enter-end   { opacity: 1; }
.guide-steplist-leave {
    transition: opacity 0.15s ease;
}
.guide-steplist-leave-start { opacity: 1; }
.guide-steplist-leave-end   { opacity: 0; }
