/* ===== LR WEB Help Module ===== */

.help-layout {
    display: flex;
    gap: 0;
    min-height: 600px;
    background: var(--card, #1a1d24);
    border-radius: var(--br-20, 20px);
    border: 1px solid var(--transparent-5-w, rgba(255,255,255,.05));
    overflow: hidden;
}

/* ===== Sidebar ===== */
.help-sidebar {
    width: 280px;
    min-width: 280px;
    background: rgba(0,0,0,.15);
    border-right: 1px solid var(--transparent-5-w, rgba(255,255,255,.05));
    display: flex;
    flex-direction: column;
}

.help-sidebar-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px 20px 16px;
    font-size: 15px;
    font-weight: 700;
    color: var(--text-default, #fff);
    border-bottom: 1px solid var(--transparent-5-w, rgba(255,255,255,.05));
}

.help-sidebar-header svg {
    color: var(--button, #5b7dff);
    flex-shrink: 0;
}

.help-sidebar-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}

.help-sidebar-list::-webkit-scrollbar { width: 4px; }
.help-sidebar-list::-webkit-scrollbar-track { background: transparent; }
.help-sidebar-list::-webkit-scrollbar-thumb { background: rgba(255,255,255,.08); border-radius: 4px; }

/* Category */
.help-category {
    margin: 2px 8px;
}

.help-category-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 10px;
    cursor: pointer;
    transition: background .2s;
    color: var(--text-custom, #8b8fa3);
    font-size: 13px;
    font-weight: 600;
    user-select: none;
}

.help-category-header:hover {
    background: rgba(255,255,255,.04);
    color: var(--text-default, #fff);
}

.help-category.active > .help-category-header {
    background: rgba(91,125,255,.1);
    color: var(--button, #5b7dff);
}

/* Category chevron */
.help-category-chevron {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform .25s ease;
    color: inherit;
    opacity: .5;
}

.help-category.open > .help-category-header .help-category-chevron {
    transform: rotate(90deg);
}

.help-category-icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    color: inherit;
    opacity: .7;
}

.help-category-icon svg {
    width: 16px;
    height: 16px;
}

.help-category-title {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Category actions */
.help-category-actions {
    display: flex;
    gap: 2px;
    opacity: 0;
    transition: opacity .2s;
}

.help-category-header:hover .help-category-actions {
    opacity: 1;
}

.help-category-actions button {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: var(--text-custom, #8b8fa3);
    border-radius: 6px;
    cursor: pointer;
    transition: all .2s;
    padding: 0;
}

.help-category-actions button svg {
    width: 14px;
    height: 14px;
}

.help-category-actions button:hover {
    background: rgba(255,255,255,.08);
    color: var(--text-default, #fff);
}

.help-category-actions button.btn-delete:hover {
    background: rgba(231,76,60,.12);
    color: #e74c3c;
}

/* Items in category — smooth expand/collapse */
.help-category-items {
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    transition: max-height .3s ease, opacity .25s ease, padding .25s ease;
    padding-left: 0;
}

.help-category.open > .help-category-items {
    max-height: 1000px;
    opacity: 1;
    padding-left: 20px;
}

/* Item link */
.help-item-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all .2s;
    color: var(--text-custom, #8b8fa3);
    font-size: 12px;
}

/* Folder icon before item */
.help-item-link .help-item-folder {
    flex-shrink: 0;
    width: 14px;
    height: 14px;
    color: inherit;
    opacity: .5;
    transition: opacity .2s, color .2s;
}

.help-item-link:hover {
    background: rgba(255,255,255,.03);
    color: var(--text-default, #fff);
}

.help-item-link:hover .help-item-folder {
    opacity: .8;
}

.help-item-link.active {
    background: rgba(91,125,255,.08);
    color: var(--button, #5b7dff);
}

.help-item-link.active .help-item-folder {
    opacity: 1;
    color: var(--button, #5b7dff);
}

/* Sidebar footer */
.help-sidebar-footer {
    padding: 12px;
    border-top: 1px solid var(--transparent-5-w, rgba(255,255,255,.05));
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.help-btn-add {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    height: 36px;
    background: rgba(255,255,255,.03);
    border: 1px dashed rgba(255,255,255,.1);
    border-radius: 10px;
    color: var(--text-custom, #8b8fa3);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all .2s;
    font-family: inherit;
}

.help-btn-add:hover {
    background: rgba(91,125,255,.08);
    border-color: rgba(91,125,255,.3);
    color: var(#5b7dff, #5b7dff);
}

/* ===== Content ===== */
.help-content {
    flex: 1;
    overflow-y: auto;
    padding: 28px 32px;
}

.help-content::-webkit-scrollbar { width: 6px; }
.help-content::-webkit-scrollbar-track { background: transparent; }
.help-content::-webkit-scrollbar-thumb { background: rgba(255,255,255,.08); border-radius: 6px; }

.help-content-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 400px;
    gap: 16px;
    color: var(--text-custom, #8b8fa3);
    font-size: 14px;
}

/* Item content */
.help-item-view {
    animation: helpFadeIn .3s ease;
}

@keyframes helpFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.help-item-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--transparent-5-w, rgba(255,255,255,.05));
}

.help-item-title {
    font-family: var(--font-family-1, "Unbounded"), sans-serif;
    font-size: var(--font-size-xxl, 22px);
    font-weight: var(--font-weight-7, 700);
    color: var(--text-default, #fff);
    margin: 0;
}

.help-item-actions {
    display: flex;
    gap: 8px;
}

.help-item-actions button {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,.04);
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 10px;
    color: var(--text-custom, #8b8fa3);
    cursor: pointer;
    transition: all .2s;
    padding: 0;
}

.help-item-actions button svg {
    width: 16px;
    height: 16px;
}

.help-item-actions button:hover {
    background: rgba(255,255,255,.08);
    color: var(--text-default, #fff);
}

.help-item-actions button.btn-delete:hover {
    background: rgba(231,76,60,.12);
    border-color: rgba(231,76,60,.25);
    color: #e74c3c;
}

/* Content body */
.help-item-body {
    color: var(--text-custom, #8b8fa3);
    font-size: 14px;
    line-height: 1.7;
}

.help-item-body * {
    color: inherit;
}

.help-item-body h1,
.help-item-body h2,
.help-item-body h3 {
    color: var(--text-default, #fff);
    margin: 20px 0 12px;
}

.help-item-body h1 { font-size: 20px; }
.help-item-body h2 { font-size: 17px; }
.help-item-body h3 { font-size: 15px; }

.help-item-body p { margin: 0 0 12px; }

.help-item-body ul,
.help-item-body ol {
    margin: 0 0 12px;
    padding-left: 24px;
    color: var(--text-custom, #8b8fa3);
}

.help-item-body li {
    margin-bottom: 6px;
    list-style-type: disc;
    color: var(--text-custom, #8b8fa3);
}

.help-item-body ol li {
    list-style-type: decimal;
}

.help-item-body a {
    color: var(--text-default, #5b7dff);
    text-decoration: none;
    font-weight: 600;
}

.help-item-body a:hover { text-decoration: underline; }

.help-item-body code {
    background: rgba(255,255,255,.06);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 13px;
    color: #e74c3c;
}

.help-item-body blockquote {
    border-left: 3px solid var(--button, #5b7dff);
    padding: 12px 16px;
    margin: 16px 0;
    background: rgba(91,125,255,.05);
    border-radius: 0 8px 8px 0;
    color: var(--text-default, #fff);
}

.help-item-body img {
    max-width: 100%;
    border-radius: 8px;
}

.help-item-body strong { color: var(--text-default, #fff); font-weight: 600; }

.help-item-body hr {
    border: none;
    height: 1px;
    background: var(--transparent-5-w, rgba(255,255,255,.06));
    margin: 20px 0;
}

.help-item-body .highlight {
    background: rgba(231,76,60,.08);
    border: 1px solid rgba(231,76,60,.2);
    border-radius: 10px;
    padding: 14px 18px;
    margin: 16px 0;
    color: #e74c3c;
    font-weight: 500;
}

/* Updated timestamp */
.help-item-updated {
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--transparent-5-w, rgba(255,255,255,.05));
    font-size: 12px;
    color: rgba(255,255,255,.3);
    display: flex;
    align-items: center;
    gap: 6px;
}

.help-item-updated svg { width: 14px; height: 14px; }

/* ===== Modal forms ===== */
.help-modal-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 4px 0;
}

.help-modal-form label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-custom, #8b8fa3);
    text-transform: uppercase;
    letter-spacing: .8px;
    margin-bottom: 4px;
    display: block;
}

.help-modal-form input[type="text"],
.help-modal-form select {
    height: 42px;
    background: var(--input-form, #252830);
    border: 1.5px solid transparent;
    border-radius: var(--br-10, 10px);
    padding: 0 14px;
    color: var(--text-default, #fff);
    font-size: 14px;
    font-family: inherit;
    outline: none;
    width: 100%;
    box-sizing: border-box;
    transition: border-color .2s, box-shadow .2s;
}

.help-modal-form input[type="text"]:focus,
.help-modal-form select:focus {
    border-color: var(--button, #5b7dff);
    box-shadow: 0 0 0 3px rgba(91,125,255,.15);
}

.help-modal-form select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238b8fa3' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

.help-modal-form select option {
    background: var(--card, #1a1d24);
    color: var(--text-default, #fff);
}

/* Rich text editor */
.help-editor-wrap {
    border: 1.5px solid transparent;
    border-radius: var(--br-10, 10px);
    overflow: hidden;
    transition: border-color .2s, box-shadow .2s;
}

.help-editor-wrap:focus-within {
    border-color: var(--button, #5b7dff);
    box-shadow: 0 0 0 3px rgba(91,125,255,.15);
}

.help-editor-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    padding: 8px;
    background: rgba(0,0,0,.2);
    border-bottom: 1px solid rgba(255,255,255,.05);
}

.help-editor-toolbar button {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    border-radius: 6px;
    color: var(--text-custom, #8b8fa3);
    cursor: pointer;
    transition: all .15s;
    font-size: 13px;
    font-weight: 700;
    font-family: inherit;
    padding: 0;
}

.help-editor-toolbar button svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    display: block;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.help-editor-toolbar button:hover {
    background: rgba(255,255,255,.08);
    color: var(--text-default, #fff);
}

.help-editor-toolbar button.help-heading-btn {
    font-size: 11px;
    font-weight: 800;
    letter-spacing: -.3px;
    min-width: 28px;
}

.help-editor-toolbar button.active {
    background: rgba(91,125,255,.15);
    color: var(--button, #5b7dff);
}

.help-editor-toolbar .separator {
    width: 1px;
    height: 24px;
    background: rgba(255,255,255,.08);
    margin: 4px 4px;
}

/* Editor content styles */
.help-editor-area pre {
    background: rgba(255,255,255,.06);
    padding: 12px 16px;
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    color: #e74c3c;
    margin: 12px 0;
    overflow-x: auto;
}

.help-editor-area table {
    border-collapse: collapse;
    width: 100%;
    margin: 16px 0;
}

.help-editor-area table th,
.help-editor-area table td {
    padding: 8px 12px;
    border: 1px solid rgba(255,255,255,.1);
    text-align: left;
}

.help-editor-area table th {
    background: rgba(255,255,255,.04);
    font-weight: 600;
    color: var(--text-default, #fff);
}

.help-editor-area table td {
    color: var(--text-custom, #8b8fa3);
}

.help-editor-area img {
    max-width: 100%;
    border-radius: 8px;
    margin: 8px 0;
}

.help-editor-area ul,
.help-editor-area ol {
    margin: 8px 0;
    padding-left: 24px;
    color: var(--text-default, #fff);
}

.help-editor-area li {
    margin-bottom: 4px;
    line-height: 1.6;
}

.help-editor-area ul li {
    list-style-type: disc;
}

.help-editor-area ol li {
    list-style-type: decimal;
}

.help-editor-area blockquote {
    border-left: 3px solid var(--button, #5b7dff);
    padding: 10px 16px;
    margin: 12px 0;
    background: rgba(91,125,255,.05);
    border-radius: 0 8px 8px 0;
    color: var(--text-default, #fff);
}

.help-editor-area h1 {
    font-size: 20px;
    color: var(--text-default, #fff);
    margin: 16px 0 8px;
}

.help-editor-area h2 {
    font-size: 17px;
    color: var(--text-default, #fff);
    margin: 14px 0 6px;
}

.help-editor-area h3 {
    font-size: 15px;
    color: var(--text-default, #fff);
    margin: 12px 0 6px;
}

.help-editor-area a {
    color: var(--button, #5b7dff);
}

.help-editor-area hr {
    border: none;
    height: 1px;
    background: rgba(255,255,255,.1);
    margin: 16px 0;
}

.help-editor-area {
    min-height: 250px;
    max-height: 400px;
    overflow-y: auto;
    padding: 14px 16px;
    background: var(--input-form, #252830);
    color: var(--text-default, #fff);
    font-size: 14px;
    line-height: 1.6;
    outline: none;
}

.help-editor-area:empty::before {
    content: attr(data-placeholder);
    color: rgba(139,143,163,.4);
}

.help-editor-area::-webkit-scrollbar { width: 4px; }
.help-editor-area::-webkit-scrollbar-track { background: transparent; }
.help-editor-area::-webkit-scrollbar-thumb { background: rgba(255,255,255,.08); border-radius: 4px; }

/* Modal buttons */
.help-modal-btns {
    display: flex;
    gap: 10px;
    margin-top: 8px;
}

.help-modal-btns button {
    flex: 1;
    height: 42px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all .2s;
    border: none;
    font-family: inherit;
}

.help-modal-btns .save {
    background: var(--button, #5b7dff);
    color: #fff;
}

.help-modal-btns .save:hover {
    background: var(--button-hover, #4a6ae6);
    box-shadow: 0 4px 16px rgba(91,125,255,.3);
}

.help-modal-btns .cancel {
    background: rgba(255,255,255,.05);
    color: var(--text-custom, #8b8fa3);
    border: 1px solid rgba(255,255,255,.08);
}

.help-modal-btns .cancel:hover {
    background: rgba(255,255,255,.08);
    color: var(--text-default, #fff);
}

/* Modal max-height */
#helpModal .popup_modal_content {
    max-height: 85vh;
    overflow-y: auto;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .help-layout { flex-direction: column; }
    .help-sidebar {
        width: 100%;
        min-width: 100%;
        max-height: 300px;
        border-right: none;
        border-bottom: 1px solid var(--transparent-5-w, rgba(255,255,255,.05));
    }
    .help-content { padding: 20px 16px; }
}
