/* Help Panel Styles */

.help-panel {
    display: flex;
    flex-direction: column;
    height: 100%;
    font-size: 13px;
}

.help-search {
    padding: 10px 15px;
    border-bottom: 1px solid rgba(0,0,0,0.1);
    flex-shrink: 0;
}

/* Presentazione del prodotto: banner fisso sotto la ricerca, sempre visibile */
.help-presentation-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 15px;
    border-bottom: 1px solid rgba(0,0,0,0.1);
    background-color: #f1f7ff;
    color: #0d6efd;
    font-weight: 600;
    text-decoration: none;
    flex-shrink: 0;
    transition: background-color 0.15s;
}

.help-presentation-link:hover {
    background-color: #e2eeff;
    color: #0a58ca;
    text-decoration: none;
}

.help-presentation-ext {
    margin-left: auto;
    opacity: 0.6;
    font-size: 11px;
}

.help-panels {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
}

.help-tree-panel {
    max-height: 200px;
    overflow-y: auto;
    border-bottom: 1px solid rgba(0,0,0,0.1);
    padding: 10px;
    flex-shrink: 0;
}

.help-content-panel {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
}

/* Tree Styles */
.help-tree {
    list-style: none;
    margin: 0;
    padding: 0;
}

.help-tree-item {
    margin: 2px 0;
}

.help-tree-node {
    display: flex;
    align-items: center;
    padding: 5px 8px;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.15s;
}

.help-tree-node:hover {
    background-color: rgba(0,123,255,0.1);
}

.help-tree-node.active {
    background-color: rgba(0,123,255,0.2);
    color: #007bff;
}

.help-tree-toggle {
    width: 16px;
    text-align: center;
    margin-right: 4px;
    color: #6c757d;
    font-size: 10px;
}

.help-tree-spacer {
    width: 16px;
    margin-right: 4px;
}

.help-tree-icon {
    margin-right: 6px;
    color: #6c757d;
    font-size: 12px;
}

.help-tree-title {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Content Styles */
.help-loading,
.help-no-results,
.help-welcome {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 150px;
    color: #6c757d;
    text-align: center;
}

.help-welcome i {
    opacity: 0.5;
}

.help-breadcrumb {
    font-size: 11px;
    color: #6c757d;
    margin-bottom: 10px;
}

.help-breadcrumb a {
    color: #6c757d;
    text-decoration: none;
}

.help-breadcrumb a:hover {
    color: #007bff;
}

/* Topic Header with Actions */
.help-topic-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
    gap: 10px;
}

.help-topic-title {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
    color: #333;
    flex: 1;
}

.help-topic-actions {
    flex-shrink: 0;
}

.help-topic-actions .btn-group {
    display: flex;
}

.help-topic-actions .btn {
    padding: 4px 8px;
    font-size: 12px;
}

.help-topic-summary {
    font-size: 13px;
    margin-bottom: 15px;
}

.help-content {
    line-height: 1.6;
}

.help-content h1, .help-content h2, .help-content h3,
.help-content h4, .help-content h5, .help-content h6 {
    margin-top: 1em;
    margin-bottom: 0.5em;
    font-weight: 600;
}

.help-content h1 { font-size: 1.5em; }
.help-content h2 { font-size: 1.3em; }
.help-content h3 { font-size: 1.15em; }
.help-content h4 { font-size: 1em; }

.help-content p {
    margin-bottom: 0.8em;
}

.help-content ul, .help-content ol {
    margin-bottom: 0.8em;
    padding-left: 1.5em;
}

.help-content li {
    margin-bottom: 0.3em;
}

.help-content code {
    background-color: #f4f4f4;
    padding: 2px 5px;
    border-radius: 3px;
    font-size: 0.9em;
}

.help-content pre {
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    padding: 10px;
    overflow-x: auto;
    font-size: 12px;
}

.help-content pre code {
    background: none;
    padding: 0;
}

.help-content table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1em;
    font-size: 12px;
}

