/* Knowledge Base Styles */

/* Search Section */
.kb-search-section {
    padding: 2rem 0 3rem;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-bottom: 1px solid #dee2e6;
}

.kb-search-wrapper {
    max-width: 900px;
    margin: 0 auto;
}

.kb-search-box {
    position: relative;
    margin-bottom: 2rem;
}

.kb-search-box .search-icon {
    position: absolute;
    left: 1.25rem;
    top: 50%;
    transform: translateY(-50%);
    color: #6c757d;
    pointer-events: none;
}

.kb-search-input {
    width: 100%;
    padding: 1rem 3.5rem 1rem 3.5rem;
    font-size: 1.1rem;
    border: 2px solid #dee2e6;
    border-radius: 50px;
    outline: none;
    transition: all 0.3s ease;
    background: white;
}

.kb-search-input:focus {
    border-color: #4a90e2;
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

.kb-search-clear {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    padding: 0.5rem;
    background: none;
    border: none;
    cursor: pointer;
    color: #6c757d;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.kb-search-clear:hover {
    background: #f8f9fa;
    color: #495057;
}

/* Stats Row */
.kb-stats {
    display: flex;
    gap: 2rem;
    justify-content: center;
    flex-wrap: wrap;
}

.kb-stat {
    text-align: center;
}

.kb-stat-number {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 0.25rem;
}

.kb-stat-label {
    display: block;
    font-size: 0.875rem;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Main Content Layout */
.kb-content-section {
    padding: 3rem 0;
}

.kb-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 2rem;
}

/* Sidebar */
.kb-sidebar {
    position: sticky;
    top: 2rem;
    height: fit-content;
}

.kb-filter-section {
    margin-bottom: 2rem;
}

.kb-filter-title {
    font-size: 0.875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #495057;
    margin-bottom: 1rem;
}

.kb-filter-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.kb-filter-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
    font-size: 0.9rem;
}

.kb-filter-btn:hover {
    background: #f8f9fa;
    border-color: #4a90e2;
}

.kb-filter-btn.active {
    background: #4a90e2;
    color: white;
    border-color: #4a90e2;
}

.kb-filter-btn.active .kb-filter-count {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.kb-filter-count {
    background: #e9ecef;
    color: #495057;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

/* Main Content Area */
.kb-main {
    min-height: 500px;
}

.kb-results-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #dee2e6;
}

.kb-results-info {
    font-size: 1rem;
    color: #495057;
}

.kb-results-info #kb-results-count {
    font-weight: 700;
    color: #2c3e50;
}

.kb-sort {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.kb-sort label {
    font-size: 0.875rem;
    color: #6c757d;
}

.kb-sort-select {
    padding: 0.5rem 1rem;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    background: white;
    cursor: pointer;
    font-size: 0.875rem;
}

/* Documents Grid */
.kb-documents-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 1.5rem;
}

.kb-document-card {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 12px;
    padding: 1.5rem;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.kb-document-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
    border-color: #4a90e2;
}

.kb-doc-header {
    display: flex;
    align-items: start;
    justify-content: space-between;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.kb-doc-badges {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.kb-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.kb-badge-general {
    background: #e9ecef;
    color: #495057;
}

.kb-badge-prophecy {
    background: #e3f2fd;
    color: #1565c0;
}

.kb-badge-theology {
    background: #f3e5f5;
    color: #6a1b9a;
}

.kb-badge-apologetics {
    background: #fff3e0;
    color: #e65100;
}

.kb-badge-scripture {
    background: #e8f5e9;
    color: #2e7d32;
}

.kb-badge-history {
    background: #fce4ec;
    color: #c2185b;
}

.kb-badge-ar {
    background: #dcfce7;
    color: #15803d;
}

.kb-badge-en {
    background: #dbeafe;
    color: #1e40af;
}

.kb-badge-mixed {
    background: #fef3c7;
    color: #92400e;
}

.kb-badge-type {
    background: #f1f5f9;
    color: #64748b;
}

.kb-doc-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #6c757d;
    font-size: 0.875rem;
}

.kb-doc-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 0.75rem;
    line-height: 1.4;
}

.kb-doc-excerpt {
    color: #6c757d;
    font-size: 0.9rem;
    line-height: 1.6;
    margin-bottom: 1rem;
    flex-grow: 1;
}

.kb-doc-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 1rem;
    border-top: 1px solid #e9ecef;
}

.kb-doc-view-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: #4a90e2;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.875rem;
    transition: all 0.2s;
}

.kb-doc-view-btn:hover {
    background: #357abd;
    transform: translateX(2px);
}

.kb-doc-date {
    font-size: 0.75rem;
    color: #6c757d;
}

/* Loading State */
.kb-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    color: #6c757d;
}

.kb-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid #f3f4f6;
    border-top-color: #4a90e2;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* No Results */
.kb-no-results {
    grid-column: 1 / -1;
    text-align: center;
    padding: 4rem 2rem;
    color: #6c757d;
}

.kb-no-results svg {
    margin-bottom: 1rem;
    opacity: 0.5;
}

.kb-no-results h3 {
    font-size: 1.25rem;
    color: #2c3e50;
    margin-bottom: 0.5rem;
}

/* Modal */
.kb-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.kb-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.kb-modal-content {
    position: relative;
    background: white;
    border-radius: 16px;
    max-width: 900px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.kb-modal-close {
    position: sticky;
    top: 1rem;
    right: 1rem;
    float: right;
    margin: 1rem 1rem 0 0;
    padding: 0.5rem;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    z-index: 10;
}

.kb-modal-close:hover {
    background: #f8f9fa;
    transform: rotate(90deg);
}

.kb-modal-body {
    padding: 3rem;
}

.kb-modal-header {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 2px solid #dee2e6;
}

.kb-modal-title {
    font-size: 2rem;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 1rem;
}

.kb-modal-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    color: #6c757d;
    font-size: 0.875rem;
}

.kb-modal-content-text {
    font-size: 1rem;
    line-height: 1.8;
    color: #2c3e50;
}

.kb-modal-content-text p {
    margin-bottom: 1rem;
}

.kb-modal-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 3rem;
    color: #6c757d;
}

/* Responsive */
@media (max-width: 992px) {
    .kb-layout {
        grid-template-columns: 1fr;
    }

    .kb-sidebar {
        position: static;
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        gap: 1rem;
    }

    .kb-documents-grid {
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    }
}

@media (max-width: 768px) {
    .kb-search-input {
        font-size: 1rem;
        padding: 0.875rem 3rem;
    }

    .kb-stat-number {
        font-size: 1.5rem;
    }

    .kb-documents-grid {
        grid-template-columns: 1fr;
    }

    .kb-modal-body {
        padding: 2rem;
    }

    .kb-modal-title {
        font-size: 1.5rem;
    }
}