* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --primary: #282A65;
    --secondary: #902891;
    --text: #1a1a1a;
    --text-light: #666;
    --bg: #f8f9fa;
    --white: #fff;
    --border: #e5e5e5;
    --radius: 8px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--text);
    background: var(--bg);
    line-height: 1.6;
    font-size: 15px;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--secondary); }

/* Header */
.header {
    background: var(--white);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    max-width: var(--header-width, 1140px);
    margin: 0 auto;
    padding: 0 24px;
    height: 64px;
    display: flex;
    align-items: center;
    gap: 40px;
}

.logo { font-weight: 600; font-size: 17px; color: var(--text); }
.logo img { height: var(--logo-height, 36px); }

.nav { display: flex; gap: 32px; flex: 1; }
.nav > a, .nav-dropdown > a { color: var(--text-light); font-size: 14px; }
.nav > a:hover, .nav-dropdown:hover > a { color: var(--text); }

.nav-dropdown { position: relative; }
.dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: -12px;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 8px 0;
    min-width: 180px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    transition: all .2s;
    box-shadow: 0 8px 30px rgba(0,0,0,.1);
}
.nav-dropdown:hover .dropdown-menu { opacity: 1; visibility: visible; transform: translateY(0); }
.dropdown-menu a { display: block; padding: 10px 16px; color: var(--text); font-size: 14px; }
.dropdown-menu a:hover { background: var(--bg); }

