/* Contextual help drawer — right-side slide-in panel.
   See app/static/js/shared/help-drawer.js and partials/help_drawer.html. */

.help-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    z-index: 3000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.help-overlay.active {
    opacity: 1;
    visibility: visible;
}

.help-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 460px;
    min-width: 320px;
    max-width: 95vw;
    background: var(--color-bg-white, #fff);
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.18);
    z-index: 3001;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.25s ease;
    padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 0;
}

.help-drawer.active {
    transform: translateX(0);
}

/* While dragging the resize handle, suppress the slide transition so the
   panel tracks the cursor instantly. */
.help-drawer.resizing {
    transition: none;
    user-select: none;
}

/* Drag handle on the left edge to resize the drawer width. */
.help-drawer-resizer {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: 8px;
    cursor: ew-resize;
    z-index: 3002;
    background: transparent;
}

.help-drawer-resizer:hover,
.help-drawer.resizing .help-drawer-resizer {
    background: linear-gradient(to right, var(--color-primary, #1a73e8), transparent);
    opacity: 0.5;
}

.help-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--color-gray-200, #e8eaed);
    flex-shrink: 0;
}

.help-drawer-header h2 {
    margin: 0;
    font-size: 17px;
    font-weight: 600;
    color: var(--color-text-primary, #202124);
    display: flex;
    align-items: center;
    gap: 8px;
}

.help-drawer-close {
    border: none;
    background: transparent;
    font-size: 17px;
    color: var(--color-text-secondary, #5f6368);
    cursor: pointer;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    transition: background 0.15s ease;
}

.help-drawer-close:hover {
    background: var(--color-gray-100, #f1f3f4);
}

.help-drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px 32px;
}

.help-state {
    text-align: center;
    color: var(--color-text-secondary, #5f6368);
    padding: 48px 16px;
    font-size: 14px;
}

.help-state i {
    font-size: 30px;
    display: block;
    margin-bottom: 12px;
    color: var(--color-gray-400, #bdc1c6);
}

/* Topic accordion cards */
.help-topic {
    border: 1px solid var(--color-gray-200, #e8eaed);
    border-radius: 10px;
    margin-bottom: 12px;
    overflow: hidden;
}

.help-topic-head {
    width: 100%;
    text-align: left;
    border: none;
    background: var(--color-gray-50, #f8f9fa);
    padding: 14px 16px;
    cursor: pointer;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.help-topic-head:hover {
    background: var(--color-gray-100, #f1f3f4);
}

.help-topic-titles {
    flex: 1;
    min-width: 0;
}

.help-topic-title {
    font-weight: 600;
    color: var(--color-text-primary, #202124);
    font-size: 16px;
}

.help-topic-excerpt {
    color: var(--color-text-secondary, #5f6368);
    font-size: 13px;
    margin-top: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.help-topic-caret {
    color: var(--color-text-muted, #80868b);
    transition: transform 0.2s ease;
    margin-top: 3px;
}

.help-topic.open .help-topic-caret {
    transform: rotate(90deg);
}

.help-topic-body {
    display: none;
    padding: 4px 16px 18px;
    color: var(--color-text-primary, #202124);
    font-size: 15px;
    line-height: 1.75;
}

.help-topic.open .help-topic-body {
    display: block;
}

/* Keep rendered SimpleCMS content readable at a comfortable size. */
.help-topic-body p,
.help-topic-body li,
.help-topic-body td,
.help-topic-body th {
    font-size: 15px;
    line-height: 1.75;
}

.help-topic-body h1 { font-size: 22px; }
.help-topic-body h2 { font-size: 19px; }
.help-topic-body h3 { font-size: 16px; }
.help-topic-body h1,
.help-topic-body h2,
.help-topic-body h3 {
    line-height: 1.35;
    margin: 16px 0 8px;
}

/* Rendered SimpleCMS HTML content */
.help-topic-body img {
    max-width: 100%;
    height: auto;
    border-radius: 6px;
}

.help-topic-body a {
    color: var(--color-primary, #1a73e8);
}

.help-topic-body table {
    border-collapse: collapse;
    width: 100%;
    margin: 8px 0;
}

.help-topic-body th,
.help-topic-body td {
    border: 1px solid var(--color-gray-200, #e8eaed);
    padding: 6px 8px;
    text-align: left;
}

.help-topic-body pre {
    background: var(--color-gray-50, #f8f9fa);
    padding: 10px 12px;
    border-radius: 6px;
    overflow-x: auto;
}

.help-topic-loading {
    color: var(--color-text-secondary, #5f6368);
    font-size: 13px;
    padding: 8px 0;
}
