/* ════════════════════════════════════════════════
   Builder Design Tokens
   ════════════════════════════════════════════════ */
:root {
    --serif: Georgia, 'Times New Roman', serif;
    --sans:  system-ui, -apple-system, sans-serif;

    --parchment:        #faf7f2;
    --parchment-dark:   #f0e9de;
    --parchment-border: #e4ddd2;

    --ink:       #1a1a2e;
    --ink-muted: #6b7280;

    --blue:    #2563eb;
    --blue-dk: #1d4ed8;
    --blue-bg: rgba(37, 99, 235, 0.07);

    --green:  #16a34a;
    --red:    #dc2626;
}

/* ════════════════════════════════════════════════
   Page layout
   ════════════════════════════════════════════════ */
.builder-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    max-width: 1200px;
    margin: auto;
    padding: 20px;
}

/* ── Page title ── */
.builder-container > h1 {
    font-family: var(--serif);
    font-size: 28px;
    font-weight: 700;
    color: var(--ink);
    text-align: center;
    width: 100%;
    margin: 0;
    padding-bottom: 8px;
    position: relative;
}

.builder-container > h1::after {
    content: '';
    display: block;
    width: 80px;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--blue), transparent);
    margin: 8px auto 0;
    border-radius: 2px;
}

/* ── Instruction bar ── */
.instruction-bar {
    width: 100%;
    background: var(--parchment);
    border: 1px solid var(--parchment-border);
    border-left: 4px solid var(--blue);
    padding: 14px 18px;
    border-radius: 0 8px 8px 0;
    font-family: var(--serif);
    font-size: 15px;
    color: #374151;
    line-height: 1.65;
    box-sizing: border-box;
}

.instruction-bar p {
    margin: 0;
}

/* Inline variant: favored-class checkbox row */
.instruction-bar.favored-class-sections {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
}

/* ════════════════════════════════════════════════
   Two-column main area
   ════════════════════════════════════════════════ */
.builder-main {
    display: flex;
    width: 100%;
    gap: 20px;
}