.help-content th, .help-content td {
    border: 1px solid #dee2e6;
    padding: 6px 10px;
    text-align: left;
}

.help-content th {
    background-color: #f8f9fa;
    font-weight: 600;
}

.help-content blockquote {
    border-left: 3px solid #007bff;
    padding-left: 15px;
    margin: 0.8em 0;
    color: #6c757d;
}

/* Diagrams */
.help-diagrams {
    margin: 15px 0;
}

.help-diagram {
    margin-bottom: 15px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 4px;
}

.help-diagram-title {
    font-weight: 600;
    margin-bottom: 10px;
    font-size: 12px;
    color: #495057;
}

.mermaid-diagram svg {
    max-width: 100%;
    height: auto;
}

/* Children Links */
.help-children {
    border-top: 1px solid #dee2e6;
    padding-top: 15px;
}

.help-children h6 {
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 10px;
    color: #495057;
}

.help-children-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.help-child-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    background: #e9ecef;
    border-radius: 4px;
    color: #495057;
    text-decoration: none;
    font-size: 12px;
    transition: background-color 0.15s;
}

.help-child-link:hover {
    background: #dee2e6;
    color: #007bff;
    text-decoration: none;
}

/* Search Results */
.help-search-results {
    padding: 0;
}

.help-search-results h6 {
    font-size: 12px;
    color: #6c757d;
    margin-bottom: 10px;
}

.help-search-result {
    padding: 10px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    transition: background-color 0.15s;
}

.help-search-result:hover {
    background-color: #f8f9fa;
}

.help-search-title {
    font-weight: 600;
    color: #007bff;
}

.help-search-summary {
    font-size: 11px;
    color: #6c757d;
    margin-top: 3px;
}

/* Notes */
.help-notes {
    border-top: 1px solid #dee2e6;
    padding-top: 15px;
}

.help-notes-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.help-notes-header h6 {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
}

.help-note-form {
    background: #f8f9fa;
    padding: 10px;
    border-radius: 4px;
    margin-bottom: 10px;
}

.help-notes-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.help-note {
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    padding: 10px;
    position: relative;
}

.help-note-private {
    background: #fffbf0;
    border-color: #ffe0b2;
}

.help-note-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
    font-size: 11px;
}

.help-note-author {
    font-weight: 600;
    color: #495057;
}

.help-note-date {
    color: #6c757d;
}

.help-note-text {
    font-size: 12px;
    white-space: pre-wrap;
    color: #333;
}

.help-note-actions {
    position: absolute;
    top: 5px;
    right: 5px;
    opacity: 0;
    transition: opacity 0.15s;
}

.help-note:hover .help-note-actions {
    opacity: 1;
}

.help-note-actions .btn-link {
    padding: 2px 5px;
    font-size: 11px;
}

/* Dark theme support for sidebar (br-sideright has dark background #1D2939) */
.br-sideright .help-panel {
    color: #e0e0e0;
}

.br-sideright .help-search {
    border-color: rgba(255,255,255,0.15);
}

.br-sideright .help-search .form-control {
    background-color: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.2);
    color: #e0e0e0;
}

.br-sideright .help-search .form-control::placeholder {
    color: rgba(255,255,255,0.5);
}

.br-sideright .help-search .input-group-text {
    background-color: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.2);
    color: #adb5bd;
}

.br-sideright .help-search .btn {
    background-color: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.2);
    color: #adb5bd;
}

.br-sideright .help-presentation-link {
    background-color: rgba(105,179,255,0.12);
    border-color: rgba(255,255,255,0.15);
    color: #69b3ff;
}

.br-sideright .help-presentation-link:hover {
    background-color: rgba(105,179,255,0.2);
    color: #8ec6ff;
}

.br-sideright .help-tree-panel {
    border-color: rgba(255,255,255,0.15);
}

.br-sideright .help-tree-node {
    color: #e0e0e0;
}

.br-sideright .help-tree-node:hover {
    background-color: rgba(255,255,255,0.1);
}

