/* Documentation Viewer Styles */

.documentation-section {
    margin: 1rem 0;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background: var(--card-bg);
    overflow: hidden;
}

.documentation-header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.documentation-toggle {
    width: 100%;
    padding: 0.75rem 1rem;
    background: transparent;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-primary);
    font-size: 0.95rem;
    font-weight: 500;
    text-align: left;
    transition: background-color 0.2s ease;
}

.documentation-toggle:hover {
    background: var(--hover-bg);
}

.documentation-toggle:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: -2px;
}

.documentation-toggle-icon {
    display: inline-block;
    width: 1rem;
    transition: transform 0.2s ease;
    color: var(--text-secondary);
}

.documentation-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.documentation-icon {
    color: var(--text-secondary);
    flex-shrink: 0;
}

.documentation-content {
    max-height: 600px;
    overflow-y: auto;
    transition: max-height 0.3s ease;
}

.documentation-loading {
    padding: 2rem;
    text-align: center;
    color: var(--text-secondary);
    font-style: italic;
}

.documentation-error {
    padding: 1rem;
    color: var(--danger-color);
    background: var(--danger-bg);
    border-left: 4px solid var(--danger-color);
    margin: 1rem;
    border-radius: var(--border-radius);
}

.documentation-body {
    padding: 1rem;
    color: var(--text-primary);
    line-height: 1.6;
}

/* Markdown content styling */
.documentation-body h1,
.documentation-body h2,
.documentation-body h3,
.documentation-body h4,
.documentation-body h5,
.documentation-body h6 {
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
    font-weight: 600;
}

.documentation-body h1 { font-size: 1.5rem; }
.documentation-body h2 { font-size: 1.3rem; }
.documentation-body h3 { font-size: 1.1rem; }
.documentation-body h4 { font-size: 1rem; }
.documentation-body h5 { font-size: 0.95rem; }
.documentation-body h6 { font-size: 0.9rem; }

.documentation-body p {
    margin-bottom: 1rem;
}

.documentation-body ul,
.documentation-body ol {
    margin-bottom: 1rem;
    padding-left: 2rem;
}

.documentation-body li {
    margin-bottom: 0.25rem;
}

.documentation-body blockquote {
    margin: 1rem 0;
    padding: 0.5rem 1rem;
    border-left: 4px solid var(--primary-color);
    background: var(--bg-secondary);
    color: var(--text-secondary);
}

.documentation-body code {
    padding: 0.2rem 0.4rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 3px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9em;
    color: var(--text-primary);
}

.documentation-body pre {
    margin: 1rem 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    overflow-x: auto;
}

.documentation-body pre code {
    display: block;
    padding: 1rem;
    background: transparent;
    border: none;
    font-size: 0.875rem;
    line-height: 1.5;
}

/* Code block wrapper with copy button */
.documentation-code-wrapper {
    position: relative;
    margin: 1rem 0;
}

.documentation-code-copy {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    padding: 0.25rem 0.5rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    font-size: 0.75rem;
    cursor: pointer;
    opacity: 0.8;
    transition: opacity 0.2s ease;
    z-index: 1;
}

.documentation-code-copy:hover {
    opacity: 1;
}

/* Tables */
.documentation-table-wrapper {
    overflow-x: auto;
    margin: 1rem 0;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
}

.documentation-body table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.documentation-body th,
.documentation-body td {
    padding: 0.5rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.documentation-body th {
    background: var(--bg-secondary);
    font-weight: 600;
    color: var(--text-primary);
}

.documentation-body tr:last-child td {
    border-bottom: none;
}

.documentation-body tr:hover {
    background: var(--hover-bg);
}

/* Links */
.documentation-body a {
    color: var(--primary-color);
    text-decoration: none;
}

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

/* Horizontal rule */
.documentation-body hr {
    margin: 1.5rem 0;
    border: none;
    border-top: 1px solid var(--border-color);
}

/* Images */
.documentation-body img {
    max-width: 100%;
    height: auto;
    border-radius: var(--border-radius);
}

/* GitHub-style Alerts */
.github-alert {
    margin: 1rem 0;
    padding: 0;
    border-radius: var(--border-radius);
    border: 1px solid;
    overflow: hidden;
    background: var(--card-bg);
}

.github-alert-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    font-weight: 600;
    font-size: 0.875rem;
    border-bottom: 1px solid;
}

