/* Enhanced Knowledge Base Styles - Advanced Features */

/* Live Search Results */
.xmla-kb-search-results {
    position: absolute;
    top: calc(100% + 0.5rem);
    left: 0;
    right: 0;
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.15);
    max-height: 500px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
}

.xmla-kb-search-results.active {
    display: block;
}

.xmla-kb-results-section {
    padding: 1rem;
}

.xmla-kb-results-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    color: #94a3b8;
    margin-bottom: 0.5rem;
    padding: 0 0.5rem;
}

.xmla-kb-result-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 0.5rem;
    text-decoration: none;
    color: inherit;
    transition: background 0.2s;
}

.xmla-kb-result-item:hover,
.xmla-kb-result-item.highlighted {
    background: #f8fafc;
}

.xmla-kb-result-item:focus {
    outline: 2px solid #3b82f6;
    outline-offset: -2px;
}

.xmla-kb-result-content {
    flex: 1;
}

.xmla-kb-result-title {
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 0.25rem;
}

.xmla-kb-result-title mark {
    background: #fef3c7;
    color: #92400e;
    padding: 0 0.2em;
}

.xmla-kb-result-excerpt {
    font-size: 0.875rem;
    color: #64748b;
    line-height: 1.4;
}

.xmla-kb-result-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.5rem;
    font-size: 0.75rem;
    color: #94a3b8;
}

.xmla-kb-result-category {
    background: #e0e7ff;
    color: #3730a3;
    padding: 0.125rem 0.5rem;
    border-radius: 999px;
}

.xmla-kb-result-time {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.xmla-kb-result-category-item {
    border: 1px solid #e2e8f0;
}

.xmla-kb-category-icon {
    font-size: 1.5rem;
}

.xmla-kb-category-count {
    font-size: 0.875rem;
    color: #94a3b8;
}

.xmla-kb-loading {
    padding: 2rem;
    text-align: center;
    color: #64748b;
}

.xmla-kb-no-results {
    padding: 2rem;
    text-align: center;
}

.xmla-kb-contact-support {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e2e8f0;
}

.xmla-kb-contact-support p {
    color: #64748b;
    margin-bottom: 1rem;
}

/* Quick Links */
.xmla-kb-quick-links {
    margin-top: 2rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: center;
    font-size: 0.9rem;
}

.xmla-kb-quick-links span {
    opacity: 0.8;
}

.xmla-kb-quick-link {
    color: white;
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 999px;
    text-decoration: none;
    transition: all 0.2s;
}

.xmla-kb-quick-link:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* Article Layout */
.xmla-kb-article-layout {
    display: grid;
    grid-template-columns: 240px 1fr 280px;
    gap: 3rem;
    max-width: 1400px;
    margin: 0 auto;
}

.xmla-kb-article-content {
    max-width: 100%;
    margin: 0;
}

/* Table of Contents */
.xmla-kb-toc-sidebar {
    position: sticky;
    top: 2rem;
    align-self: start;
    max-height: calc(100vh - 4rem);
    overflow-y: auto;
}

.xmla-kb-toc {
    background: #f8fafc;
    border-radius: 12px;
    padding: 1.5rem;
}

.xmla-kb-toc-title {
    font-weight: 700;
    font-size: 0.875rem;
    text-transform: uppercase;
    color: #64748b;
    margin-bottom: 1rem;
}

.xmla-kb-toc-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.xmla-kb-toc-list li {
    margin-bottom: 0.5rem;
}

.xmla-kb-toc-list a {
    color: #64748b;
    text-decoration: none;
    font-size: 0.875rem;
    line-height: 1.5;
    display: block;
    padding: 0.25rem 0;
    border-left: 2px solid transparent;
    padding-left: 0.75rem;
    transition: all 0.2s;
}

.xmla-kb-toc-list a:hover {
    color: #3b82f6;
}

.xmla-kb-toc-list a.active {
    color: #3b82f6;
    border-left-color: #3b82f6;
    font-weight: 600;
}

.xmla-kb-toc-list .toc-level-2 {
    margin-left: 1rem;
}

.xmla-kb-copy-link {
    display: inline-block;
    margin-left: 0.5rem;
    padding: 0.25rem 0.5rem;
    background: transparent;
    border: none;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s;
    font-size: 0.875rem;
}

h2:hover .xmla-kb-copy-link,
h3:hover .xmla-kb-copy-link {
    opacity: 0.5;
}

.xmla-kb-copy-link:hover {
    opacity: 1;
}

/* Article Sidebar */
.xmla-kb-article-sidebar {
    position: sticky;
    top: 2rem;
    align-self: start;
}

.xmla-kb-sidebar-widget {
    background: #f8fafc;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.xmla-kb-sidebar-widget h4 {
    font-weight: 700;
    font-size: 0.875rem;
    text-transform: uppercase;
    color: #64748b;
    margin-bottom: 1rem;
}

.xmla-kb-action-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #64748b;
    text-decoration: none;
    padding: 0.75rem 0;
    font-size: 0.875rem;
    transition: color 0.2s;
}