.br-sideright .help-tree-node.active {
    background-color: rgba(0,123,255,0.3);
    color: #69b3ff;
}

.br-sideright .help-tree-toggle,
.br-sideright .help-tree-icon {
    color: #adb5bd;
}

.br-sideright .help-loading,
.br-sideright .help-no-results,
.br-sideright .help-welcome {
    color: #adb5bd;
}

.br-sideright .help-breadcrumb,
.br-sideright .help-breadcrumb a {
    color: #adb5bd;
}

.br-sideright .help-breadcrumb a:hover {
    color: #69b3ff;
}

.br-sideright .help-topic-title {
    color: #e0e0e0;
}

.br-sideright .help-topic-actions .btn {
    background-color: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.2);
    color: #adb5bd;
}

.br-sideright .help-topic-actions .btn:hover {
    background-color: rgba(255,255,255,0.2);
    border-color: rgba(255,255,255,0.3);
    color: #e0e0e0;
}

.br-sideright .help-topic-summary {
    color: #adb5bd;
}

.br-sideright .help-content {
    color: #e0e0e0;
}

.br-sideright .help-content h1,
.br-sideright .help-content h2,
.br-sideright .help-content h3,
.br-sideright .help-content h4,
.br-sideright .help-content h5,
.br-sideright .help-content h6 {
    color: #e0e0e0;
}

.br-sideright .help-content code {
    background-color: rgba(255,255,255,0.1);
    color: #ffcc80;
}

.br-sideright .help-content pre {
    background-color: rgba(0,0,0,0.3);
    border-color: rgba(255,255,255,0.1);
    color: #e0e0e0;
}

.br-sideright .help-content table {
    color: #e0e0e0;
}

.br-sideright .help-content th {
    background-color: rgba(255,255,255,0.1);
    color: #e0e0e0;
}

.br-sideright .help-content th,
.br-sideright .help-content td {
    border-color: rgba(255,255,255,0.15);
}

.br-sideright .help-content blockquote {
    color: #adb5bd;
    border-left-color: #69b3ff;
}

.br-sideright .help-diagram {
    background: rgba(255,255,255,0.05);
}

.br-sideright .help-diagram-title {
    color: #adb5bd;
}

.br-sideright .help-children {
    border-top-color: rgba(255,255,255,0.15);
}

.br-sideright .help-children h6 {
    color: #adb5bd;
}

.br-sideright .help-child-link {
    background: rgba(255,255,255,0.1);
    color: #e0e0e0;
}

.br-sideright .help-child-link:hover {
    background: rgba(255,255,255,0.2);
    color: #69b3ff;
}

.br-sideright .help-search-results h6 {
    color: #adb5bd;
}

.br-sideright .help-search-result {
    border-bottom-color: rgba(255,255,255,0.1);
}

.br-sideright .help-search-result:hover {
    background-color: rgba(255,255,255,0.05);
}

.br-sideright .help-search-title {
    color: #69b3ff;
}

.br-sideright .help-search-summary {
    color: #adb5bd;
}

.br-sideright .help-notes {
    border-top-color: rgba(255,255,255,0.15);
}

.br-sideright .help-notes-header h6 {
    color: #e0e0e0;
}

.br-sideright .help-note-form {
    background: rgba(255,255,255,0.05);
}

.br-sideright .help-note-form .form-control {
    background-color: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.2);
    color: #e0e0e0;
}

.br-sideright .help-note {
    background: rgba(255,255,255,0.05);
    border-color: rgba(255,255,255,0.1);
}

.br-sideright .help-note-private {
    background: rgba(255,200,0,0.1);
    border-color: rgba(255,200,0,0.3);
}

.br-sideright .help-note-author {
    color: #e0e0e0;
}

.br-sideright .help-note-date {
    color: #adb5bd;
}

.br-sideright .help-note-text {
    color: #e0e0e0;
}

.br-sideright .text-muted {
    color: #adb5bd !important;
}

/* ========================================
   Interactive Images - Hover Preview & Modal
   ======================================== */

