/* Video header — title + trash icon row */
.sop-video-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.sop-video-header .sop-video-title {
    margin: 0;
    flex: 1;
}
.sop-remove-video-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #bbb;
    padding: 0.25rem;
    line-height: 0;
    flex-shrink: 0;
    transition: color 0.15s;
}
.sop-remove-video-btn:hover {
    color: #c0392b;
}

/* Remove-mode highlight (admin viewing ?remove_video=N) */
.sop-video-highlighted {
    outline: 3px solid #e74c3c;
    border-radius: 4px;
    padding: 0.5rem;
}
.sop-remove-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    background: #fdf0ee;
    border: 1px solid #e74c3c;
    border-radius: 4px;
    padding: 0.6rem 0.875rem;
    margin-bottom: 0.75rem;
    font-size: 0.9rem;
}
.sop-remove-bar-btn {
    background: #e74c3c;
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 0.35rem 0.875rem;
    cursor: pointer;
    font-size: 0.875rem;
    white-space: nowrap;
}
.sop-remove-bar-btn:hover:not(:disabled) { background: #c0392b; }
.sop-remove-bar-btn:disabled { opacity: 0.6; cursor: default; }
.sop-remove-bar-status { font-size: 0.875rem; color: #555; }

/* Removal confirmation modal */
.sop-remove-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 9999;
    align-items: center;
    justify-content: center;
}
.sop-remove-modal.is-open {
    display: flex;
}
.sop-remove-modal-box {
    background: #fff;
    border-radius: 6px;
    padding: 2rem;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
}
.sop-remove-modal-box p {
    margin: 0 0 0.5rem;
}
.sop-remove-modal-video-name {
    font-weight: 600;
}
.sop-remove-modal-status {
    font-size: 0.875rem;
    color: #555;
    min-height: 1.2em;
}
.sop-remove-modal-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    margin-top: 1.5rem;
}
.sop-remove-modal-actions button {
    padding: 0.5rem 1.25rem;
    border-radius: 4px;
    border: 1px solid #ccc;
    cursor: pointer;
    font-size: 0.9rem;
}
#sop-remove-confirm {
    background: #c0392b;
    color: #fff;
    border-color: #c0392b;
}
#sop-remove-confirm:hover:not(:disabled) {
    background: #a93226;
}
#sop-remove-confirm:disabled {
    opacity: 0.6;
    cursor: default;
}
#sop-remove-cancel:hover {
    background: #e8e8e8;
}

/* Section header — title + trash icon row */
.sop-info-section-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.sop-info-section-header .sop-info-section-title {
    margin: 0;
    flex: 1;
}
.sop-remove-section-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #bbb;
    padding: 0.25rem;
    line-height: 0;
    flex-shrink: 0;
    transition: color 0.15s;
}
.sop-remove-section-btn:hover {
    color: #c0392b;
}

/* Edit (pencil) icon button — same look as trash, blue hover */
.sop-edit-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #bbb;
    padding: 0.25rem;
    line-height: 0;
    flex-shrink: 0;
    transition: color 0.15s;
}
.sop-edit-btn:hover {
    color: #2980b9;
}
/* Push pencil (and trailing trash) to the far right when there is no title */
.sop-info-section-header .sop-edit-btn {
    margin-left: auto;
}

/* Remove-mode highlight (admin viewing ?remove_section=N) */
.sop-info-section-highlighted {
    outline: 3px solid #e74c3c;
    border-radius: 4px;
    padding: 0.5rem;
}

/* Link button inserted where a YouTube embed was removed from section content */
.sop-video-ref-link {
    display: inline-block;
    padding: 0.375rem 0.875rem;
    background: #f0f4f8;
    border: 1px solid #c8d4e0;
    border-radius: 4px;
    font-size: 0.875rem;
    font-weight: 500;
    color: #1e3a5f;
    text-decoration: none;
}
.sop-video-ref-link:hover {
    background: #dce8f5;
    border-color: #a8bdd4;
    color: #1e3a5f;
    text-decoration: none;
}