.xmla-kb-action-link:hover {
    color: #3b82f6;
}

.xmla-kb-related-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.xmla-kb-related-list li {
    margin-bottom: 0.75rem;
}

.xmla-kb-related-list a {
    color: #64748b;
    text-decoration: none;
    font-size: 0.875rem;
    line-height: 1.5;
    transition: color 0.2s;
}

.xmla-kb-related-list a:hover {
    color: #3b82f6;
}

/* Article Meta */
.xmla-kb-article-summary {
    font-size: 1.125rem;
    color: #64748b;
    line-height: 1.7;
    margin-bottom: 1.5rem;
}

.xmla-kb-meta-item {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.xmla-kb-meta-item svg {
    flex-shrink: 0;
}

/* Feedback Section */
.xmla-kb-feedback {
    background: #f8fafc;
    border-radius: 12px;
    padding: 2rem;
    margin-top: 3rem;
    text-align: center;
}

.xmla-kb-feedback h3 {
    font-size: 1.25rem;
    margin-bottom: 1.5rem;
    color: #1e293b;
}

.xmla-kb-feedback-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.xmla-kb-feedback-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.875rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    border: 2px solid #e2e8f0;
    background: white;
    color: #64748b;
    cursor: pointer;
    transition: all 0.3s;
}

.xmla-kb-feedback-btn:hover {
    border-color: #3b82f6;
    color: #3b82f6;
}

.xmla-kb-btn-yes:hover {
    border-color: #10b981;
    color: #10b981;
}

.xmla-kb-btn-no:hover {
    border-color: #f59e0b;
    color: #f59e0b;
}

.xmla-kb-feedback-comment {
    margin-top: 1.5rem;
    text-align: left;
}

.xmla-kb-feedback-comment textarea {
    width: 100%;
    padding: 1rem;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.9375rem;
    font-family: inherit;
    resize: vertical;
    margin-bottom: 1rem;
}

.xmla-kb-feedback-comment textarea:focus {
    outline: none;
    border-color: #3b82f6;
}

.xmla-kb-feedback-thanks {
    padding: 2rem;
}

.xmla-kb-feedback-icon {
    width: 60px;
    height: 60px;
    background: #10b981;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    margin: 0 auto 1rem;
}

/* Code Blocks */
.xmla-kb-code-wrapper {
    position: relative;
    margin-bottom: 1.5rem;
}

.xmla-kb-copy-code {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    color: white;
    font-size: 0.8125rem;
    cursor: pointer;
    transition: all 0.2s;
}

.xmla-kb-copy-code:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Collapsible Sections */
.xmla-kb-collapsible {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin-bottom: 1rem;
    overflow: hidden;
}

.xmla-kb-collapsible-header {
    padding: 1rem 1.5rem;
    background: #f8fafc;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 600;
    color: #1e293b;
}

.xmla-kb-collapsible-header:hover {
    background: #f1f5f9;
}

.xmla-kb-collapsible-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.xmla-kb-collapsible.active .xmla-kb-collapsible-content {
    padding: 1rem 1.5rem;
}

/* Next Steps */
.xmla-kb-next-steps {
    margin-top: 4rem;
    padding-top: 3rem;
    border-top: 1px solid #e2e8f0;
}

.xmla-kb-next-steps h2 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.xmla-kb-next-steps > p {
    color: #64748b;
    margin-bottom: 2rem;
}

.xmla-kb-card-next {
    position: relative;
}

.xmla-kb-card-badge {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: #e0e7ff;
    color: #3730a3;
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.xmla-kb-card-arrow {
    position: absolute;
    bottom: 1.5rem;
    right: 1.5rem;
    font-size: 1.5rem;
    color: #cbd5e1;
    transition: all 0.3s;
}

.xmla-kb-card-next:hover .xmla-kb-card-arrow {
    color: #3b82f6;
    transform: translateX(4px);
}

/* Content Sections */
.xmla-kb-content-sections {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 3rem;
}

.xmla-kb-content-column h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
}

.xmla-kb-article-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.xmla-kb-article-list-item {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    text-decoration: none;
    transition: all 0.3s;
}

.xmla-kb-article-list-item:hover {
    border-color: #cbd5e1;
    transform: translateX(4px);
}

.xmla-kb-article-list-content h3 {
    font-size: 0.9375rem;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 0.25rem;
}

.xmla-kb-article-list-content p {
    font-size: 0.8125rem;
    color: #64748b;
    line-height: 1.5;
}

.xmla-kb-article-list-meta {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    color: #94a3b8;
    font-size: 0.75rem;
    white-space: nowrap;
}

.xmla-kb-article-list-arrow {
    color: #cbd5e1;
    font-size: 1.25rem;
    flex-shrink: 0;
}

/* Section Titles */
.xmla-kb-section-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 2rem;
    color: #1e293b;
}

/* Card Variants */
.xmla-kb-card-hover:hover {
    transform: translateY(-6px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.12);
}