/* Base style for interactive images */
.help-image-interactive {
    cursor: zoom-in;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    max-width: 100%;
    border-radius: 4px;
}

.help-image-interactive:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

/* Interactive SVG diagrams */
.help-svg-interactive {
    cursor: zoom-in;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.help-svg-interactive:hover {
    transform: scale(1.01);
}

.help-diagram-interactive {
    cursor: zoom-in;
    transition: box-shadow 0.2s ease;
}

.help-diagram-interactive:hover {
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}

/* Mermaid diagram click hint */
.mermaid-diagram {
    position: relative;
}

.mermaid-diagram::after {
    content: "Clicca per ingrandire";
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    opacity: 0;
    transition: opacity 0.2s;
    pointer-events: none;
}

.mermaid-diagram:hover::after {
    opacity: 1;
}

/* Hover preview tooltip */
.help-content img,
.help-diagram img {
    position: relative;
}

.help-image-interactive::after {
    content: "Clicca per ingrandire";
    position: absolute;
    bottom: 5px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 3px 8px;
    border-radius: 3px;
    font-size: 10px;
    opacity: 0;
    transition: opacity 0.2s;
    pointer-events: none;
}

.help-image-interactive:hover::after {
    opacity: 1;
}

/* Image Modal Overlay */
.help-image-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    cursor: zoom-out;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Modal Content Container */
.help-image-modal-content {
    position: relative;
    max-width: 95vw;
    max-height: 95vh;
    cursor: default;
    animation: zoomIn 0.2s ease;
}

@keyframes zoomIn {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.help-image-modal-content img {
    max-width: 95vw;
    max-height: 85vh;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 10px 50px rgba(0,0,0,0.5);
}

/* Mermaid diagram in modal */
.help-modal-mermaid {
    background: white;
    border-radius: 8px;
    padding: 20px;
    width: 90vw;
    max-width: 1400px;
    max-height: 85vh;
    overflow: auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

.help-modal-mermaid svg {
    max-width: 100%;
    max-height: 100%;
}

.help-modal-mermaid .help-loading {
    color: #666;
    padding: 40px;
}

/* SVG Modal (for non-mermaid SVGs) */
.help-modal-svg {
    background: white;
    border-radius: 8px;
    padding: 20px;
    width: 90vw;
    max-width: 1400px;
    max-height: 85vh;
    overflow: auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

.help-modal-svg svg {
    width: 100%;
    height: auto;
    max-height: 80vh;
}

/* Close Button */
.help-image-modal-close {
    position: absolute;
    top: -40px;
    right: 0;
    background: transparent;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.help-image-modal-close:hover {
    background: rgba(255,255,255,0.1);
}

/* Image Caption */
.help-image-modal-caption {
    text-align: center;
    color: #adb5bd;
    margin-top: 10px;
    font-size: 14px;
}

/* Hover preview box - shows larger image on hover */
.help-content {
    position: relative;
}

.help-content img:not(.no-preview),
.help-diagram img:not(.no-preview) {
    position: relative;
}

/* Create hover preview effect using CSS scale */
.help-image-interactive {
    display: inline-block;
    overflow: visible;
}

/* Hover Preview Container - wraps images for preview functionality */
.help-image-wrapper {
    position: relative;
    display: inline-block;
}

/* Large hover preview (400x400 tooltip) */
.help-image-preview {
    position: fixed;
    width: 400px;
    height: 400px;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    padding: 10px;
    z-index: 9999;
    pointer-events: none;
    opacity: 0;
    transform: scale(0.9);
    transition: opacity 0.15s ease, transform 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.help-image-preview.visible {
    opacity: 1;
    transform: scale(1);
}

.help-image-preview img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* Dark theme for preview tooltip */
.br-sideright .help-image-preview {
    background: #2d3748;
    border-color: #4a5568;
}

/* Dark theme adjustments for modal (already on dark overlay, so minimal changes needed) */
.br-sideright .help-image-modal-caption {
    color: #e0e0e0;
}
