/* wsp.ai - Knowledge Base Panel - Material Design 3 Dark Mode */

/* ============================================
   KNOWLEDGE PANEL
   ============================================ */

.knowledge-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background-color: #181818;
}

/* Knowledge Header */
.knowledge-header {
    padding: calc(var(--spacing-lg) * 0.8) var(--spacing-md);
    background-color: #1b1b1b;
    border-bottom: 1px solid #333;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
}

.knowledge-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, #90caf9 50%, transparent);
    opacity: 0.3;
}

.header-content h3 {
    font-size: 20px;
    font-weight: 500;
    color: #90caf9;
    margin: 0 0 4px 0;
}

.knowledge-subtitle {
    font-size: 12px;
    color: #b0b0b0;
    margin: 0;
}

.header-actions {
    display: flex;
    gap: 8px;
}

.icon-btn-small {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(144, 202, 249, 0.1);
    border: 1px solid rgba(144, 202, 249, 0.2);
    color: #90caf9;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s cubic-bezier(0.4, 0.0, 0.2, 1);
}

.icon-btn-small:hover {
    background: rgba(144, 202, 249, 0.2);
    border-color: rgba(144, 202, 249, 0.4);
    transform: scale(1.1);
    box-shadow: 0 0 12px rgba(144, 202, 249, 0.3);
}

.icon-btn-small .material-symbols-outlined {
    font-size: 18px;
}

/* Knowledge Content */
.knowledge-content {
    flex: 1;
    overflow-y: auto;
    padding: var(--spacing-md);
    scroll-behavior: smooth;
}

/* ============================================
   KNOWLEDGE CATEGORIES
   ============================================ */

.knowledge-category {
    margin-bottom: var(--spacing-lg);
    background: linear-gradient(135deg, #1e1e1e 0%, #1a1a1a 100%);
    border: 1px solid #333;
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
}

.knowledge-category:hover {
    border-color: rgba(144, 202, 249, 0.3);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

/* Category Header */
.category-header {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-md);
    background: rgba(0, 0, 0, 0.2);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0.0, 0.2, 1);
}

.category-header:hover {
    background: rgba(144, 202, 249, 0.05);
}

.category-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.category-icon::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, transparent, rgba(255, 255, 255, 0.1));
    opacity: 0;
    transition: opacity 0.3s;
}

.category-header:hover .category-icon::before {
    opacity: 1;
}

.category-icon.authority {
    background: transparent;
    border: 1px solid rgba(144, 202, 249, 0.3);
    box-shadow: none;
}

.category-icon.guidelines {
    background: transparent;
    border: 1px solid rgba(144, 202, 249, 0.3);
    box-shadow: none;
}

.category-icon.design {
    background: transparent;
    border: 1px solid rgba(144, 202, 249, 0.3);
    box-shadow: none;
}

.category-icon.similar {
    background: transparent;
    border: 1px solid rgba(144, 202, 249, 0.3);
    box-shadow: none;
}

.category-icon .material-symbols-outlined {
    font-size: 22px;
    color: #90caf9;
    position: relative;
    z-index: 1;
}

.category-info {
    flex: 1;
}

.category-info h4 {
    font-size: 16px;
    font-weight: 500;
    color: #e0e0e0;
    margin: 0 0 4px 0;
}

.category-count {
    font-size: 12px;
    color: #b0b0b0;
}

.category-toggle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: transparent;
    border: none;
    color: #90caf9;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s cubic-bezier(0.4, 0.0, 0.2, 1);
}

.category-toggle:hover {
    background: rgba(144, 202, 249, 0.1);
    transform: scale(1.1);
}

.category-toggle .material-symbols-outlined {
    font-size: 24px;
    transition: transform 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
}

.knowledge-category.collapsed .category-toggle .material-symbols-outlined {
    transform: rotate(-90deg);
}

/* Category Documents */
.category-documents {
    padding: 4px var(--spacing-md) var(--spacing-md);
    margin-top: 11px;
    max-height: 5000px;
    overflow: hidden;
    opacity: 1;
    transition: max-height 0.4s cubic-bezier(0.4, 0.0, 0.2, 1),
                opacity 0.3s cubic-bezier(0.4, 0.0, 0.2, 1),
                padding 0.3s cubic-bezier(0.4, 0.0, 0.2, 1),
                margin 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
}

.knowledge-category.collapsed .category-documents {
    max-height: 0;
    opacity: 0;
    padding: 0 var(--spacing-md) 0;
}

/* ============================================
   DOCUMENT CARDS
   ============================================ */

