/* Week 16 Task 2: Knowledge Browser Styles */

.knowledge-browser {
    padding: 20px;
    max-width: 1200px;
    margin: 0 auto;
}

.knowledge-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.knowledge-header h2 {
    margin: 0;
    font-size: 1.8em;
    color: #2c3e50;
}

.knowledge-tabs {
    display: flex;
    gap: 8px;
}

.knowledge-tab {
    padding: 10px 20px;
    border: 2px solid #e0e0e0;
    background: white;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.95em;
    font-weight: 600;
    transition: all 0.2s;
}

.knowledge-tab:hover {
    border-color: #667eea;
    background: #f8f9ff;
}

.knowledge-tab.active {
    border-color: #667eea;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.knowledge-filters {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
}

.knowledge-search {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 0.95em;
    transition: border-color 0.2s;
}

.knowledge-search:focus {
    outline: none;
    border-color: #667eea;
}

.knowledge-domain-filter {
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 0.95em;
    background: white;
    cursor: pointer;
    min-width: 180px;
}

.knowledge-list {
    display: grid;
    gap: 16px;
}

.knowledge-item {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: 20px;
    transition: all 0.2s;
}

.knowledge-item:hover {
    border-color: #667eea;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
    transform: translateY(-2px);
}

.knowledge-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.knowledge-item-header h3 {
    margin: 0;
    font-size: 1.2em;
    color: #2c3e50;
}

.item-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.btn-icon {
    background: none;
    border: none;
    font-size: 1.2em;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: all 0.2s;
}

.btn-icon:hover {
    background: #ecf0f1;
    transform: scale(1.1);
}

.btn-icon.btn-delete:hover {
    background: #fee;
}

.confidence-badge {
    padding: 4px 12px;
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    color: white;
    border-radius: 12px;
    font-size: 0.85em;
    font-weight: 600;
}

.knowledge-item-meta {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
    font-size: 0.9em;
    color: #7f8c8d;
}

.domain-tag, .date-tag {
    padding: 4px 10px;
    background: #ecf0f1;
    border-radius: 6px;
}

.usage-count {
    padding: 4px 10px;
    background: #e8f5e9;
    color: #2e7d32;
    border-radius: 6px;
    font-weight: 600;
}

.knowledge-item-description {
    margin: 0;
    line-height: 1.6;
    color: #34495e;
}

.knowledge-empty, .knowledge-error {
    text-align: center;
    padding: 60px 20px;
}

.empty-icon, .error-icon {
    font-size: 4em;
    margin-bottom: 16px;
}

.knowledge-empty h3, .knowledge-error h3 {
    margin: 0 0 8px 0;
    color: #7f8c8d;
}

.knowledge-empty p, .knowledge-error p {
    margin: 0 0 20px 0;
    color: #95a5a6;
}

.knowledge-error button {
    padding: 10px 24px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.95em;
    font-weight: 600;
}

.knowledge-error button:hover {
    background: #5568d3;
}

/* Add Lesson Button */
.btn-add-lesson {
    padding: 10px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.95em;
    font-weight: 600;
    transition: all 0.2s;
}

.btn-add-lesson:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

/* Modal */
.knowledge-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 10000;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.knowledge-modal-content {
    background: white;
    border-radius: 16px;
    padding: 0;
    max-width: 480px;
    width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.knowledge-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #e0e0e0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 16px 16px 0 0;
}

.knowledge-modal-header h3 {
    margin: 0;
    font-size: 1.2em;
    color: white;
}

.modal-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    font-size: 1.5em;
    color: white;
    cursor: pointer;
    line-height: 1;
    padding: 4px;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    transition: all 0.2s;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

#addLessonForm,
#addSkillForm {
    padding: 24px;
}

.form-group {
    margin-bottom: 18px;
}

.form-group:last-of-type {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 0.9em;
    color: #2c3e50;
}

.form-group textarea,
.form-group input,
.form-group select {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 0.95em;
    font-family: inherit;
    transition: all 0.2s;
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.form-group textarea:focus,
.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    padding-top: 8px;
}

.btn-cancel,
.btn-submit {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.95em;
    font-weight: 600;
    transition: all 0.2s;
}

.btn-cancel {
    background: #ecf0f1;
    color: #7f8c8d;
}

.btn-cancel:hover {
    background: #bdc3c7;
    color: #2c3e50;
}

.btn-submit {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    min-width: 100px;
}

.btn-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

/* Success Message */
.success-message {
    position: fixed;
    top: 20px;
    right: 20px;
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    color: white;
    padding: 16px 24px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(17, 153, 142, 0.3);
    z-index: 10001;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .knowledge-browser {
        color: #ecf0f1;
    }
    
    .knowledge-header h2 {
        color: #ecf0f1;
    }
    
    .knowledge-tab {
        background: #2c3e50;
        border-color: #34495e;
        color: #ecf0f1;
    }
    
    .knowledge-tab:hover {
        background: #34495e;
    }
    
    .knowledge-item {
        background: #2c3e50;
        border-color: #34495e;
    }
    
    .knowledge-item-header h3 {
        color: #ecf0f1;
    }
    
    .knowledge-search, .knowledge-domain-filter {
        background: #2c3e50;
        border-color: #34495e;
        color: #ecf0f1;
    }

    .knowledge-modal-content {
        background: #2c3e50;
    }

    .knowledge-modal-header {
        border-bottom-color: #34495e;
    }

    .form-group label {
        color: #ecf0f1;
    }

    .form-group textarea,
    .form-group input,
    .form-group select {
        background: #34495e;
        border-color: #4a5f7f;
        color: #ecf0f1;
    }

    .form-group textarea:focus,
    .form-group input:focus,
    .form-group select:focus {
        border-color: #667eea;
        box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
    }

    .btn-cancel {
        background: #34495e;
        color: #ecf0f1;
    }

    .btn-cancel:hover {
        background: #4a5f7f;
    }

    .btn-icon:hover {
        background: #34495e;
    }

    .btn-icon.btn-delete:hover {
        background: #5a2a2a;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .knowledge-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }
    
    .knowledge-filters {
        flex-direction: column;
    }
    
    .knowledge-domain-filter {
        width: 100%;
    }
}
