/* ===========================
   Knowledge Base Page Styles
   =========================== */

:root {
    --primary-color: #0aa026;
    --primary-dark: #088a1f;
    --dark-bg: #0a192f;
    --card-bg: #0f2a48;
    --text-light: #e0e0e0;
    --text-muted: #9ca3af;
    --border-color: rgba(255, 255, 255, 0.1);
}

body.light {
    --primary-color: #0aa026;
    --dark-bg: #f5f7fa;
    --card-bg: #ffffff;
    --text-light: #1f2937;
    --text-muted: #6b7280;
    --border-color: rgba(0, 0, 0, 0.1);
}

/* ===========================
   Knowledge Base Section
   =========================== */

.knowledge-base-section {
    padding: 100px 0;
    background: linear-gradient(135deg, var(--dark-bg) 0%, #0c2642 100%);
    min-height: 100vh;
}

body.light .knowledge-base-section {
    background: linear-gradient(135deg, #f5f7fa 0%, #e9ecef 100%);
}

/* ===========================
   Hero Section
   =========================== */

.kb-hero {
    text-align: center;
    margin-bottom: 60px;
    animation: fadeInDown 0.8s ease;
}

.kb-hero h1 {
    font-size: 3.5rem;
    font-weight: 800;
    color: var(--text-light);
    margin-bottom: 20px;
    letter-spacing: -1px;
}

.kb-hero p {
    font-size: 1.3rem;
    color: var(--text-muted);
    margin-bottom: 40px;
    font-weight: 400;
}

/* ===========================
   Search Bar
   =========================== */

.kb-search-wrapper {
    position: relative;
    max-width: 600px;
    margin: 0 auto;
    animation: fadeInUp 0.8s ease 0.2s both;
}

.kb-search-input {
    width: 100%;
    padding: 16px 20px 16px 50px;
    font-size: 1rem;
    border: 2px solid var(--border-color);
    border-radius: 50px;
    background: var(--card-bg);
    color: var(--text-light);
    transition: all 0.3s ease;
}

.kb-search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 20px rgba(10, 160, 38, 0.3);
}

.kb-search-wrapper i {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
    font-size: 1.1rem;
}

/* Search Results Dropdown */
.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-top: none;
    border-radius: 0 0 12px 12px;
    max-height: 400px;
    overflow-y: auto;
    display: none;
    z-index: 100;
    margin-top: -2px;
}

.search-results.active {
    display: block;
}

.search-result-item {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: all 0.2s ease;
}

.search-result-item:hover {
    background: rgba(10, 160, 38, 0.1);
    padding-left: 25px;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-title {
    font-weight: 600;
    color: var(--text-light);
    font-size: 0.95rem;
}

.search-result-category {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 3px;
}

/* ===========================
   Categories Section
   =========================== */

.kb-categories {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    margin-bottom: 60px;
    animation: fadeInUp 0.8s ease 0.3s both;
}

.category-btn {
    padding: 12px 24px;
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    color: var(--text-muted);
    border-radius: 25px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.category-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.category-btn.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.category-btn i {
    font-size: 1rem;
}

@media (max-width: 768px) {
    .kb-categories {
        gap: 8px;
    }
    
    .category-btn {
        padding: 10px 16px;
        font-size: 0.85rem;
    }
    
    .category-btn i {
        display: none;
    }
}

/* ===========================
   Articles Grid
   =========================== */

#articles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 30px;
    margin-bottom: 80px;
}

/* ===========================
   Article Cards
   =========================== */

.kb-article {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    animation: fadeInUp 0.6s ease forwards;
    animation-fill-mode: both;
}

.kb-article:nth-child(1) { animation-delay: 0.1s; }
.kb-article:nth-child(2) { animation-delay: 0.15s; }
.kb-article:nth-child(3) { animation-delay: 0.2s; }
.kb-article:nth-child(4) { animation-delay: 0.25s; }
.kb-article:nth-child(5) { animation-delay: 0.3s; }
.kb-article:nth-child(6) { animation-delay: 0.35s; }
.kb-article:nth-child(n+7) { animation-delay: 0.4s; }

/* Article Header (Clickable) */
.article-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.article-header:hover {
    background: rgba(10, 160, 38, 0.05);
}

.kb-article.active .article-header {
    background: rgba(10, 160, 38, 0.1);
    border-bottom: 2px solid var(--primary-color);
}

/* Article Title Wrapper */
.article-title-wrapper {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    flex: 1;
}

/* Article Icon */
.article-icon {
    font-size: 2rem;
    color: var(--primary-color);
    flex-shrink: 0;
    transition: transform 0.3s ease;
    margin-top: 2px;
}

.kb-article:hover .article-icon {
    transform: scale(1.1);
}

.kb-article.active .article-icon {
    transform: scale(1.15);
}

/* Article Title Content */
.article-title-content {
    flex: 1;
}

.kb-article h3 {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-light);
    margin-bottom: 8px;
    line-height: 1.4;
    transition: color 0.3s ease;
}