/* Breadcrumb */
.sop-breadcrumb {
    font-size: 0.825rem;
    color: #999;
    margin-bottom: 1rem;
}
.sop-breadcrumb-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0;
}
.sop-breadcrumb-item {
    display: flex;
    align-items: center;
}
.sop-breadcrumb-item + .sop-breadcrumb-item::before {
    content: "\005C";   /* backslash */
    margin: 0 0.45rem;
    color: #ccc;
    font-weight: 400;
}
.sop-breadcrumb-item a {
    color: #666;
    text-decoration: none;
}
.sop-breadcrumb-item a:hover {
    color: #1a5a9a;
    text-decoration: underline;
}
.sop-breadcrumb-current span {
    color: #aaa;
}

/* Timestamps — uniform size and weight regardless of parent element (p or h4) */
a.sop-timestamp {
    font-size: 0.75rem;
    font-weight: normal;
    font-style: normal;
    vertical-align: middle;
    line-height: 1;
}

/* Table of Contents */
.sop-toc {
    font-size: 0.875rem;
    line-height: 1.5;
}
.sop-toc-title {
    font-weight: 600;
    margin: 0 0 0.5rem;
}
.sop-toc ul {
    list-style: none;
    margin: 0;
    padding: 0;
}
.sop-toc li {
    margin-bottom: 0.2rem;
}
.sop-toc a {
    text-decoration: none;
    color: inherit;
    display: block;
}
.sop-toc a:hover,
.sop-toc a.is-active {
    color: #0073aa;
}
.sop-toc .sop-toc-h2 { padding-left: 0; }
.sop-toc .sop-toc-h3 { padding-left: 1rem; }
.sop-toc .sop-toc-h4 { padding-left: 2rem; }
.sop-toc .sop-toc-h5 { padding-left: 3rem; }
.sop-toc .sop-toc-h6 { padding-left: 4rem; }

/* Edit / propose-edit modal */
.sop-edit-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 10000;
    align-items: center;
    justify-content: center;
}
.sop-edit-modal.is-open {
    display: flex;
}
.sop-edit-modal-box {
    background: #fff;
    border-radius: 6px;
    padding: 1.5rem 2rem 2rem;
    width: min(780px, 96vw);
    max-height: 92vh;
    overflow-y: auto;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.sop-edit-modal-header h4 {
    margin: 0;
    font-size: 1.05rem;
}
/* Formatting toolbar */
.sop-edit-toolbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.2rem;
    padding: 0.4rem 0.5rem;
    background: #f0f2f5;
    border: 1px solid #ccc;
    border-bottom: none;
    border-radius: 4px 4px 0 0;
}
.sop-tb-btn {
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 3px;
    padding: 0.2rem 0.55rem;
    cursor: pointer;
    font-size: 0.825rem;
    line-height: 1.4;
    color: #333;
    min-width: 2rem;
    text-align: center;
}
.sop-tb-btn:hover {
    background: #e0e7ef;
    border-color: #aaa;
}
.sop-tb-sep {
    display: inline-block;
    width: 1px;
    height: 1.2em;
    background: #ccc;
    margin: 0 0.2rem;
    align-self: center;
}

.sop-edit-content {
    border: 1px solid #ccc;
    border-radius: 0 0 4px 4px;
    padding: 0.75rem 1rem;
    min-height: 220px;
    max-height: 50vh;
    overflow-y: auto;
    font-size: 0.9rem;
    line-height: 1.6;
    outline: none;
    background: #fafafa;
}
.sop-edit-content:focus {
    border-color: #2980b9;
    background: #fff;
}
/* Guest name field (shown to logged-out users in removal/edit modals) */
.sop-guest-name-wrap {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    font-size: 0.875rem;
}
.sop-guest-name-input {
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 0.4rem 0.6rem;
    font-size: 0.9rem;
    width: 100%;
    box-sizing: border-box;
}
.sop-guest-name-input:focus {
    outline: none;
    border-color: #2980b9;
}

.sop-edit-modal-status {
    font-size: 0.875rem;
    color: #555;
    min-height: 1.2em;
}
.sop-edit-modal-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
}
.sop-edit-modal-actions button {
    padding: 0.5rem 1.25rem;
    border-radius: 4px;
    border: 1px solid #ccc;
    cursor: pointer;
    font-size: 0.9rem;
}
#sop-edit-submit {
    background: #2980b9;
    color: #fff;
    border-color: #2980b9;
}
#sop-edit-submit:hover:not(:disabled) { background: #2471a3; }
#sop-edit-submit:disabled { opacity: 0.6; cursor: default; }
#sop-edit-cancel { border: none; }
#sop-edit-cancel:hover { background: #e8e8e8; }