.search-box { position: relative; }
.search-box input {
    width: var(--search-width, 220px);
    padding: 9px 16px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    background: var(--bg);
}
.search-box input:focus { outline: none; border-color: var(--primary); background: var(--white); }
.search-results {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    width: var(--search-results-width, 340px);
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 8px 30px rgba(0,0,0,.12);
    display: none;
}
.search-results a { display: block; padding: 14px 16px; border-bottom: 1px solid var(--border); color: var(--text); font-size: 14px; }
.search-results a strong { display: block; font-weight: 500; margin-bottom: 4px; }
.search-results a strong mark { background: #fef08a; padding: 0 2px; border-radius: 2px; }
.search-results a span { display: block; font-size: 13px; color: var(--text-light); line-height: 1.4; }
.search-results a span mark { background: #fef08a; padding: 0 2px; }
.search-results a:last-child { border-bottom: none; }
.search-results a:hover { background: var(--bg); }
.search-results .no-results { display: block; padding: 20px; color: var(--text-light); text-align: center; }

/* Section Alt */
.section-alt { background: var(--white); margin: 0 -24px; padding: 48px 48px; }

/* Article Category Badge */
.article-category-badge { font-size: 12px; color: var(--secondary); background: rgba(144,40,145,.1); padding: 6px 12px; border-radius: 4px; white-space: nowrap; }

/* Page Header */
.page-header {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    padding: 48px 24px;
    color: var(--white);
}
.page-header-inner { max-width: var(--page-width, 1140px); margin: 0 auto; }
.page-header .breadcrumb { margin-bottom: 16px; opacity: .8; }
.page-header .breadcrumb a { color: var(--white); }
.page-header .breadcrumb span { color: rgba(255,255,255,0.7); }
.page-header h1 { font-size: 32px; font-weight: 600; margin-bottom: 12px; }
.page-header p { opacity: .9; font-size: 16px; }
.page-header-meta { 
    display: flex; 
    flex-wrap: wrap;
    gap: 20px; 
    font-size: 14px; 
    opacity: 0.85;
    margin-top: 8px;
}
.page-header-meta span { display: flex; align-items: center; gap: 6px; }
.page-header-meta i { font-size: 15px; }

/* Hero */
.hero {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    padding: 64px 24px;
    text-align: center;
    color: var(--white);
}
.hero h1 { font-size: 30px; font-weight: 600; margin-bottom: 12px; }
.hero p { opacity: .9; margin-bottom: 28px; font-size: 16px; }
.hero-search { max-width: var(--hero-search-width, 520px); margin: 0 auto; position: relative; }
.hero-search input {
    width: 100%;
    padding: 16px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    box-shadow: 0 4px 20px rgba(0,0,0,.15);
}
.hero-search input:focus { outline: none; }
.hero-results {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    text-align: left;
    border-radius: var(--radius);
}
.hero-results a { display: flex; flex-direction: column; gap: 4px; }
.hero-results a strong { font-weight: 500; }
.hero-results a span { font-size: 13px; color: var(--text-light); }
.hero-results a span mark { background: #fef08a; padding: 0 2px; }

/* Content Layout */
.content-layout {
    max-width: var(--page-width, 1140px);
    margin: 0 auto;
    padding: 40px 24px;
    display: grid;
    grid-template-columns: 1fr var(--sidebar-width, 300px);
    gap: 48px;
}

.content-main { min-width: 0; }

/* Breadcrumb */
.breadcrumb { font-size: 13px; color: var(--text-light); margin-bottom: 24px; }
.breadcrumb a { color: var(--text-light); }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb span { margin: 0 6px; }

/* Section */
.section { max-width: var(--page-width, 1140px); margin: 0 auto; padding: 48px 24px; }
.section-title { font-size: 20px; font-weight: 600; margin-bottom: 24px; }

/* Categories Grid */
.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 24px;
}

/* Base Card Styles */
.category-card {
    background: var(--white);
    border-radius: 12px;
    border: 1px solid var(--border);
    transition: all .3s ease;
    position: relative;
    overflow: hidden;
    display: flex;
    text-decoration: none;
}
.category-card:hover { text-decoration: none; }
.card-icon { 
    font-size: 24px; 
    color: var(--primary);
    flex-shrink: 0;
}
.card-content { flex: 1; min-width: 0; }
.category-card h3 { 
    font-size: 17px; 
    margin: 0 0 8px 0; 
    color: var(--text);
    font-weight: 600;
}
.category-card p { 
    font-size: 14px; 
    color: var(--text-light); 
    margin: 0 0 12px 0; 
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.card-count { 
    font-size: 13px; 
    color: var(--text-light);
    font-weight: 500;
}

/* ========== STYLE 1: MINIMAL ========== */
[data-style="minimal"] .category-card {
    padding: 24px;
    flex-direction: column;
    gap: 0;
}
[data-style="minimal"] .card-icon {
    width: 48px;
    height: 48px;
    background: var(--bg);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    font-size: 22px;
}
[data-style="minimal"] .category-card:hover {
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
[data-style="minimal"] .card-count {
    color: var(--primary);
}

/* ========== STYLE 2: GRADIENT ========== */
[data-style="gradient"] .category-card {
    padding: 24px;
    flex-direction: column;
    border-top: 4px solid transparent;
    border-image: linear-gradient(90deg, var(--primary), var(--secondary)) 1;
}
[data-style="gradient"] .card-icon {
    width: 52px;
    height: 52px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    color: white;
    font-size: 24px;
}
[data-style="gradient"] .category-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 32px rgba(40, 42, 101, 0.15);
}
[data-style="gradient"] .card-count {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
}

/* ========== STYLE 3: ICON (Large Icon) ========== */
[data-style="icon"] .category-card {
    padding: 32px 24px;
    flex-direction: column;
    text-align: center;
    align-items: center;
}
[data-style="icon"] .card-icon {
    width: 72px;
    height: 72px;
    background: linear-gradient(135deg, rgba(40,42,101,0.08), rgba(144,40,145,0.08));
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    font-size: 32px;
    transition: all .3s ease;
}
[data-style="icon"] .category-card:hover .card-icon {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    transform: scale(1.1);
}
[data-style="icon"] .category-card:hover {
    border-color: transparent;
    box-shadow: 0 8px 30px rgba(0,0,0,0.1);
}
[data-style="icon"] .card-content { text-align: center; }
[data-style="icon"] .card-count {
    background: var(--bg);
    padding: 6px 14px;
    border-radius: 20px;
}

/* ========== STYLE 4: BORDERED (Left Border) ========== */
[data-style="bordered"] .category-card {
    padding: 20px 24px;
    flex-direction: row;
    align-items: flex-start;
    gap: 16px;
    border-left: 4px solid var(--primary);
    border-radius: 0 12px 12px 0;
}
[data-style="bordered"] .card-icon {
    width: 44px;
    height: 44px;
    background: rgba(40,42,101,0.06);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}
[data-style="bordered"] .category-card:hover {
    border-left-color: var(--secondary);
    background: linear-gradient(90deg, rgba(40,42,101,0.02), transparent);
    box-shadow: 0 4px 16px rgba(0,0,0,0.06);
}
[data-style="bordered"] h3 { margin-bottom: 6px; }
[data-style="bordered"] p { margin-bottom: 8px; }
[data-style="bordered"] .card-count {
    font-size: 12px;
    color: var(--secondary);
    font-weight: 600;
}

/* ========== STYLE 5: ELEVATED (Floating Cards) ========== */
[data-style="elevated"] .category-card {
    padding: 28px;
    flex-direction: column;
    border: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06), 0 8px 24px rgba(0,0,0,0.04);
}
[data-style="elevated"] .card-icon {
    width: 56px;
    height: 56px;
    background: white;
    border: 2px solid var(--border);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 18px;
    font-size: 26px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.04);
}
[data-style="elevated"] .category-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 40px rgba(0,0,0,0.12), 0 4px 12px rgba(0,0,0,0.06);
}
[data-style="elevated"] .category-card:hover .card-icon {
    border-color: var(--primary);
    color: var(--secondary);
}
[data-style="elevated"] .card-count {
    background: var(--bg);
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 12px;
}

