/* ============================================
   JBDON Premium Theme v6.0 - Navy + Gold
   ============================================ */

:root {
    --primary: #0a1628;
    --primary-light: #1a2d4a;
    --accent: #c9a962;
    --accent-light: #dfc07f;
    --accent-dark: #b08d3e;
    --white: #ffffff;
    --cream: #faf9f7;
    --gray-50: #f8f9fa;
    --gray-100: #f1f2f4;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --font-display: 'Playfair Display', Georgia, serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --nav-height: 72px;
    --sidebar-width: 280px;
    --container-max: 1280px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 12px 32px rgba(0,0,0,0.12);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.6;
    color: var(--gray-700);
    background: var(--cream);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 600; color: var(--gray-900); line-height: 1.2; }
h1 { font-size: 2.5rem; }
h2 { font-size: 1.75rem; }
h3 { font-size: 1.25rem; }
a { color: inherit; text-decoration: none; }

/* Header */
.header {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 1000;
    background: var(--primary);
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
.header-inner {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 24px;
    height: var(--nav-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.logo { font-family: var(--font-display); font-size: 1.5rem; font-weight: 700; color: var(--white); letter-spacing: 2px; }
.logo span { color: var(--accent); }

.main-nav { display: flex; align-items: center; gap: 4px; }
.nav-item { position: relative; }
.nav-link {
    display: flex; align-items: center; gap: 4px;
    padding: 8px 14px;
    color: rgba(255,255,255,0.85);
    font-size: 0.85rem; font-weight: 500;
    border-radius: 6px;
    transition: all 0.2s;
    cursor: pointer;
}
.nav-link:hover { color: var(--white); background: rgba(255,255,255,0.1); }
.nav-link svg { width: 12px; height: 12px; opacity: 0.7; transition: transform 0.2s; }
.nav-item:hover .nav-link svg { transform: rotate(180deg); }

.header-actions { display: flex; align-items: center; gap: 8px; }
.search-btn {
    width: 40px; height: 40px;
    display: flex; align-items: center; justify-content: center;
    background: rgba(255,255,255,0.1);
    border: none; border-radius: 8px;
    color: var(--white); cursor: pointer;
    transition: all 0.2s;
}
.search-btn:hover { background: rgba(255,255,255,0.15); }

.mobile-menu-btn { display: none; flex-direction: column; gap: 4px; background: none; border: none; cursor: pointer; padding: 8px; }
.mobile-menu-btn span { width: 20px; height: 2px; background: var(--white); }

/* Mega Menu - Subcategory Based */
.mega-menu {
    position: fixed;
    top: var(--nav-height);
    left: 0; right: 0;
    background: var(--white);
    box-shadow: var(--shadow-lg);
    opacity: 0; visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.25s ease;
    z-index: 999;
    max-height: 70vh;
    overflow: hidden;
}
.mega-menu.active { opacity: 1; visibility: visible; transform: translateY(0); }

.mega-menu-inner {
    max-width: var(--container-max);
    margin: 0 auto;
    display: flex;
    max-height: 70vh;
}
.mega-sidebar {
    width: 180px;
    background: var(--primary);
    padding: 24px;
    flex-shrink: 0;
}
.mega-cat-name { font-size: 1.25rem; font-weight: 700; color: var(--white); margin-bottom: 4px; }
.mega-cat-count { font-size: 0.8rem; color: var(--accent); }

.mega-main {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
}
.mega-subcategories {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 24px;
}
.mega-subcat h4 {
    font-family: var(--font-body);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--accent-dark);
    margin-bottom: 10px;
    padding-bottom: 6px;
    border-bottom: 2px solid var(--gray-100);
}
.mega-subcat ul { list-style: none; }
.mega-subcat li { margin-bottom: 6px; }
.mega-subcat a {
    color: var(--gray-600);
    font-size: 0.85rem;
    transition: color 0.2s;
    display: block;
    padding: 2px 0;
}
.mega-subcat a:hover { color: var(--accent-dark); }

/* Knowledge Base Sidebar */
.page-with-sidebar {
    display: flex;
    min-height: calc(100vh - var(--nav-height));
    margin-top: var(--nav-height);
}
.knowledge-sidebar {
    width: var(--sidebar-width);
    background: var(--primary);
    position: fixed;
    top: var(--nav-height);
    left: 0; bottom: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    z-index: 100;
}
.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    flex-shrink: 0;
}
.sidebar-header h2 { font-family: var(--font-body); font-size: 1rem; font-weight: 600; color: var(--white); margin-bottom: 2px; }
.sidebar-header .article-count { font-size: 0.75rem; color: rgba(255,255,255,0.5); }

.sidebar-content { flex: 1; overflow-y: auto; padding: 8px 0; }
.sidebar-category { margin-bottom: 4px; }
.sidebar-cat-header {
    padding: 10px 20px;
    font-size: 0.7rem; font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--accent);
    background: rgba(255,255,255,0.03);
    border-left: 3px solid var(--accent);
}
.sidebar-cat-header span { color: rgba(255,255,255,0.4); font-weight: 400; }