.doc-card {
    background: linear-gradient(135deg, #252525 0%, #1e1e1e 100%);
    border: 1px solid #333;
    border-radius: 10px;
    padding: var(--spacing-md);
    margin-bottom: var(--spacing-sm);
    transition: all 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.doc-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(180deg, #90caf9, #2196f3);
    opacity: 0;
    transition: opacity 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
}

.doc-card:hover {
    background: linear-gradient(135deg, #2a2a2a 0%, #252525 100%);
    border-color: rgba(144, 202, 249, 0.4);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
    transform: translateY(-2px);
}

.doc-card:hover::before {
    opacity: 1;
}

/* Document Header */
.doc-header {
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-sm);
}

.doc-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    background: linear-gradient(135deg, rgba(144, 202, 249, 0.15), rgba(33, 150, 243, 0.1));
    border: 1px solid rgba(144, 202, 249, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
}

.doc-card:hover .doc-icon {
    background: linear-gradient(135deg, rgba(144, 202, 249, 0.25), rgba(33, 150, 243, 0.15));
    border-color: rgba(144, 202, 249, 0.4);
    box-shadow: 0 0 16px rgba(144, 202, 249, 0.3);
}

.doc-icon .material-symbols-outlined {
    font-size: 24px;
    color: #90caf9;
}

.doc-info {
    flex: 1;
    min-width: 0;
}

.doc-info h5 {
    font-size: 14px;
    font-weight: 500;
    color: #e0e0e0;
    margin: 0 0 4px 0;
    line-height: 1.4;
}

.doc-meta {
    font-size: 11px;
    color: #888;
    margin: 0;
    line-height: 1.4;
}

/* Relevance Badge */
.relevance-badge {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 500;
    flex-shrink: 0;
    transition: all 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
}

.relevance-badge.high {
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.2), rgba(56, 142, 60, 0.15));
    border: 1px solid rgba(76, 175, 80, 0.3);
    color: #81C784;
}

.relevance-badge.medium {
    background: linear-gradient(135deg, rgba(255, 193, 7, 0.2), rgba(255, 160, 0, 0.15));
    border: 1px solid rgba(255, 193, 7, 0.3);
    color: #FFD54F;
}

.relevance-badge .material-symbols-outlined {
    font-size: 14px;
}

.doc-card:hover .relevance-badge {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Document Preview */
.doc-preview {
    font-size: 12px;
    color: #b0b0b0;
    line-height: 1.6;
    margin-bottom: var(--spacing-md);
    padding-left: 62px;
}

/* Document Actions */
.doc-actions {
    display: flex;
    gap: 4px;
    padding-left: 62px;
    flex-wrap: nowrap;
    align-items: center;
}

.doc-action-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: rgba(144, 202, 249, 0.08);
    border: 1px solid rgba(144, 202, 249, 0.2);
    border-radius: 8px;
    color: #90caf9;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0.0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.doc-action-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    background: rgba(144, 202, 249, 0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%) scale(0);
    transition: transform 0.6s cubic-bezier(0.4, 0.0, 0.2, 1);
}

.doc-action-btn:active::before {
    transform: translate(-50%, -50%) scale(2);
    opacity: 0;
}

.doc-action-btn:hover {
    background: rgba(144, 202, 249, 0.15);
    border-color: rgba(144, 202, 249, 0.4);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(144, 202, 249, 0.2);
}

.doc-action-btn.primary {
    background: rgba(144, 202, 249, 0.08);
    border-color: rgba(144, 202, 249, 0.2);
    color: #90caf9;
}

.doc-action-btn.primary:hover {
    background: rgba(144, 202, 249, 0.15);
    border-color: rgba(144, 202, 249, 0.4);
    box-shadow: 0 4px 12px rgba(144, 202, 249, 0.2);
}

.doc-action-btn .material-symbols-outlined {
    font-size: 16px;
}

.doc-action-btn.icon-only {
    padding: 8px;
    width: 36px;
    height: 36px;
    margin-left: auto;
}

.doc-action-btn.icon-only:first-of-type {
    margin-left: auto;
}

.doc-action-btn.icon-only + .doc-action-btn.icon-only {
    margin-left: 0;
}

/* ============================================
   KNOWLEDGE FOOTER
   ============================================ */

.knowledge-footer {
    padding: var(--spacing-md);
    background-color: #252525;
    border-top: 1px solid #333;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
}

.knowledge-footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, #90caf9 50%, transparent);
    opacity: 0.3;
}

.footer-stats {
    display: flex;
    gap: var(--spacing-lg);
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #b0b0b0;
}

.stat-item .material-symbols-outlined {
    font-size: 16px;
    color: #90caf9;
}

.footer-action {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: rgba(144, 202, 249, 0.1);
    border: 1px solid rgba(144, 202, 249, 0.2);
    border-radius: 8px;
    color: #90caf9;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0.0, 0.2, 1);
}

.footer-action:hover {
    background: rgba(144, 202, 249, 0.2);
    border-color: rgba(144, 202, 249, 0.4);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(144, 202, 249, 0.3);
}

.footer-action .material-symbols-outlined {
    font-size: 18px;
}

/* ============================================
   SCROLLBAR STYLING
   ============================================ */

.knowledge-content::-webkit-scrollbar {
    width: 8px;
}

.knowledge-content::-webkit-scrollbar-track {
    background: #1a1a1a;
}

.knowledge-content::-webkit-scrollbar-thumb {
    background: #444;
    border-radius: 4px;
}

.knowledge-content::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* ============================================
   ANIMATIONS
   ============================================ */

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.doc-card {
    animation: slideIn 0.3s cubic-bezier(0.4, 0.0, 0.2, 1) backwards;
}

.doc-card:nth-child(1) { animation-delay: 0.05s; }
.doc-card:nth-child(2) { animation-delay: 0.1s; }
.doc-card:nth-child(3) { animation-delay: 0.15s; }
.doc-card:nth-child(4) { animation-delay: 0.2s; }
.doc-card:nth-child(5) { animation-delay: 0.25s; }

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
    .doc-preview,
    .doc-actions {
        padding-left: 0;
    }
    
    .doc-actions {
        flex-direction: column;
    }
    
    .doc-action-btn {
        width: 100%;
        justify-content: center;
    }
}