.github-alert-icon {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.github-alert-title {
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.github-alert-content {
    padding: 1rem;
    line-height: 1.6;
}

.github-alert-content p:first-child {
    margin-top: 0;
}

.github-alert-content p:last-child {
    margin-bottom: 0;
}

/* Warning Alert */
.github-alert-warning {
    border-color: var(--warning-color);
    background: var(--warning-light);
}

.github-alert-warning .github-alert-header {
    background: var(--warning-color);
    color: white;
    border-bottom-color: var(--warning-color);
}

.github-alert-warning .github-alert-content {
    color: var(--text-primary);
}

/* Tip Alert */
.github-alert-tip {
    border-color: var(--info-color);
    background: var(--info-light);
}

.github-alert-tip .github-alert-header {
    background: var(--info-color);
    color: white;
    border-bottom-color: var(--info-color);
}

.github-alert-tip .github-alert-content {
    color: var(--text-primary);
}

/* Note Alert */
.github-alert-note {
    border-color: var(--primary-color);
    background: var(--primary-light);
}

.github-alert-note .github-alert-header {
    background: var(--primary-color);
    color: white;
    border-bottom-color: var(--primary-color);
}

.github-alert-note .github-alert-content {
    color: var(--text-primary);
}

/* Caution Alert */
.github-alert-caution {
    border-color: var(--error-color);
    background: var(--error-light);
}

.github-alert-caution .github-alert-header {
    background: var(--error-color);
    color: white;
    border-bottom-color: var(--error-color);
}

.github-alert-caution .github-alert-content {
    color: var(--text-primary);
}

/* Important Alert */
.github-alert-important {
    border-color: var(--secondary-color);
    background: var(--secondary-light);
}

.github-alert-important .github-alert-header {
    background: var(--secondary-color);
    color: white;
    border-bottom-color: var(--secondary-color);
}

.github-alert-important .github-alert-content {
    color: var(--text-primary);
}

/* Tooltips */
.documentation-tooltip-container {
    position: relative;
    display: inline-block;
}

.documentation-tooltip-trigger {
    cursor: help;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.documentation-help-icon {
    color: var(--text-secondary);
    vertical-align: middle;
}

.documentation-tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    font-size: 0.875rem;
    white-space: nowrap;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    max-width: 300px;
    white-space: normal;
}

.documentation-tooltip-trigger:hover + .documentation-tooltip,
.documentation-tooltip:hover {
    opacity: 1;
    visibility: visible;
}

/* Dark theme adjustments */
[data-theme="dark"] .documentation-body code {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .documentation-body pre {
    background: rgba(0, 0, 0, 0.3);
    border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .documentation-table-wrapper {
    border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .documentation-body th {
    background: rgba(255, 255, 255, 0.05);
}

/* Dark theme GitHub alerts */
[data-theme="dark"] .github-alert {
    background: var(--card-bg);
}

[data-theme="dark"] .github-alert-warning {
    background: rgba(245, 158, 11, 0.1);
    border-color: var(--warning-color);
}

[data-theme="dark"] .github-alert-tip {
    background: rgba(6, 182, 212, 0.1);
    border-color: var(--info-color);
}

[data-theme="dark"] .github-alert-note {
    background: rgba(59, 130, 246, 0.1);
    border-color: var(--primary-color);
}

[data-theme="dark"] .github-alert-caution {
    background: rgba(239, 68, 68, 0.1);
    border-color: var(--error-color);
}

[data-theme="dark"] .github-alert-important {
    background: rgba(107, 114, 128, 0.1);
    border-color: var(--secondary-color);
}

[data-theme="dark"] .github-alert-content {
    color: var(--text-primary);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .documentation-content {
        max-height: 400px;
    }

    .documentation-body {
        padding: 0.75rem;
    }

    .documentation-body table {
        font-size: 0.8rem;
    }

    .documentation-body th,
    .documentation-body td {
        padding: 0.375rem 0.5rem;
    }
}