.sidebar-articles { list-style: none; }
.sidebar-article-link {
    display: flex; align-items: center; gap: 10px;
    padding: 6px 20px;
    color: rgba(255,255,255,0.7);
    font-size: 0.78rem;
    border-left: 3px solid transparent;
    transition: all 0.2s;
}
.sidebar-article-link:hover { background: rgba(255,255,255,0.05); color: var(--white); }
.sidebar-article-link.active {
    background: rgba(201,169,98,0.15);
    border-left-color: var(--accent);
    color: var(--accent);
}
.article-num {
    width: 22px; height: 22px;
    display: flex; align-items: center; justify-content: center;
    background: rgba(255,255,255,0.1);
    border-radius: 4px;
    font-size: 0.65rem; font-weight: 600;
    flex-shrink: 0;
}
.sidebar-article-link.active .article-num { background: var(--accent); color: var(--primary); }
.article-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Article Main */
.article-main {
    flex: 1;
    margin-left: var(--sidebar-width);
    background: var(--cream);
    min-height: calc(100vh - var(--nav-height));
}
.breadcrumb {
    padding: 12px 32px;
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
    font-size: 0.8rem;
    color: var(--gray-500);
}
.breadcrumb a { transition: color 0.2s; }
.breadcrumb a:hover { color: var(--accent-dark); }
.breadcrumb .separator { margin: 0 8px; color: var(--gray-300); }

.article-hero {
    padding: 32px;
    text-align: center;
    background: var(--white);
}
.category-badge {
    display: inline-block;
    padding: 5px 14px;
    background: var(--primary);
    color: var(--white);
    font-size: 0.65rem; font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    border-radius: 20px;
    margin-bottom: 16px;
}
.article-hero h1 { color: var(--primary); max-width: 700px; margin: 0 auto; font-size: 2rem; }

.article-content { max-width: 800px; margin: 0 auto; padding: 32px; }

/* Diagram */
.diagram-container {
    background: var(--white);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
}
.diagram-title { text-align: center; font-size: 0.9rem; font-weight: 600; color: var(--gray-800); margin-bottom: 16px; }
.diagram-flow { display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap; }
.diagram-box {
    padding: 10px 18px;
    background: var(--white);
    border: 2px solid var(--gray-200);
    border-radius: 6px;
    font-size: 0.85rem; font-weight: 500;
    color: var(--gray-700);
}
.diagram-box.highlight { background: var(--primary); border-color: var(--primary); color: var(--white); }
.diagram-box.accent { background: var(--accent); border-color: var(--accent); color: var(--primary); }
.diagram-arrow { color: var(--gray-300); font-size: 1rem; }

/* Article Body */
.article-body {
    background: var(--white);
    border-radius: 12px;
    padding: 32px;
    box-shadow: var(--shadow-sm);
}
.article-body p { margin-bottom: 1.25rem; color: var(--gray-600); line-height: 1.75; }
.article-body h2 { margin-top: 1.5rem; margin-bottom: 0.75rem; color: var(--primary); font-size: 1.5rem; }
.article-body h3 { margin-top: 1.25rem; margin-bottom: 0.5rem; font-size: 1.1rem; }
.article-body ul, .article-body ol { margin-bottom: 1.25rem; padding-left: 1.25rem; }
.article-body li { margin-bottom: 0.4rem; color: var(--gray-600); }

/* Share */
.share-section {
    display: flex; align-items: center; justify-content: flex-end; gap: 12px;
    margin-top: 24px; padding-top: 20px;
    border-top: 1px solid var(--gray-200);
}
.share-label { font-size: 0.8rem; color: var(--gray-500); }
.share-buttons { display: flex; gap: 8px; }
.share-btn {
    width: 36px; height: 36px;
    display: flex; align-items: center; justify-content: center;
    background: var(--gray-100);
    border: none; border-radius: 8px;
    color: var(--gray-600); cursor: pointer;
    transition: all 0.2s;
}
.share-btn:hover { background: var(--primary); color: var(--white); }