.xmla-kb-card-featured {
    position: relative;
    padding-top: 3rem;
}

.xmla-kb-card-footer {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #e2e8f0;
    font-size: 0.875rem;
    color: #94a3b8;
}

/* Empty State */
.xmla-kb-empty-state {
    text-align: center;
    padding: 4rem 2rem;
}

.xmla-kb-empty-icon {
    font-size: 4rem;
    margin-bottom: 1.5rem;
}

.xmla-kb-empty-state h3 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 0.5rem;
}

.xmla-kb-empty-state p {
    color: #64748b;
}

/* CTA Section */
.xmla-kb-section-cta {
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    padding: 6rem 0;
}

.xmla-kb-cta-content {
    text-align: center;
    color: white;
}

.xmla-kb-cta-content h2 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: white;
}

.xmla-kb-cta-content p {
    font-size: 1.125rem;
    margin-bottom: 2rem;
    opacity: 0.9;
}

.xmla-kb-cta-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.xmla-kb-support-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

/* Notification */
.xmla-kb-notification {
    position: fixed;
    bottom: -100px;
    left: 50%;
    transform: translateX(-50%);
    background: #1e293b;
    color: white;
    padding: 1rem 2rem;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    transition: bottom 0.3s ease;
    z-index: 10000;
}

.xmla-kb-notification.show {
    bottom: 2rem;
}

/* Mobile Responsiveness */
@media (max-width: 1024px) {
    .xmla-kb-article-layout {
        grid-template-columns: 1fr;
    }

    .xmla-kb-toc-sidebar,
    .xmla-kb-article-sidebar {
        display: none;
    }

    .xmla-kb-article-content {
        max-width: 800px;
        margin: 0 auto;
    }
}

@media (max-width: 768px) {
    .xmla-kb-hero h1 {
        font-size: 2rem;
    }

    .xmla-kb-hero p {
        font-size: 1rem;
    }

    .xmla-kb-quick-links {
        font-size: 0.8125rem;
    }

    .xmla-kb-article-title {
        font-size: 1.75rem;
    }

    .xmla-kb-article-meta {
        flex-wrap: wrap;
        gap: 1rem;
    }

    .xmla-kb-content-sections {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .xmla-kb-feedback-buttons {
        flex-direction: column;
    }

    .xmla-kb-cta-content h2 {
        font-size: 1.75rem;
    }

    .xmla-kb-cta-buttons {
        flex-direction: column;
        align-items: stretch;
    }

    .xmla-kb-cta-buttons .xmla-kb-btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .xmla-kb-section {
        padding: 2rem 0;
    }

    .xmla-kb-card {
        padding: 1.5rem;
    }

    .xmla-kb-section-title {
        font-size: 1.5rem;
    }
}

/* Rich Content Blocks */

/* Callouts */
.xmla-kb-callout {
    display: flex;
    gap: 1rem;
    padding: 1.25rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    border-left: 4px solid;
}

.xmla-kb-callout-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.xmla-kb-callout-content {
    flex: 1;
}

.xmla-kb-callout-title {
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.xmla-kb-callout-info {
    background: #eff6ff;
    border-left-color: #3b82f6;
    color: #1e40af;
}

.xmla-kb-callout-warning {
    background: #fff7ed;
    border-left-color: #f59e0b;
    color: #92400e;
}

.xmla-kb-callout-success {
    background: #f0fdf4;
    border-left-color: #10b981;
    color: #065f46;
}

.xmla-kb-callout-error {
    background: #fef2f2;
    border-left-color: #ef4444;
    color: #991b1b;
}

.xmla-kb-callout-note {
    background: #faf5ff;
    border-left-color: #a855f7;
    color: #6b21a8;
}

/* Steps */
.xmla-kb-steps {
    margin: 2rem 0;
}

.xmla-kb-step {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid #e2e8f0;
}

.xmla-kb-step:last-child {
    border-bottom: none;
}

.xmla-kb-step-number {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.125rem;
    flex-shrink: 0;
}

.xmla-kb-step-content {
    flex: 1;
}

.xmla-kb-step-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    color: #1e293b;
}

.xmla-kb-step-body {
    line-height: 1.7;
    color: #334155;
}

/* FAQ / Collapsibles */
.xmla-kb-faq {
    margin: 2rem 0;
}

.xmla-kb-collapsible-icon {
    font-size: 1.25rem;
    transition: transform 0.3s;
}

.xmla-kb-collapsible.active .xmla-kb-collapsible-icon {
    transform: rotate(45deg);
}

/* Video Embeds */
.xmla-kb-video-wrapper {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
    margin: 2rem 0;
    border-radius: 12px;
}

.xmla-kb-video-wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* Print Styles */
@media print {
    .xmla-kb-toc-sidebar,
    .xmla-kb-article-sidebar,
    .xmla-kb-feedback,
    .xmla-kb-next-steps,
    .xmla-kb-support-cta {
        display: none;
    }

    .xmla-kb-article-layout {
        grid-template-columns: 1fr;
    }
}