/* ========== STYLE 6: GLASS (Glassmorphism) ========== */
[data-style="glass"] .categories-grid {
    background: linear-gradient(135deg, rgba(40,42,101,0.03), rgba(144,40,145,0.03));
    padding: 30px;
    border-radius: 20px;
    margin: -10px;
}
[data-style="glass"] .category-card {
    padding: 24px;
    flex-direction: column;
    background: rgba(255,255,255,0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.8);
}
[data-style="glass"] .card-icon {
    width: 50px;
    height: 50px;
    background: rgba(255,255,255,0.9);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    font-size: 24px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}
[data-style="glass"] .category-card:hover {
    background: rgba(255,255,255,0.9);
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(40,42,101,0.12);
}
[data-style="glass"] .category-card:hover .card-icon {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
}
[data-style="glass"] .card-count {
    background: rgba(40,42,101,0.08);
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    color: var(--primary);
}

/* Articles List */
.articles-list { display: flex; flex-direction: column; gap: 12px; }

.article-item {
    background: var(--white);
    padding: 20px 24px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    transition: all .2s;
}
.article-item:hover { border-color: var(--primary); }

.article-item-content { flex: 1; min-width: 0; }
.article-item h3 { font-size: 16px; font-weight: 500; color: var(--text); margin-bottom: 6px; }
.article-item p { font-size: 14px; color: var(--text-light); line-height: 1.5; margin-bottom: 8px; }
.article-item-meta { font-size: 13px; color: var(--text-light); display: flex; gap: 16px; }

/* Article Header */
.article-header { margin-bottom: 32px; }
.article-header h1 { font-size: 32px; font-weight: 600; line-height: 1.3; margin-bottom: 16px; }
.article-meta { font-size: 14px; color: var(--text-light); display: flex; flex-wrap: wrap; gap: 16px; align-items: center; }
.article-category { background: rgba(144,40,145,.1); color: var(--secondary); padding: 4px 12px; border-radius: 4px; font-size: 13px; }

/* Article Card Container */
.article-card {
    background: var(--white);
    border-radius: 16px;
    border: 1px solid var(--border);
    box-shadow: 0 4px 20px rgba(0,0,0,0.04);
    overflow: hidden;
}

/* Article Content */
.article-content {
    padding: 48px;
    line-height: 1.8;
    font-size: 16px;
}

