/* SOLO tippy styles - Base configuration */
.tippy-box {
    background-color: var(--pst-color-surface);
    color: var(--pst-color-text-base);
    border: 1px solid var(--pst-color-border);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.tippy-arrow {
    color: var(--pst-color-surface);
}

.has-tippy:hover {
    cursor: help;
}

/* ============================================
   Content Preview Styles
   Adapted from CITApp-Documentation-Master
   ============================================ */

/* Enhanced tippy box styling for content previews */
.tippy-box[data-theme~='light-border'] {
    background-color: var(--pst-color-surface, white);
    color: var(--pst-color-text-base, #333);
    border: 1px solid var(--pst-color-border, #ccc);
    max-width: 450px !important;
    min-width: 200px;
    font-size: 0.9rem;
    line-height: 1.4;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
    border-radius: 6px;
    z-index: 100000 !important;
}

/* Ensure tooltips don't overflow viewport */
.tippy-box {
    max-width: calc(100vw - 40px) !important;
}

/* Support for reference links with tooltips */
a.reference.custom-tippy-initialized {
    cursor: pointer;
}

/* Tippy content container */
.tippy-content {
    padding: 12px;
    max-width: 420px;
    font-size: 0.9rem;
    overflow: auto;
    max-height: 350px !important;
}

/* Preview container */
.tippy-preview {
    font-family: var(--pst-font-family-base, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif);
}

/* Preview heading */
.tippy-preview-heading {
    font-weight: bold;
    padding-bottom: 8px;
    margin-bottom: 8px;
    border-bottom: 1px solid var(--pst-color-border, #eaecef);
    font-size: 1.1rem;
    color: var(--pst-color-text-base, #333);
}

/* Full content preview styling */
.tippy-preview-full-content {
    max-height: 450px;
    overflow-y: auto;
    margin-top: 8px;
    padding: 5px 0;
    font-size: 0.9rem;
    line-height: 1.5;
}

.tippy-content-wrapper {
    width: 100%;
}

.tippy-full-content {
    width: 100%;
}

/* Image styling within previews */
.tippy-preview-full-content img,
.tippy-preview img {
    max-width: 100%;
    height: auto;
    margin: 8px 0;
    border: none;
    display: block;
}

/* Table styling within previews */
.tippy-preview-full-content table,
.tippy-preview table {
    border-collapse: collapse;
    margin: 8px 0;
    width: 100%;
    font-size: 0.85rem;
}

.tippy-preview-full-content th,
.tippy-preview-full-content td,
.tippy-preview th,
.tippy-preview td {
    border: 1px solid #e1e4e8;
    padding: 6px 12px;
}

.tippy-preview-full-content th,
.tippy-preview th {
    background-color: #f6f8fa;
}

/* Links inside previews */
.tippy-preview-full-content a,
.tippy-preview a {
    color: var(--pst-color-link, #0366d6);
    text-decoration: underline;
}

/* Loading spinner */
.tippy-loading-spinner {
    width: 24px;
    height: 24px;
    margin: 10px auto;
    border: 2px solid rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    border-top-color: var(--pst-color-primary, #2980b9);
    animation: tippy-spinner 0.8s linear infinite;
}

@keyframes tippy-spinner {
    to { transform: rotate(360deg); }
}

/* Error message styling */
.tippy-error-message {
    color: #e74c3c;
    font-size: 0.85rem;
    font-style: italic;
    padding: 8px;
}

/* Section styling */
.tippy-section {
    margin-bottom: 15px;
}

/* Preview content area */
.tippy-preview-content {
    margin-top: 8px;
}

/* Scrollbar styling for preview content */
.tippy-preview::-webkit-scrollbar,
.tippy-preview-full-content::-webkit-scrollbar {
    width: 8px;
}

.tippy-preview::-webkit-scrollbar-track,
.tippy-preview-full-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.tippy-preview::-webkit-scrollbar-thumb,
.tippy-preview-full-content::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.tippy-preview::-webkit-scrollbar-thumb:hover,
.tippy-preview-full-content::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Firefox scrollbar */
.tippy-preview,
.tippy-preview-full-content {
    scrollbar-width: thin;
    scrollbar-color: #888 #f1f1f1;
}

/* Prevent tooltips on links inside tooltips */
.tippy-box a.reference,
.tippy-content a.reference {
    pointer-events: auto !important;
    cursor: pointer;
}

/* Style for links marked as no-preview */
a.no-preview {
    text-decoration: inherit;
    color: inherit;
    cursor: pointer;
}

/* Admonition styling within previews */
.tippy-preview .admonition,
.tippy-preview .note,
.tippy-preview .warning {
    padding: 10px;
    margin-bottom: 10px;
    background: var(--pst-color-surface, #f8f8f8);
    border-left: 4px solid var(--pst-color-primary, #2980b9);
    border-radius: 0 4px 4px 0;
}

/* Code block styling within previews */
.tippy-preview pre,
.tippy-preview code {
    font-size: 0.85rem;
    background-color: var(--pst-color-surface, #f6f8fa);
    padding: 2px 4px;
    border-radius: 3px;
}

.tippy-preview pre {
    padding: 8px;
    overflow-x: auto;
    max-height: 200px;
}

/* ============================================
   Dark Mode Support
   ============================================ */

/* Dark mode - both selectors for compatibility */
[data-theme="dark"] .tippy-box[data-theme~='light-border'],
html[data-theme="dark"] .tippy-box[data-theme~='light-border'] {
    background-color: #1a1a2e !important;
    border-color: #3d3d5c !important;
    color: #e0e0e0 !important;
}

[data-theme="dark"] .tippy-box[data-theme~='light-border'] .tippy-content,
html[data-theme="dark"] .tippy-box[data-theme~='light-border'] .tippy-content {
    color: #e0e0e0 !important;
}

[data-theme="dark"] .tippy-preview-heading,
html[data-theme="dark"] .tippy-preview-heading {
    border-bottom-color: #3d3d5c !important;
    color: #ffffff !important;
    font-weight: 600;
}

[data-theme="dark"] .tippy-preview,
html[data-theme="dark"] .tippy-preview {
    color: #e0e0e0 !important;
}

[data-theme="dark"] .tippy-preview-full-content,
html[data-theme="dark"] .tippy-preview-full-content {
    color: #e0e0e0 !important;
}

[data-theme="dark"] .tippy-preview-content,
html[data-theme="dark"] .tippy-preview-content {
    color: #e0e0e0 !important;
}

[data-theme="dark"] .tippy-preview-full-content th,
[data-theme="dark"] .tippy-preview th,
html[data-theme="dark"] .tippy-preview-full-content th,
html[data-theme="dark"] .tippy-preview th {
    background-color: #2d2d4a !important;
    color: #e0e0e0 !important;
}

[data-theme="dark"] .tippy-preview-full-content td,
[data-theme="dark"] .tippy-preview td,
html[data-theme="dark"] .tippy-preview-full-content td,
html[data-theme="dark"] .tippy-preview td {
    background-color: #1a1a2e !important;
    color: #e0e0e0 !important;
    border-color: #3d3d5c !important;
}

[data-theme="dark"] .tippy-preview::-webkit-scrollbar-track,
[data-theme="dark"] .tippy-preview-full-content::-webkit-scrollbar-track,
html[data-theme="dark"] .tippy-preview::-webkit-scrollbar-track,
html[data-theme="dark"] .tippy-preview-full-content::-webkit-scrollbar-track {
    background: #2d2d4a;
}

[data-theme="dark"] .tippy-preview::-webkit-scrollbar-thumb,
[data-theme="dark"] .tippy-preview-full-content::-webkit-scrollbar-thumb,
html[data-theme="dark"] .tippy-preview::-webkit-scrollbar-thumb,
html[data-theme="dark"] .tippy-preview-full-content::-webkit-scrollbar-thumb {
    background: #5c5c8a;
}

[data-theme="dark"] .tippy-preview,
[data-theme="dark"] .tippy-preview-full-content,
html[data-theme="dark"] .tippy-preview,
html[data-theme="dark"] .tippy-preview-full-content {
    scrollbar-color: #5c5c8a #2d2d4a;
}

/* Fix sphinx-design cards in dark mode tooltips */
[data-theme="dark"] .tippy-preview .sd-card,
[data-theme="dark"] .tippy-preview .sd-card-body,
html[data-theme="dark"] .tippy-preview .sd-card,
html[data-theme="dark"] .tippy-preview .sd-card-body {
    background-color: #1a1a2e !important;
    color: #e0e0e0 !important;
    border-color: #3d3d5c !important;
}

/* Fix grid items in dark mode tooltips */
[data-theme="dark"] .tippy-preview .sd-row,
[data-theme="dark"] .tippy-preview .sd-col,
html[data-theme="dark"] .tippy-preview .sd-row,
html[data-theme="dark"] .tippy-preview .sd-col {
    background-color: transparent !important;
}

/* Fix tab styling in tooltips */
[data-theme="dark"] .tippy-preview .sphinx-tabs,
[data-theme="dark"] .tippy-preview .sphinx-tabs-tab,
[data-theme="dark"] .tippy-preview .sphinx-tabs-panel,
html[data-theme="dark"] .tippy-preview .sphinx-tabs,
html[data-theme="dark"] .tippy-preview .sphinx-tabs-tab,
html[data-theme="dark"] .tippy-preview .sphinx-tabs-panel {
    background-color: #1a1a2e !important;
    color: #e0e0e0 !important;
    border-color: #3d3d5c !important;
}

/* Fix code blocks in dark mode tooltips */
[data-theme="dark"] .tippy-preview pre,
[data-theme="dark"] .tippy-preview code,
html[data-theme="dark"] .tippy-preview pre,
html[data-theme="dark"] .tippy-preview code {
    background-color: #2d2d4a !important;
    color: #e0e0e0 !important;
}

/* Fix admonitions in dark mode tooltips */
[data-theme="dark"] .tippy-preview .admonition,
[data-theme="dark"] .tippy-preview .note,
[data-theme="dark"] .tippy-preview .warning,
html[data-theme="dark"] .tippy-preview .admonition,
html[data-theme="dark"] .tippy-preview .note,
html[data-theme="dark"] .tippy-preview .warning {
    background-color: #2d2d4a !important;
    color: #e0e0e0 !important;
}

/* Fix links in dark mode tooltips */
[data-theme="dark"] .tippy-preview a,
[data-theme="dark"] .tippy-preview-full-content a,
html[data-theme="dark"] .tippy-preview a,
html[data-theme="dark"] .tippy-preview-full-content a {
    color: #6ea8fe !important;
}