.kb-article:hover h3 {
    color: var(--primary-color);
}

.kb-article.active h3 {
    color: var(--primary-color);
}

/* Article Preview */
.article-preview {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin: 0;
    line-height: 1.5;
}

/* Article Toggle Icon */
.article-toggle {
    font-size: 1.2rem;
    color: var(--text-muted);
    transition: all 0.3s ease;
    margin-left: 20px;
    flex-shrink: 0;
}

.kb-article.active .article-toggle {
    transform: rotate(180deg);
    color: var(--primary-color);
}

/* Article Content (Hidden by default) */
.article-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease, padding 0.4s ease;
    padding: 0 25px;
}

.kb-article.active .article-content {
    max-height: 2000px;
    padding: 25px;
    border-top: 1px solid var(--border-color);
}

/* Article Meta */
.article-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.85rem;
}

.article-time {
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 5px;
}

.article-time::before {
    content: '⏱';
}

.article-level {
    background: rgba(10, 160, 38, 0.1);
    color: var(--primary-color);
    padding: 4px 12px;
    border-radius: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.article-level.intermediate {
    background: rgba(255, 165, 0, 0.1);
    color: #ffa500;
}

.article-level.advanced {
    background: rgba(255, 68, 68, 0.1);
    color: #ff4444;
}

/* Article Body Content */
.article-body {
    color: var(--text-muted);
    line-height: 1.8;
    font-size: 0.95rem;
}

.article-body p {
    margin-bottom: 15px;
}

.article-body h4 {
    color: var(--text-light);
    font-size: 1.05rem;
    font-weight: 700;
    margin-top: 20px;
    margin-bottom: 12px;
}

.article-body h4:first-child {
    margin-top: 0;
}

.article-body ul,
.article-body ol {
    margin-bottom: 15px;
    margin-left: 20px;
}

.article-body li {
    margin-bottom: 10px;
}

.article-body strong {
    color: var(--primary-color);
    font-weight: 700;
}

/* Hidden articles */
.kb-article.hidden {
    display: none !important;
}

/* ===========================
   CTA Section
   =========================== */

.kb-cta {
    text-align: center;
    padding: 60px 40px;
    background: linear-gradient(135deg, rgba(10, 160, 38, 0.15) 0%, rgba(10, 160, 38, 0.05) 100%);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    animation: fadeInUp 0.8s ease;
}

.kb-cta h2 {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--text-light);
    margin-bottom: 20px;
}

.kb-cta p {
    font-size: 1.2rem;
    color: var(--text-muted);
    margin-bottom: 30px;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.kb-cta .btn-lg {
    padding: 16px 40px;
    font-size: 1.1rem;
    font-weight: 700;
    transition: all 0.3s ease;
}

.kb-cta .btn-lg:hover {
    transform: scale(1.05);
}

/* ===========================
   Animations
   =========================== */

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===========================
   Responsive Design
   =========================== */

@media (max-width: 768px) {
    .knowledge-base-section {
        padding: 60px 0;
    }
    
    .kb-hero h1 {
        font-size: 2.2rem;
    }
    
    .kb-hero p {
        font-size: 1.1rem;
        margin-bottom: 30px;
    }
    
    .kb-search-input {
        font-size: 0.95rem;
        padding: 14px 18px 14px 45px;
    }
    
    .kb-categories {
        margin-bottom: 40px;
    }
    
    #articles-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 20px;
        margin-bottom: 50px;
    }
    
    .kb-article {
        padding: 25px;
    }
    
    .article-icon {
        font-size: 2rem;
        margin-bottom: 15px;
    }
    
    .kb-article h3 {
        font-size: 1.1rem;
    }
    
    .kb-article p {
        font-size: 0.9rem;
    }
    
    .article-meta {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }
    
    .kb-cta {
        padding: 40px 25px;
    }
    
    .kb-cta h2 {
        font-size: 1.8rem;
    }
    
    .kb-cta p {
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .knowledge-base-section {
        padding: 40px 0;
    }
    
    .kb-hero h1 {
        font-size: 1.8rem;
    }
    
    .kb-hero p {
        font-size: 1rem;
    }
    
    .kb-search-input {
        font-size: 0.9rem;
    }
    
    #articles-grid {
        grid-template-columns: 1fr;
        gap: 15px;
        margin-bottom: 40px;
    }
    
    .kb-article {
        padding: 20px;
    }
    
    .article-icon {
        font-size: 1.8rem;
    }
    
    .kb-article h3 {
        font-size: 1rem;
    }
    
    .kb-article p {
        font-size: 0.85rem;
        margin-bottom: 15px;
    }
    
    .kb-cta {
        padding: 30px 15px;
    }
    
    .kb-cta h2 {
        font-size: 1.5rem;
    }
    
    .kb-cta p {
        font-size: 0.95rem;
    }
}