.article-content h2 { 
    font-size: 24px; 
    margin: 48px 0 20px; 
    padding-top: 32px; 
    border-top: 1px solid var(--border);
    color: var(--primary);
}
.article-content h2:first-child { margin-top: 0; padding-top: 0; border-top: none; }
.article-content h3 { font-size: 19px; margin: 36px 0 14px; color: var(--text); }
.article-content p { margin-bottom: 18px; color: #444; }
.article-content ul, .article-content ol { margin: 20px 0; padding-left: 28px; }
.article-content li { margin-bottom: 10px; color: #444; }
.article-content pre { 
    background: linear-gradient(135deg, #1a1a2e, #16213e); 
    color: #e0e0e0; 
    padding: 24px; 
    border-radius: 12px; 
    overflow-x: auto; 
    margin: 28px 0; 
    font-size: 14px; 
    line-height: 1.6;
    box-shadow: inset 0 2px 10px rgba(0,0,0,0.3);
}
.article-content code { 
    background: linear-gradient(135deg, rgba(40,42,101,0.08), rgba(144,40,145,0.08)); 
    padding: 3px 8px; 
    border-radius: 6px; 
    font-size: 14px;
    color: var(--primary);
}
.article-content pre code { background: none; padding: 0; color: #e0e0e0; }
.article-content img { max-width: 100%; border-radius: 12px; margin: 28px 0; box-shadow: 0 4px 20px rgba(0,0,0,0.1); }
.article-content blockquote { 
    border-left: 4px solid var(--secondary); 
    padding: 20px 24px; 
    margin: 28px 0; 
    background: linear-gradient(90deg, rgba(144,40,145,0.05), transparent);
    border-radius: 0 12px 12px 0;
    color: var(--text-light); 
    font-style: italic; 
}
.article-content table { width: 100%; border-collapse: collapse; margin: 28px 0; border-radius: 12px; overflow: hidden; }
.article-content th, .article-content td { padding: 14px 16px; border: 1px solid var(--border); text-align: left; }
.article-content th { background: linear-gradient(135deg, var(--primary), var(--secondary)); color: white; font-weight: 600; }
.article-content a { color: var(--primary); text-decoration: none; border-bottom: 1px dashed var(--primary); }
.article-content a:hover { color: var(--secondary); border-bottom-color: var(--secondary); }

/* Article Tags */
.article-tags { 
    padding: 24px 48px; 
    border-top: 1px solid var(--border);
    display: flex; 
    align-items: center;
    gap: 12px; 
    flex-wrap: wrap;
    background: var(--bg);
}
.article-tags > i { color: var(--text-light); font-size: 16px; }
.tag { 
    background: var(--white); 
    padding: 8px 16px; 
    border-radius: 20px; 
    font-size: 13px; 
    color: var(--text-light);
    border: 1px solid var(--border);
    transition: all .2s;
}
.tag:hover { 
    background: linear-gradient(135deg, var(--primary), var(--secondary)); 
    color: var(--white);
    border-color: transparent;
    transform: translateY(-2px);
}

/* Article Feedback */
.article-feedback { 
    background: linear-gradient(135deg, rgba(40,42,101,0.03), rgba(144,40,145,0.03));
    padding: 32px 48px; 
    text-align: center;
    border-top: 1px solid var(--border);
}
.article-feedback p { font-weight: 600; margin-bottom: 18px; color: var(--text); }
.feedback-buttons { display: flex; gap: 16px; justify-content: center; }
.btn-feedback { 
    padding: 12px 28px; 
    border: none; 
    border-radius: 10px; 
    cursor: pointer; 
    font-size: 14px; 
    font-weight: 600; 
    transition: all .2s;
    display: flex;
    align-items: center;
    gap: 8px;
}
.btn-helpful { background: linear-gradient(135deg, var(--primary), var(--secondary)); color: var(--white); }
.btn-helpful:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(40,42,101,0.3); }
.btn-not-helpful { background: var(--white); color: var(--text); border: 1px solid var(--border); }
.btn-not-helpful:hover { background: var(--bg); }
.btn-feedback:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.feedback-message { margin-top: 16px; font-size: 14px; font-weight: 500; }
.feedback-message.success { color: #059669; }

/* Sidebar */
.content-sidebar { display: flex; flex-direction: column; gap: 24px; }

.sidebar-widget {
    background: var(--white);
    padding: 24px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}
.sidebar-widget h3 { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; color: var(--text-light); margin-bottom: 16px; }

/* TOC - Table of Contents */
.toc { display: flex; flex-direction: column; gap: 2px; position: relative; }
.toc a { 
    display: block; 
    padding: 8px 12px; 
    color: var(--text-light); 
    font-size: 14px; 
    border-left: 2px solid var(--border); 
    transition: all 0.2s ease;
    line-height: 1.4;
}
.toc a:hover { 
    color: var(--primary); 
    border-color: var(--primary);
    background: rgba(40, 42, 101, 0.03);
}
.toc a.active { 
    color: var(--primary); 
    border-color: var(--primary);
    background: rgba(40, 42, 101, 0.05);
    font-weight: 500;
}
.toc a.toc-h3 { 
    padding-left: 24px; 
    font-size: 13px;
}
.toc a.toc-h3.active {
    font-weight: 500;
}

/* TOC sticky on desktop */
@media (min-width: 1024px) {
    #tocWidget {
        position: sticky;
        top: 88px;
    }
}

/* Sidebar Categories */
.sidebar-categories { list-style: none; }
.sidebar-categories li { border-bottom: 1px solid var(--border); }
.sidebar-categories li:last-child { border-bottom: none; }
.sidebar-categories a { display: flex; justify-content: space-between; padding: 12px 0; color: var(--text); font-size: 14px; }
.sidebar-categories a:hover { color: var(--primary); }
.sidebar-categories .count { color: var(--text-light); font-size: 12px; background: var(--bg); padding: 2px 8px; border-radius: 10px; }
.sidebar-categories li.active a { color: var(--primary); font-weight: 500; }

/* Sidebar Articles */
.sidebar-articles { list-style: none; }
.sidebar-articles li { padding: 10px 0; border-bottom: 1px solid var(--border); }
.sidebar-articles li:last-child { border-bottom: none; }
.sidebar-articles a { color: var(--text); font-size: 14px; line-height: 1.4; }
.sidebar-articles a:hover { color: var(--primary); }

/* Empty State */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-light); }
.empty-state p { margin-bottom: 16px; }

/* Footer */
.footer {
    background: var(--footer-bg, var(--white));
    border-top: var(--footer-border, 1px solid var(--border));
    padding: 40px 24px;
    text-align: center;
    font-size: 14px;
    color: var(--footer-text, var(--text-light));
    margin-top: 48px;
}
.footer a { color: var(--footer-link, var(--primary)); }
.footer a:hover { color: var(--footer-link-hover, var(--secondary)); opacity: 0.8; }
.footer-inner { max-width: var(--page-width, 1140px); margin: 0 auto; }
.footer-links { display: flex; justify-content: center; gap: 24px; margin-bottom: 16px; flex-wrap: wrap; }
.footer-links a { font-weight: 500; }

/* Responsive */
@media (max-width: 900px) {
    .content-layout { grid-template-columns: 1fr; gap: 32px; }
    .content-sidebar { order: -1; }
}

@media (max-width: 640px) {
    .header-inner { gap: 16px; }
    .nav { display: none; }
    .search-box input { width: 160px; }
    .hero { padding: 48px 20px; }
    .hero h1 { font-size: 24px; }
    .page-header { padding: 32px 20px; }
    .page-header h1 { font-size: 26px; }
    .page-header-meta { gap: 12px; font-size: 13px; }
    .article-header h1 { font-size: 26px; }
    .article-content { padding: 24px; }
    .article-tags { padding: 20px 24px; }
    .article-feedback { padding: 24px; }
    .feedback-buttons { flex-direction: column; }
    .btn-feedback { width: 100%; justify-content: center; }
    .section { padding: 32px 20px; }
    .footer-links { gap: 16px; }
}
