/* Shared in-app help rendering (drawer, knowledge base). */

.help-rendered-content {
    font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
    line-height: 1.65;
    color: #2c3e50;
    font-size: 0.95rem;
}

.help-rendered-content.rtl {
    text-align: right;
}

.help-rendered-content h1,
.help-rendered-content h2,
.help-rendered-content h3,
.help-rendered-content h4 {
    color: #1a2a6c;
    margin-top: 1.5rem;
    margin-bottom: 0.65rem;
    line-height: 1.35;
}

.help-rendered-content h1 {
    font-size: 1.35rem;
    border-bottom: 2px solid #e8eef7;
    padding-bottom: 0.45rem;
}

.help-rendered-content h2 {
    font-size: 1.12rem;
    border-bottom: 1px solid #eef2f7;
    padding-bottom: 0.35rem;
}

.help-rendered-content h2 i,
.help-rendered-content h3 i {
    margin-inline-end: 0.45rem;
    color: #4a5f8c;
}

.help-rendered-content p {
    margin: 0.65rem 0;
}

.help-rendered-content strong {
    font-weight: 600;
    color: #1a2a3a;
}

.help-rendered-content ul,
.help-rendered-content ol {
    margin: 0.5rem 0 0.85rem;
    padding-inline-start: 1.35rem;
}

.help-rendered-content li {
    margin: 0.3rem 0;
}

.help-rendered-content hr {
    border: none;
    border-top: 1px solid #e8eef7;
    margin: 1.25rem 0;
}

/* Tables */
.help-rendered-content table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin: 1rem 0 1.25rem;
    font-size: 0.88rem;
    border: 1px solid #d8e2ef;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(26, 42, 108, 0.06);
    background: #fff;
}

.help-rendered-content thead th {
    background: linear-gradient(180deg, #f0f4fb 0%, #e8eef7 100%);
    color: #1a2a6c;
    font-weight: 600;
    text-align: start;
    padding: 10px 14px;
    border-bottom: 2px solid #c5d4ea;
}

.help-rendered-content tbody td {
    padding: 9px 14px;
    border-bottom: 1px solid #edf1f7;
    vertical-align: top;
}

.help-rendered-content tbody tr:last-child td {
    border-bottom: none;
}

.help-rendered-content tbody tr:nth-child(even) td {
    background: #f9fbfd;
}

.help-rendered-content tbody tr:hover td {
    background: #f3f7fc;
}

.help-rendered-content th,
.help-rendered-content td {
    border-inline-end: 1px solid #edf1f7;
}

.help-rendered-content th:last-child,
.help-rendered-content td:last-child {
    border-inline-end: none;
}

/* Golden-standard callouts */
.help-rendered-content .help-info {
    background: linear-gradient(135deg, #eef6ff 0%, #f5f9ff 100%);
    border: 1px solid #c5daf5;
    border-inline-start: 4px solid #1a73e8;
    padding: 1rem 1.2rem;
    border-radius: 0 10px 10px 0;
    margin: 1rem 0 1.25rem;
}

.help-rendered-content .help-warning {
    background: #fff8e6;
    border: 1px solid #ffe0a3;
    border-inline-start: 4px solid #f59e0b;
    padding: 0.85rem 1.1rem;
    border-radius: 0 10px 10px 0;
    margin: 1rem 0;
    color: #5c4a1f;
}

.help-rendered-content .help-step-container {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    margin: 0.85rem 0 1rem;
    padding: 0.75rem 0.9rem;
    background: #fafbfd;
    border: 1px solid #e8eef7;
    border-radius: 10px;
}

.help-rendered-content .help-step {
    flex: 0 0 28px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #1a2a6c;
    color: #fff;
    font-size: 0.8rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-top: 2px;
}

.help-rendered-content .help-step-content {
    flex: 1;
    min-width: 0;
}

.help-rendered-content .help-step-content p {
    margin-top: 0;
}

/* Mermaid */
.help-rendered-content .help-mermaid-shell {
    position: relative;
    margin: 1rem 0 1.25rem;
}

.help-rendered-content .help-mermaid-expand-btn {
    position: absolute;
    top: 8px;
    inset-inline-end: 8px;
    z-index: 2;
    width: 32px;
    height: 32px;
    border: 1px solid #c5d4ea;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.95);
    color: #1a2a6c;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(26, 42, 108, 0.12);
    transition: background 0.15s, border-color 0.15s, transform 0.15s;
}

.help-rendered-content .help-mermaid-expand-btn:hover {
    background: #fff;
    border-color: #1a2a6c;
    transform: scale(1.05);
}

.help-rendered-content .help-mermaid-diagram-host {
    background: #fafbfd;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 2.25rem 1rem 1rem;
    overflow-x: auto;
    text-align: center;
}

.help-rendered-content .help-mermaid-diagram {
    margin: 0;
    padding: 0;
    background: transparent;
    border: none;
}

.help-rendered-content .help-mermaid-diagram-host svg {
    max-width: 100%;
    height: auto;
}

/* Full-app Mermaid expand modal (above help drawer) */
body.help-mermaid-modal-open {
    overflow: hidden;
}

.help-mermaid-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 10150;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    animation: help-mermaid-fade-in 0.2s ease;
}

.help-mermaid-modal {
    width: min(1200px, 96vw);
    max-height: min(900px, 92vh);
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 24px 64px rgba(15, 23, 42, 0.28);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: help-mermaid-scale-in 0.25s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.help-mermaid-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 18px;
    border-bottom: 1px solid #e8eef7;
    background: linear-gradient(180deg, #f8fafc 0%, #fff 100%);
    flex-shrink: 0;
}

.help-mermaid-modal-title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 600;
    color: #1a2a6c;
}

.help-mermaid-modal-close {
    width: 36px;
    height: 36px;
    border: 1px solid #d8e2ef;
    border-radius: 8px;
    background: #fff;
    color: #4a5f8c;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: background 0.15s, border-color 0.15s;
}

.help-mermaid-modal-close:hover {
    background: #f5f7fa;
    border-color: #1a2a6c;
    color: #1a2a6c;
}

.help-mermaid-modal-body {
    flex: 1;
    overflow: auto;
    padding: 28px 32px 32px;
    text-align: center;
    background: #fafbfd;
}

.help-mermaid-modal-body pre.mermaid {
    margin: 0;
    padding: 0;
    background: transparent;
    border: none;
    display: inline-block;
    min-width: min(100%, 720px);
}

.help-mermaid-modal-body svg {
    max-width: min(1100px, 100%);
    width: auto !important;
    height: auto !important;
}

@keyframes help-mermaid-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes help-mermaid-scale-in {
    from { opacity: 0; transform: scale(0.96); }
    to { opacity: 1; transform: scale(1); }
}

.help-rendered-content pre:not(.mermaid) {
    background: #f4f6f9;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    overflow-x: auto;
    font-size: 0.85rem;
}

.help-rendered-content code {
    background: #f0f3f8;
    padding: 0.1rem 0.35rem;
    border-radius: 4px;
    font-size: 0.88em;
}

.help-rendered-content pre code {
    background: transparent;
    padding: 0;
}

.help-rendered-content a.help-topic-link {
    color: #1a2a6c;
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.help-rendered-content a.help-topic-link:hover {
    color: #0f1a4a;
}

.help-rendered-content mark.help-find-highlight {
    background: #fff59d;
    color: inherit;
    padding: 0 0.1em;
    border-radius: 2px;
}

.help-rendered-content mark.help-find-highlight-active {
    background: #ffb74d;
    outline: 2px solid #f57c00;
}
