/* === ref_okof.css === */
/* OKOF page: tree view, mode toggle, type badges, list columns, quick codes, highlight, sticky */

/* ---- Sticky toolbar ---- */
.ref-okof-toolbar {
    position: sticky;
    top: 0;
    z-index: 20;
    background: var(--bg-main, var(--bg-surface));
    padding: 8px 0;
    margin-bottom: 12px;
}

/* ---- Expand/collapse all buttons ---- */
.ref-okof-actions {
    display: inline-flex;
    gap: 4px;
    flex-shrink: 0;
}
.ref-okof-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    font-size: 1.1rem;
    font-weight: 700;
    background: var(--bg-surface);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition);
}
.ref-okof-action-btn:hover {
    color: var(--primary);
    border-color: var(--glass-border-hover);
}

/* ---- Search highlight ---- */
.ref-okof-hl {
    background: rgba(var(--accent-rgb, 90, 82, 224), 0.15);
    color: inherit;
    border-radius: 2px;
    padding: 0 1px;
}

/* ---- Deep-link flash animation ---- */
.ref-okof-node--flash {
    animation: ref-okof-flash 1.5s ease-out;
}
@keyframes ref-okof-flash {
    0% { background: rgba(var(--accent-rgb, 90, 82, 224), 0.25); }
    100% { background: transparent; }
}

/* ---- List column widths ---- */
.ref-okof-table .ref-td-code {
    width: 120px;
    white-space: nowrap;
}
.ref-okof-table .ref-td-name {
    white-space: normal;
    word-break: break-word;
    min-width: 200px;
}
.ref-okof-table .ref-td-type {
    width: 100px;
    white-space: nowrap;
}
.ref-okof-table .ref-td-section {
    width: 70px;
    white-space: nowrap;
    text-align: center;
}
.ref-okof-table th[data-sort="section"] {
    width: 70px;
}
.ref-okof-table th[data-sort="type"] {
    width: 100px;
}

/* ---- Tree ---- */
.ref-okof-tree {
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    background: var(--bg-surface);
    max-height: 620px;
    overflow-y: auto;
    overflow-x: auto;
}
.ref-okof-node {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border-bottom: 1px solid var(--glass-border);
    font-size: 0.88rem;
    line-height: 1.4;
    transition: background var(--transition);
}
.ref-okof-node:hover {
    background: var(--bg-surface-hover);
}
.ref-okof-node--section {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-main);
    border-bottom: 2px solid var(--glass-border);
}
.ref-okof-node--group {
    font-weight: 600;
    color: var(--text-main);
}
.ref-okof-node--subclass {
    font-weight: 600;
    color: var(--text-main);
}
.ref-okof-node--match {
    background: rgba(var(--accent-rgb, 90, 82, 224), 0.08);
}
.ref-okof-node--match:hover {
    background: rgba(var(--accent-rgb, 90, 82, 224), 0.12);
}
.ref-okof-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    cursor: pointer;
    font-size: 0.65rem;
    color: var(--text-muted);
    transition: transform 0.2s ease, color var(--transition);
    user-select: none;
}
.ref-okof-toggle:hover {
    color: var(--primary);
}
.ref-okof-toggle--open {
    transform: rotate(90deg);
}
.ref-okof-toggle--none {
    cursor: default;
    opacity: 0;
}
.ref-okof-children {
    display: none;
}
.ref-okof-children--open {
    display: block;
}
.ref-okof-code {
    font-family: 'Manrope', monospace;
    font-weight: 600;
    color: var(--primary);
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    transition: color var(--transition);
}
.ref-okof-code:hover {
    text-decoration: underline;
}
.ref-okof-type {
    display: inline-block;
    padding: 1px 6px;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    border-radius: 3px;
    flex-shrink: 0;
    white-space: nowrap;
}
.ref-okof-type--section {
    background: var(--primary);
    color: #fff;
}
.ref-okof-type--group {
    background: rgba(var(--accent-rgb, 90, 82, 224), 0.12);
    color: var(--primary);
}
.ref-okof-type--subclass {
    background: rgba(var(--accent-rgb, 90, 82, 224), 0.08);
    color: var(--primary);
}
.ref-okof-type--class {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--glass-border);
}
.ref-okof-name {
    color: var(--text-main);
    min-width: 0;
    cursor: pointer;
    word-break: break-word;
}
.ref-okof-node--section .ref-okof-name {
    color: var(--text-main);
}

/* ---- Mobile ---- */
@media (max-width: 768px) {
    .ref-okof-tree {
        max-height: 480px;
        font-size: 0.82rem;
    }
    .ref-okof-node {
        padding: 5px 10px;
        gap: 6px;
    }
    .ref-okof-type {
        display: none;
    }
    .ref-okof-table .ref-td-type,
    .ref-okof-table th[data-sort="type"],
    .ref-okof-table .ref-td-section,
    .ref-okof-table th[data-sort="section"] {
        display: none;
    }
    .ref-okof-table .ref-td-name {
        min-width: 0;
    }
    .ref-okof-toolbar {
        flex-wrap: wrap;
    }
    .ref-okof-actions {
        order: 3;
    }
}