/* Related */
.related-articles { margin-top: 32px; }
.related-articles h3 { font-family: var(--font-body); font-size: 0.9rem; font-weight: 600; margin-bottom: 16px; }
.related-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.related-card {
    background: var(--white);
    border-radius: 10px;
    padding: 16px;
    border: 1px solid var(--gray-200);
    transition: all 0.2s;
}
.related-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.related-card .card-category {
    font-size: 0.65rem; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.05em;
    color: var(--accent-dark); margin-bottom: 6px;
}
.related-card h4 { font-family: var(--font-body); font-size: 0.85rem; font-weight: 600; margin-bottom: 4px; }
.related-card p { font-size: 0.75rem; color: var(--gray-500); }

/* Footer */
.footer {
    background: var(--primary);
    color: var(--white);
    padding: 48px 24px 24px;
    margin-left: var(--sidebar-width);
}
.footer.homepage-footer { margin-left: 0; }
.footer-inner { max-width: var(--container-max); margin: 0 auto; }
.footer-grid {
    display: grid;
    grid-template-columns: 1.5fr repeat(4, 1fr);
    gap: 32px;
    margin-bottom: 32px;
}
.footer-brand .logo { margin-bottom: 12px; }
.footer-brand p { color: rgba(255,255,255,0.6); font-size: 0.85rem; line-height: 1.5; }
.footer-col h4 {
    font-family: var(--font-body);
    font-size: 0.7rem; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.1em;
    color: var(--accent); margin-bottom: 14px;
}
.footer-links { list-style: none; }
.footer-links li { margin-bottom: 8px; }
.footer-links a { color: rgba(255,255,255,0.7); font-size: 0.85rem; transition: color 0.2s; }
.footer-links a:hover { color: var(--white); }
.footer-bottom {
    padding-top: 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
    display: flex; justify-content: space-between;
    font-size: 0.8rem; color: rgba(255,255,255,0.5);
}

/* Search Overlay */
.search-overlay {
    position: fixed; inset: 0;
    background: rgba(10,22,40,0.95);
    z-index: 2000;
    display: flex; align-items: flex-start; justify-content: center;
    padding-top: 100px;
    opacity: 0; visibility: hidden;
    transition: all 0.3s;
}
.search-overlay.active { opacity: 1; visibility: visible; }
.search-container { width: 100%; max-width: 550px; padding: 0 20px; }
.search-input-wrap { position: relative; }
.search-input-wrap svg { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--gray-400); }
.search-input {
    width: 100%;
    padding: 16px 16px 16px 48px;
    font-size: 1rem;
    border: none; border-radius: 10px;
    background: var(--white);
}
.search-input:focus { outline: none; box-shadow: 0 0 0 3px var(--accent); }
.search-hint { text-align: center; margin-top: 12px; color: rgba(255,255,255,0.5); font-size: 0.8rem; }
.search-hint kbd { background: rgba(255,255,255,0.1); padding: 3px 6px; border-radius: 4px; }
.search-results { margin-top: 16px; max-height: 350px; overflow-y: auto; }
.search-result-item {
    display: block;
    padding: 12px 16px;
    background: var(--white);
    border-radius: 8px;
    margin-bottom: 6px;
    transition: all 0.2s;
}
.search-result-item:hover { transform: translateX(4px); }
.search-result-category { font-size: 0.65rem; font-weight: 600; text-transform: uppercase; color: var(--accent-dark); }
.search-result-title { display: block; font-size: 0.9rem; font-weight: 500; color: var(--gray-800); margin-top: 2px; }
.search-close { position: absolute; top: 24px; right: 24px; background: none; border: none; color: var(--white); cursor: pointer; }
.no-results { text-align: center; padding: 20px; color: rgba(255,255,255,0.5); }

/* Responsive */
@media (max-width: 1024px) {
    .mega-subcategories { grid-template-columns: repeat(2, 1fr); }
    .related-grid { grid-template-columns: 1fr; }
    .footer-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
    .main-nav { display: none; }
    .mobile-menu-btn { display: flex; }
    .knowledge-sidebar { display: none; }
    .article-main { margin-left: 0; }
    .footer { margin-left: 0; }
    .article-hero { padding: 24px; }
    .article-content { padding: 20px; }
    h1 { font-size: 1.75rem; }
    .footer-grid { grid-template-columns: 1fr; gap: 24px; }
    .footer-bottom { flex-direction: column; gap: 8px; text-align: center; }
}