/* Approve bar — shown to admins above the item when ?sop_edit_type=…&sop_edit_row=… */
.sop-edit-approve-bar {
    background: #eaf4fb;
    border: 1px solid #aed6f1;
    border-radius: 4px;
    padding: 0.75rem 1rem;
    margin-bottom: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}
.sop-edit-approve-meta {
    font-size: 0.875rem;
    color: #555;
}
.sop-edit-approve-preview {
    border: 1px solid #d0e8f8;
    border-radius: 4px;
    padding: 0.6rem 0.875rem;
    background: #fff;
    font-size: 0.875rem;
    max-height: 300px;
    overflow-y: auto;
}
.sop-edit-approve-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.sop-edit-approve-btn {
    background: #27ae60;
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 0.4rem 1rem;
    cursor: pointer;
    font-size: 0.875rem;
}
.sop-edit-approve-btn:hover:not(:disabled) { background: #229954; }
.sop-edit-approve-btn:disabled { opacity: 0.6; cursor: default; }
.sop-edit-discard-btn {
    background: #f5f5f5;
    color: #333;
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 0.4rem 1rem;
    cursor: pointer;
    font-size: 0.875rem;
}
.sop-edit-discard-btn:hover:not(:disabled) { background: #e8e8e8; }
.sop-edit-discard-btn:disabled { opacity: 0.6; cursor: default; }
.sop-edit-approve-status {
    font-size: 0.875rem;
    color: #555;
}

/* Dynamic SOP nav menu — sub-category expand indicators */
.sop-nav-category.menu-item-has-children > a::after {
    content: " \25BE"; /* ▾ */
    font-size: 0.75em;
    opacity: 0.6;
    margin-left: 0.25em;
}

/* ── SOP archive / search layout (taxonomy, search, uncategorized pages) ────── */
.sop-archive-wrap {
    display: flex;
    gap: 2.5rem;
    align-items: flex-start;
    padding: 2rem 0 3rem;
}
.sop-cat-sidebar {
    width: 280px;
    flex-shrink: 0;
    position: sticky;
    top: 2rem;
    max-height: calc(100vh - 4rem);
    overflow-y: auto;
}
.sop-cat-sidebar-heading {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #999;
    margin: 0 0 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #e8e8e8;
}
.sop-cat-nav-list { list-style: none; margin: 0; padding: 0; }
.sop-cat-nav-item { margin: 0; padding: 0; }
.sop-cat-nav-row { display: flex; align-items: center; gap: 0; }
.sop-cat-toggle {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    color: #aaa;
    border-radius: 3px;
    transition: color 0.15s, background 0.15s;
}
.sop-cat-toggle:hover { color: #555; background: #f0f0f0; }
.sop-cat-chevron {
    display: block;
    width: 0;
    height: 0;
    border-top: 4px solid transparent;
    border-bottom: 4px solid transparent;
    border-left: 6px solid currentColor;
    transition: transform 0.2s ease;
}
.sop-cat-toggle[aria-expanded="true"] .sop-cat-chevron { transform: rotate(90deg); }
.sop-cat-nav-row > a {
    flex: 1;
    display: block;
    padding: 0.28rem 0.4rem 0.28rem 0.2rem;
    font-size: 0.84rem;
    color: #555;
    text-decoration: none;
    border-radius: 3px;
    line-height: 1.4;
    transition: background 0.1s, color 0.1s;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.sop-cat-nav-row > a:hover { background: #f0f4f8; color: #1a1a1a; }
.sop-cat-nav-item.is-active > .sop-cat-nav-row > a { background: #e6eef8; color: #1a5a9a; font-weight: 600; }
.sop-cat-nav-item.is-ancestor > .sop-cat-nav-row > a { color: #333; font-weight: 500; }
.sop-cat-nav-item:not(.has-children) > .sop-cat-nav-row { padding-left: 24px; }
.sop-cat-children {
    padding-left: 0.6rem;
    border-left: 2px solid #ececec;
    margin: 0.1rem 0 0.2rem 0.75rem;
}
.sop-cat-children[hidden] { display: none; }
.sop-cat-nav-sop { display: flex; align-items: baseline; gap: 0.35rem; padding: 0.22rem 0.4rem 0.22rem 0; }
.sop-cat-nav-sop::before { content: "\2022"; font-size: 0.6rem; color: #ccc; flex-shrink: 0; line-height: 1.6; }
.sop-cat-nav-sop a { font-size: 0.8rem; color: #666; text-decoration: none; line-height: 1.4; transition: color 0.1s; }
.sop-cat-nav-sop a:hover { color: #1a5a9a; }
.sop-cat-nav-sop.is-current-sop a { color: #1a5a9a; font-weight: 600; }
.sop-archive-main { flex: 1; min-width: 0; }
.sop-archive-header { margin-bottom: 1.5rem; padding-bottom: 1rem; border-bottom: 2px solid #f0f0f0; }
.sop-archive-header h1 { margin: 0 0 0.3rem; font-size: 1.65rem; line-height: 1.2; }
.sop-archive-desc { color: #666; font-size: 0.9rem; margin: 0.3rem 0 0; }
.sop-archive-count { font-size: 0.78rem; color: #aaa; margin: 0.35rem 0 0; }
.sop-archive-list { display: flex; flex-direction: column; }
.sop-archive-item {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    padding: 1rem 0.5rem;
    border-bottom: 1px solid #efefef;
    text-decoration: none;
    color: inherit;
    border-radius: 4px;
    transition: background 0.1s;
}
.sop-archive-item:first-child { border-top: 1px solid #efefef; }
.sop-archive-item:hover { background: #f7f9fc; }
.sop-archive-thumb { width: 72px; height: 72px; flex-shrink: 0; object-fit: cover; border-radius: 5px; display: block; }
.sop-archive-body { flex: 1; min-width: 0; }
.sop-archive-title { font-size: 0.975rem; font-weight: 600; margin: 0 0 0.2rem; color: #1a1a1a; line-height: 1.35; transition: color 0.1s; }
.sop-archive-item:hover .sop-archive-title { color: #1a5a9a; }
.sop-archive-fulcrum { font-size: 0.76rem; color: #999; margin: 0 0 0.3rem; font-family: monospace; }
.sop-archive-summary { font-size: 0.85rem; color: #666; margin: 0; line-height: 1.5; }
.sop-archive-empty { padding: 2.5rem 0; color: #999; font-size: 0.95rem; }
.sop-archive-pagination { margin-top: 2rem; }
.sop-archive-pagination .nav-links { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.sop-archive-pagination .page-numbers {
    padding: 0.3rem 0.75rem;
    border: 1px solid #ddd;
    border-radius: 3px;
    text-decoration: none;
    font-size: 0.875rem;
    color: #555;
}
.sop-archive-pagination .page-numbers.current { background: #1a5a9a; color: #fff; border-color: #1a5a9a; }
.sop-archive-pagination .page-numbers:hover:not(.current) { background: #f0f4f8; }
@media (max-width: 768px) {
    .sop-archive-wrap { flex-direction: column; gap: 1.5rem; }
    .sop-cat-sidebar { width: 100%; position: static; max-height: none; }
}

/* ── [sop_create] form ─────────────────────────────────────────────────────── */
.sop-honeypot { display: none !important; }

.sop-create-wrap { max-width: 760px; margin: 0 auto; padding: 2rem 0 3rem; }

.sop-create-error {
    background: #fff5f5;
    border: 1px solid #feb2b2;
    border-radius: 6px;
    color: #c53030;
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.sop-create-form { display: flex; flex-direction: column; gap: 1.5rem; }

.sop-create-field { display: flex; flex-direction: column; gap: 0.4rem; }

.sop-create-field > label {
    font-weight: 600;
    font-size: 0.9rem;
    color: #222;
}

.sop-required { color: #c53030; margin-left: 2px; }
.sop-create-optional { font-weight: 400; color: #999; font-size: 0.85em; }

.sop-create-field input[type="text"],
.sop-create-field input[type="file"],
.sop-create-field select {
    width: 100%;
    padding: 0.55rem 0.75rem;
    border: 1px solid #d0d5dd;
    border-radius: 6px;
    font-size: 0.95rem;
    color: #111;
    background: #fff;
    transition: border-color 0.15s;
    box-sizing: border-box;
}
.sop-create-field input[type="text"]:focus,
.sop-create-field select:focus {
    outline: none;
    border-color: #1a5a9a;
    box-shadow: 0 0 0 3px rgba(26,90,154,0.12);
}
.sop-create-field input[type="file"] { padding: 0.4rem 0.5rem; cursor: pointer; }

.sop-field-error { border-color: #e53e3e !important; box-shadow: 0 0 0 3px rgba(229,62,62,0.15) !important; }

.sop-create-hint {
    font-size: 0.8rem;
    color: #888;
    margin-top: 0.2rem;
}

/* Categories checkboxes */
.sop-create-categories {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    border: 1px solid #d0d5dd;
    border-radius: 6px;
    padding: 0.75rem 1rem;
    max-height: 220px;
    overflow-y: auto;
    background: #fff;
}
.sop-create-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: #333;
    cursor: pointer;
    padding: 0.15rem 0;
}
.sop-create-check input[type="checkbox"] { margin: 0; cursor: pointer; }
.sop-create-check:hover { color: #1a5a9a; }

/* Section rows */
.sop-create-section-row {
    background: #f8f9fa;
    border: 1px solid #e0e4e8;
    border-radius: 8px;
    padding: 1rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}
.sop-create-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.sop-section-label {
    font-weight: 600;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #666;
}
.sop-create-section-title {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid #d0d5dd;
    border-radius: 6px;
    font-size: 0.95rem;
    color: #111;
    background: #fff;
    box-sizing: border-box;
}
.sop-create-section-title:focus {
    outline: none;
    border-color: #1a5a9a;
    box-shadow: 0 0 0 3px rgba(26,90,154,0.12);
}
.sop-create-section-textarea { width: 100%; box-sizing: border-box; }

.sop-create-remove-btn {
    background: none;
    border: none;
    color: #999;
    font-size: 0.8rem;
    cursor: pointer;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    transition: color 0.15s, background 0.15s;
}
.sop-create-remove-btn:hover { color: #c53030; background: #fff5f5; }

.sop-create-add-btn {
    background: none;
    border: 1px dashed #aab;
    color: #556;
    font-size: 0.88rem;
    cursor: pointer;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    transition: border-color 0.15s, color 0.15s, background 0.15s;
    margin-top: 0.25rem;
    width: 100%;
}
.sop-create-add-btn:hover { border-color: #1a5a9a; color: #1a5a9a; background: #f0f4f8; }

/* Submit */
.sop-create-actions { display: flex; justify-content: flex-end; padding-top: 0.5rem; border-top: 1px solid #eee; }

.sop-create-submit {
    background: #1a5a9a;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 0.65rem 2rem;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}
.sop-create-submit:hover { background: #154d85; }
.sop-create-submit:disabled { background: #93b8d8; cursor: not-allowed; }

@media (max-width: 600px) {
    .sop-create-actions { justify-content: stretch; }
    .sop-create-submit { width: 100%; }
}

/* ── [sop_create] title live-search dropdown ───────────────────────────────── */
.sop-title-suggestions {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #d0d5dd;
    border-radius: 8px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.1);
    z-index: 999;
    overflow: hidden;
}
.sop-suggestions-header {
    margin: 0;
    padding: 0.5rem 0.85rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #888;
    background: #f8f9fa;
    border-bottom: 1px solid #eee;
}
.sop-suggestion-item {
    display: block;
    padding: 0.55rem 0.85rem;
    font-size: 0.9rem;
    color: #222;
    text-decoration: none;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.1s;
    line-height: 1.4;
}
.sop-suggestion-item:last-child { border-bottom: none; }
.sop-suggestion-item:hover { background: #f0f4f8; color: #1a5a9a; }
.sop-suggestion-mark {
    background: #fff3cd;
    color: inherit;
    font-weight: 600;
    padding: 0 1px;
    border-radius: 2px;
}