/* ── Left column: options list ── */
.options-list {
    width: 30%;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* ════════════════════════════════════════════════
   Options card  (the clickable list items on the left)
   ════════════════════════════════════════════════ */
.options-card {
    background: var(--parchment);
    border: 1px solid var(--parchment-border);
    border-left: 4px solid var(--blue);
    padding: 12px 14px;
    text-align: left;
    cursor: pointer;
    border-radius: 0 8px 8px 0;
    transition: background 0.15s, box-shadow 0.15s;
    font-family: var(--sans);
}

.options-card h3,
.options-card h4 {
    margin: 0;
    font-family: var(--serif);
    font-size: 15px;
    font-weight: 700;
    color: var(--ink);
}

.options-card p {
    margin: 3px 0 0;
    font-size: 12px;
    color: var(--ink-muted);
}

.options-card:hover {
    background: var(--parchment-dark);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.options-card.selected {
    background: var(--blue);
    border-left-color: var(--blue-dk);
    color: #fff;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

.options-card.selected h3,
.options-card.selected h4,
.options-card.selected p {
    color: #fff;
}

.options-card.disabled,
.options-card.chosen-missing {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Already-taken class badge (levelup mode) */
.options-card-already-taken {
    background: color-mix(in srgb, #6366f1 12%, var(--parchment));
    border-left-color: #6366f1;
}

/* ════════════════════════════════════════════════
   Chosen items panel (3rd column of builder-main)
   ════════════════════════════════════════════════ */
.chosen-panel {
    flex: 0 0 220px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow-y: auto;
    max-height: 580px;
}

@media (max-width: 900px) {
    .builder-main {
        flex-wrap: wrap;
    }
    .chosen-panel {
        flex: none;
        width: 100%;
        max-height: none;
        flex-direction: row;
        flex-wrap: wrap;
    }
}

/* ════════════════════════════════════════════════
   Right column: details panel
   ════════════════════════════════════════════════ */
.details-container {
    flex: 1;
    background: var(--parchment);
    border: 1px solid var(--parchment-border);
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
    overflow: visible;
}

/* ════════════════════════════════════════════════
   Navigation
   ════════════════════════════════════════════════ */
.builder-navigation {
    display: flex;
    justify-content: space-between;
    width: 100%;
    gap: 12px;
    margin-top: 4px;
}

.builder-navigation.builder-navigation-centered {
    justify-content: center;
    gap: 16px;
}

/* ════════════════════════════════════════════════
   Buttons
   ════════════════════════════════════════════════ */
button {
    padding: 10px 22px;
    border: none;
    background: var(--blue);
    color: #fff;
    font-family: var(--sans);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border-radius: 6px;
    transition: background 0.15s;
}

button:hover    { background: var(--blue-dk); }

button:disabled {
    background: #e5e7eb;
    color: #9ca3af;
    cursor: not-allowed;
}

/* Builder navigation buttons */
.builder-navigation button {
    min-width: 120px;
    padding: 10px 18px;
    border-radius: 999px;
    border: 1px solid transparent;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.builder-navigation button:first-child {
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    border-color: #d1d5db;
    color: #374151;
}

.builder-navigation button:first-child:hover {
    background: linear-gradient(180deg, #f9fafb 0%, #f3f4f6 100%);
    border-color: #9ca3af;
    color: #1f2937;
}

.builder-navigation button:last-child {
    background: linear-gradient(180deg, #3b82f6 0%, #2563eb 100%);
    border-color: #1d4ed8;
    color: #fff;
}

.builder-navigation button:last-child:hover {
    background: linear-gradient(180deg, #2563eb 0%, #1d4ed8 100%);
    border-color: #1e40af;
}

.builder-navigation button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.14);
}

.builder-navigation button:disabled,
.builder-navigation button[disabled],
.builder-navigation button.class-continue-blocked {
    background: #e5e7eb;
    border-color: #d1d5db;
    color: #9ca3af;
    box-shadow: none;
    transform: none;
    cursor: not-allowed;
}

/* Green "choose" action button */
.choose-button {
    background: var(--green);
    padding: 9px 18px;
    margin-top: 10px;
}

.choose-button:hover    { background: #15803d; }

.choose-button:disabled {
    background: #e5e7eb;
    color: #9ca3af;
}

/* ════════════════════════════════════════════════
   Search & filter bar
   ════════════════════════════════════════════════ */
.search-filter {
    width: 100%;
    display: flex;
    gap: 10px;
    margin-bottom: 14px;
    justify-content: center;
}

.search-filter input[type="text"],
.search-filter select {
    padding: 8px 12px;
    border: 1px solid var(--parchment-border);
    border-radius: 6px;
    background: var(--parchment);
    font-size: 14px;
    color: var(--ink);
    font-family: var(--sans);
    transition: border-color 0.15s;
}

.search-filter input[type="text"]:focus,
.search-filter select:focus {
    outline: none;
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

/* ════════════════════════════════════════════════
   Misc shared utilities
   ════════════════════════════════════════════════ */
.remove-missing {
    margin-left: 10px;
    color: var(--red);
    font-weight: 700;
    cursor: pointer;
}

/* Info tooltip (ⓘ circle) */
.info-tooltip {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--blue);
    color: #fff;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 13px;
    cursor: default;
    user-select: none;
}

.info-tooltip .tooltip-text {
    visibility: hidden;
    width: 230px;
    background: #1f2937;
    color: #fff;
    text-align: left;
    padding: 10px 13px;
    border-radius: 7px;
    font-size: 13px;
    line-height: 1.55;
    font-family: var(--sans);
    position: absolute;
    z-index: 10;
    top: -5px;
    left: 28px;
    opacity: 0;
    transition: opacity 0.2s;
}

.info-tooltip:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
}

/* ════════════════════════════════════════════════
   Builder vertical timeline (fixed right panel)
   ════════════════════════════════════════════════ */
.builder-timeline {
    position: fixed;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    background: var(--parchment);
    border: 1px solid var(--parchment-border);
    border-right: none;
    border-radius: 8px 0 0 8px;
    padding: 12px 10px 12px 14px;
    box-shadow: -2px 2px 12px rgba(0, 0, 0, 0.10);
    min-width: 140px;
    max-height: 80vh;
    overflow-y: auto;
    z-index: 100;
    font-family: var(--sans);
}

.builder-timeline-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--ink-muted);
    margin-bottom: 10px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--parchment-border);
}

.builder-timeline-steps {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.builder-timeline-step {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
}

.builder-timeline-step .step-dot {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 9px;
}

.builder-timeline-step.done .step-dot {
    background: var(--green);
    color: #fff;
}

.builder-timeline-step.pending .step-dot {
    background: #e5e7eb;
    color: #9ca3af;
}

.builder-timeline-step.done .step-label {
    color: var(--green);
    font-weight: 500;
}

.builder-timeline-step.pending .step-label {
    color: var(--ink-muted);
}

.builder-timeline-step.current .step-dot {
    background: #3b82f6;
    color: #fff;
    font-size: 11px;
}

.builder-timeline-step.current .step-label {
    color: #3b82f6;
    font-weight: 600;
}

/* Dark mode */
[data-theme="dark"] .builder-timeline {
    background: #1e1e2e;
    border-color: #45475a;
    box-shadow: -2px 2px 12px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .builder-timeline-title {
    color: #a6adc8;
    border-bottom-color: #45475a;
}

[data-theme="dark"] .builder-timeline-step.pending .step-dot {
    background: #313244;
    color: #6c7086;
}

[data-theme="dark"] .builder-timeline-step.pending .step-label {
    color: #6c7086;
}

[data-theme="dark"] .builder-timeline-step.current .step-dot {
    background: #60a5fa;
}

[data-theme="dark"] .builder-timeline-step.current .step-label {
    color: #60a5fa;
}
