:root {
    --bg-color: #060606;       
    --bg-secondary: #121212;   
    --bg-tertiary: #1a1a1a;    
    --text-main: #f8f9fa;      
    --text-muted: #aaaaaa;     
    --accent-color: #ff003c;   
    --border-color: #2a2a2a;
    --border-highlight: #3a3a3a;
    
    --font-text: 'Inter', sans-serif;
    --font-code: 'Fira Code', monospace;
    --topbar-height: 64px;
}

html {
    scroll-behavior: smooth;
}

body.light-theme {
    --bg-color: #f8f9fa;       
    --bg-secondary: #ffffff;   
    --bg-tertiary: #f1f3f5;    
    --text-main: #212529;      
    --text-muted: #495057;     
    --accent-color: #d90429;   
    --border-color: #e9ecef;
    --border-highlight: #dee2e6;
}

/* Theme Toggle Button */
.theme-toggle-btn {
    background: rgba(255,255,255,0.02); border: 1px solid var(--border-highlight); cursor: pointer; color: var(--text-muted); 
    width: 38px; height: 38px; border-radius: 50%; display: flex; align-items: center; justify-content: center; transition: all 0.3s ease;
}
.theme-toggle-btn:hover { color: var(--text-main); background-color: var(--bg-tertiary); border-color: var(--accent-color); }

/* Hardcoded overrides for light-theme */
body.light-theme .accordion-header.nested-header:hover, 
body.light-theme .accordion-header.nested-header.active { background-color: rgba(217, 4, 41, 0.08); }
body.light-theme .nav-link:hover { background-color: rgba(0,0,0,0.05); }
body.light-theme .markdown-body pre { background-color: #f1f3f5; box-shadow: inset 0 0 8px rgba(0,0,0,0.05); }
body.light-theme .markdown-body code { color: #d90429; }
body.light-theme .markdown-body blockquote { background-color: rgba(217, 4, 41, 0.05); }
body.light-theme .markdown-body tr:nth-child(even) { background-color: rgba(0, 0, 0, 0.03); }
body.light-theme .logo { text-shadow: none; }

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
    background-color: var(--bg-color); color: var(--text-main);
    font-family: var(--font-text); line-height: 1.6; overflow: hidden; min-height: 100vh;
}

/* Animated Blobs Background */
body::before {
    content: ''; position: fixed; top: -50%; left: -50%; width: 200%; height: 200%;
    background: radial-gradient(circle at center, rgba(255, 0, 60, 0.05) 0%, transparent 35%),
                radial-gradient(circle at 80% 20%, rgba(255, 0, 60, 0.03) 0%, transparent 30%);
    z-index: -1; pointer-events: none; animation: animateBg 30s infinite linear;
}
body.light-theme::before {
    background: radial-gradient(circle at center, rgba(217, 4, 41, 0.04) 0%, transparent 35%),
                radial-gradient(circle at 20% 80%, rgba(33, 37, 41, 0.03) 0%, transparent 25%);
}
@keyframes animateBg { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* TOP BAR */
.top-bar {
    height: var(--topbar-height); background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color); display: flex; align-items: center;
    padding: 0 24px; justify-content: space-between; z-index: 100; position: relative; gap: 16px;
}
.logo {
    display: flex; align-items: center; gap: 10px; font-family: var(--font-code);
    font-size: 1.25rem; font-weight: 700; color: var(--text-main);
    transition: transform 0.3s ease;
    cursor: pointer; min-width: 0; flex-shrink: 0;
}
.logo:hover { transform: scale(1.02); }
.logo span { color: var(--accent-color); }
.tagline {
    font-family: var(--font-text); font-size: 0.70rem; color: var(--text-muted); opacity: 0.6;
    letter-spacing: 1px; font-weight: 400; text-transform: uppercase; border-left: 1px solid var(--border-highlight); padding-left: 12px; margin-left: 5px;
}

.search-container { 
    display: flex; align-items: center; gap: 15px; height: 38px; justify-content: flex-end; min-width: 0;
}
.search-input {
    width: 250px; height: 100%; background-color: rgba(255,255,255,0.02); border: 1px solid var(--border-highlight);
    color: var(--text-main); padding: 0 16px; border-radius: 20px;
    font-family: var(--font-text); font-size: 0.85rem; transition: all 0.3s ease; max-width: 100%;
}
.search-input:focus { outline: none; border-color: var(--accent-color); background-color: rgba(255,0,60,0.02); box-shadow: 0 0 12px rgba(255,0,60,0.15); width: 330px; }

.top-nav { display: flex; gap: 24px; }
.top-link { 
    color: var(--text-muted); 
    text-decoration: none; 
    font-size: 0.95rem; 
    font-weight: 500; 
    padding: 6px 4px;
    position: relative;
    transition: color 0.3s ease; 
    font-family: var(--font-code);
}
.top-link::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: 0;
    left: 0;
    background-color: var(--accent-color);
    transition: width 0.3s ease;
}
.top-link:hover { 
    color: var(--text-main);
}
.top-link:hover::after {
    width: 100%;
}

/* LAYOUT */
.layout { display: flex; height: calc(100dvh - var(--topbar-height)); min-height: calc(100dvh - var(--topbar-height)); }
.sidebar { background-color: var(--bg-secondary); overflow-y: auto; flex-shrink: 0; display: flex; flex-direction: column; overscroll-behavior: contain; }
.left-sidebar { width: 280px; border-right: 1px solid var(--border-color); padding: 24px 16px; }
.right-sidebar { width: 260px; border-left: 1px solid var(--border-color); padding: 24px 20px; }
@keyframes fadeIn { 
    from { opacity: 0; transform: translateY(10px); } 
    to { opacity: 1; transform: translateY(0); } 
}
.content-area { 
    flex-grow: 1; padding: 40px 60px; overflow-y: auto; scroll-behavior: smooth; 
    background-color: var(--bg-color); 
    background-image: 
        linear-gradient(rgba(255, 0, 60, 0.09) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 0, 60, 0.09) 1px, transparent 1px);
    background-size: 50px 50px;
    background-position: center top;
    position: relative; animation: fadeIn 0.4s ease-out; min-width: 0;
}
body.light-theme .content-area {
    background-image: 
        linear-gradient(rgba(217, 4, 41, 0.07) 1px, transparent 1px),
        linear-gradient(90deg, rgba(217, 4, 41, 0.07) 1px, transparent 1px);
}

/* AKORDEON NAV */
.nav-section { margin-bottom: 8px; }
.nav-section.nested { margin-top: 4px; margin-bottom: 4px; border-left: 1px solid var(--border-color); margin-left: 14px; padding-left: 6px; }

.accordion-header {
    background: none; border: 1px solid transparent; color: var(--text-main);
    font-family: var(--font-code); font-size: 0.9rem; cursor: pointer;
    padding: 10px 14px; width: 100%; text-align: left; display: flex; justify-content: space-between; align-items: center;
    border-radius: 4px; transition: all 0.2s;
}
.accordion-header.nested-header { font-size: 0.8rem; padding: 8px 10px; color: var(--text-muted); }
.accordion-header.nested-header:hover, .accordion-header.nested-header.active { color: var(--accent-color); background-color: rgba(255, 0, 60, 0.03); }

.accordion-header:hover, .accordion-header.active { background-color: var(--bg-tertiary); color: var(--accent-color); }
.accordion-header::after { content: '+'; color: var(--text-muted); font-size: 1.2rem; transition: transform 0.3s ease; display: inline-block; }
.accordion-header.active::after { transform: rotate(45deg); color: var(--accent-color); }
.accordion-header.nested-header::after { font-size: 1rem; }
.accordion-header.nested-header.active::after { font-size: 1.1rem; }
.coming-soon-header { display: flex; align-items: center; justify-content: space-between; }
.coming-soon-header::after { content: none !important; }

.accordion-body { 
    max-height: 0; 
    opacity: 0; 
    overflow: hidden; 
    transition: max-height 0.4s ease-in-out, opacity 0.4s ease-in-out, padding 0.4s ease-in-out; 
    padding: 0 0 0 0;
}
.accordion-body.open { 
    max-height: 2000px; 
    opacity: 1; 
    padding: 5px 0 10px 0; 
}
.nav-link {
    display: block; color: var(--text-muted); text-decoration: none;
    padding: 8px 12px 8px 18px; margin: 2px 0; font-size: 0.85rem; border-left: 3px solid transparent; transition: all 0.2s;
}
.nav-section.nested .nav-link { padding-left: 12px; font-size: 0.80rem; }
.nav-link:hover { color: var(--text-main); background-color: rgba(255,255,255,0.03); transform: translateX(4px); }
.nav-link.active {
    color: var(--accent-color); border-left: 3px solid var(--accent-color);
    background-color: rgba(255, 0, 60, 0.05); font-weight: 500;
}

/* TOC */
.toc-title {
    font-family: var(--font-code); font-size: 0.85rem; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: 1.5px; border-bottom: 1px solid var(--border-highlight); margin-bottom: 24px; padding-bottom: 10px;
    cursor: pointer; transition: color 0.3s ease;
}
.toc-title:hover { color: var(--text-main); }
.toc-title.active { color: var(--accent-color); font-weight: bold; }
#toc { transition: opacity 0.2s ease, transform 0.2s ease; opacity: 1; transform: translateX(0); }
#toc.fade-out { opacity: 0; transform: translateX(10px); }
.toc-nav { display: flex; flex-direction: column; gap: 6px; }
.toc-link { color: var(--text-muted); text-decoration: none; font-size: 0.85rem; padding: 4px 0; position: relative; transition: color 0.2s; }
.toc-link:hover { color: var(--text-main); }
.toc-link.active { color: var(--accent-color); font-weight: 500; }
.toc-link.active::before {
    content: ''; position: absolute; left: -15px; top: 50%; transform: translateY(-50%);
    width: 6px; height: 6px; border-radius: 50%; background-color: var(--accent-color); box-shadow: 0 0 8px var(--accent-color);
}
.toc-h3 { padding-left: 16px; font-size: 0.8rem; opacity: 0.8; }

/* MARKDOWN HACKER TEMASI */
.loader-box { 
    width: 100%; height: 2px; background-color: transparent; position: absolute; top: 0; left: 0;
    opacity: 0; animation: loaderFadeIn 0.3s 0.2s forwards; z-index: 10; overflow: hidden;
}
.loader-line {
    width: 30%; height: 100%; background-color: var(--accent-color); box-shadow: 0 0 8px var(--accent-color);
    animation: loaderMove 1.2s infinite ease-in-out;
}
@keyframes loaderFadeIn { to { opacity: 1; } }
@keyframes loaderMove {
    0% { transform: translateX(-100%); width: 20%; }
    50% { width: 50%; }
    100% { transform: translateX(400%); width: 20%; }
}

.error-msg { border: 1px solid var(--accent-color); background-color: rgba(255, 0, 60, 0.05); color: var(--accent-color); padding: 20px; border-radius: 4px; }
.markdown-body { max-width: 850px; width: 100%; margin: 0 auto; padding-bottom: 100px; transition: opacity 0.2s ease, transform 0.2s ease; opacity: 1; transform: translateY(0); }
.markdown-body.fade-out { opacity: 0; transform: translateY(10px); }
.markdown-body > * { max-width: 100%; }
.markdown-body h1 { font-size: 2.8rem; color: var(--text-main); margin-bottom: 0.5em; border-bottom: 1px solid var(--border-color); padding-bottom: 0.3em; overflow-wrap: anywhere; }
.markdown-body h2 { font-size: 1.8rem; color: var(--text-main); margin-top: 1.5em; margin-bottom: 0.8em; border-bottom: 1px dashed var(--border-color); padding-bottom: 0.3em; scroll-margin-top: 20px; overflow-wrap: anywhere; }
.markdown-body h3 { font-size: 1.3rem; margin-top: 1.5em; scroll-margin-top: 20px; overflow-wrap: anywhere; }
.markdown-body p, .markdown-body li { font-size: 1.05rem; color: var(--text-muted); margin-bottom: 1.2em; overflow-wrap: anywhere; }
.markdown-body a { color: var(--accent-color); text-decoration: none; }
.markdown-body a:hover { text-shadow: 0 0 5px rgba(255,0,60,0.5); border-bottom: 1px solid var(--accent-color); }
.markdown-body pre { background-color: #000; border: 1px solid var(--border-highlight); border-left: 4px solid var(--accent-color); padding: 16px; border-radius: 4px; overflow-x: auto; margin-bottom: 1.5em; box-shadow: inset 0 0 10px rgba(0,0,0,0.8); }
.markdown-body code { font-family: var(--font-code); background-color: var(--bg-secondary); color: #ff5555; padding: 0.2em 0.4em; border-radius: 4px; font-size: 0.9em; border: 1px solid var(--border-color); }
.markdown-body pre code { background: none; padding: 0; color: var(--text-main); border: none; }
.markdown-body blockquote { border-left: 4px solid var(--accent-color); background-color: rgba(255, 0, 60, 0.05); padding: 12px 20px; margin: 0 0 1.5em 0; color: var(--text-muted); font-style: italic; }
.markdown-body table { width: 100%; border-collapse: collapse; margin-bottom: 1.5em; font-size: 0.95rem; }
.markdown-body th, .markdown-body td { padding: 12px 16px; border: 1px solid var(--border-color); text-align: left; }
.markdown-body th { background-color: var(--bg-secondary); color: var(--accent-color); font-family: var(--font-code); text-transform: uppercase; }
.markdown-body tr:nth-child(even) { background-color: rgba(255, 255, 255, 0.02); }
.markdown-body hr { border: 0; border-top: 1px solid var(--border-highlight); margin: 2.5em 0; }
.markdown-body img, .markdown-body video, .markdown-body iframe { max-width: 100%; height: auto; }

.site-footer { flex-shrink: 0; }
.site-footer-inner { width: 100%; }
.footer-links { flex-wrap: wrap; }
.toc-link { overflow-wrap: anywhere; }

/* SCROLLBAR */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-color); }
::-webkit-scrollbar-thumb { background: var(--border-highlight); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent-color); }

/* MOBILE TOGGLE & OVERLAY */
.mobile-toggle {
    display: none; background: none; border: none; flex-direction: column; gap: 4px; cursor: pointer; padding: 10px; z-index: 1001;
}
.mobile-toggle span {
    display: block; width: 22px; height: 2px; background-color: var(--text-main); transition: 0.3s;
}
.mobile-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.6); backdrop-filter: blur(4px);
    z-index: 998; opacity: 0; pointer-events: none; transition: 0.3s;
}
.mobile-overlay.active { opacity: 1; pointer-events: auto; }

/* RESPONSIVE QUERIES */

/* Tablet Optimization */
@media (max-width: 1100px) {
    .right-sidebar { display: none; }
    .content-area { padding: 30px 40px; }
    .search-input { width: 180px; }
    .search-input:focus { width: 220px; }
}

/* Mobile Optimization */
@media (max-width: 768px) {
    body { overflow: auto; }
    .layout { height: auto; min-height: calc(100vh - var(--topbar-height)); }
    
    .top-bar {
        height: auto;
        min-height: var(--topbar-height);
        padding: 12px 15px;
        flex-wrap: wrap;
        align-items: center;
    }
    .mobile-toggle { display: flex; }
    .tagline { display: none; }
    .top-links { display: none !important; }
    .logo {
        order: 2;
        flex: 1 1 auto;
        font-size: 1.05rem;
    }
    
    .search-container {
        order: 3;
        width: 100%;
        margin-left: 0;
        justify-content: space-between;
        gap: 12px;
        height: auto;
    }
    .search-input { width: auto; max-width: none; flex: 1 1 auto; min-width: 0; height: 40px; }
    .search-input:focus { width: 100%; }

    .sidebar {
        position: fixed; top: 0; left: 0; height: 100vh; z-index: 999;
        transform: translateX(-100%); transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 10px 0 30px rgba(0,0,0,0.5);
    }
    .left-sidebar { width: min(86vw, 320px); padding-top: 92px; }
    .sidebar.active { transform: translateX(0); }
    
    .content-area { padding: 20px 16px 32px; overflow: visible; background-size: 36px 36px; }
    .markdown-body { padding-bottom: 56px; }
    .markdown-body h1 { font-size: 1.9rem; line-height: 1.15; }
    .markdown-body h2 { font-size: 1.35rem; }
    .markdown-body h3 { font-size: 1.1rem; }
    .markdown-body p, .markdown-body li { font-size: 0.98rem; }
    
    /* Table & Code Responsive */
    .markdown-body table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .markdown-body pre { font-size: 0.85rem; padding: 12px; }
    .nav-link:hover { transform: none; }
    .site-footer {
        margin-top: 32px !important;
        padding: 28px 18px !important;
    }
    .site-footer-inner {
        flex-direction: column;
        align-items: flex-start !important;
    }
    .footer-links {
        width: 100%;
        gap: 14px 20px !important;
    }
    .footer-copyright {
        width: 100%;
        text-align: left !important;
    }

    /* Hamburger Animation to X */
    .mobile-toggle.active span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
    .mobile-toggle.active span:nth-child(2) { opacity: 0; }
    .mobile-toggle.active span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }
}

@media (max-width: 480px) {
    .top-bar {
        padding: 10px 12px 12px;
    }
    .logo {
        font-size: 1rem;
        gap: 8px;
    }
    .logo span { display: none; }
    .search-container {
        gap: 10px;
    }
    .theme-toggle-btn {
        width: 36px;
        height: 36px;
    }
    .markdown-body h1 {
        font-size: 1.7rem;
    }
    .markdown-body h2 {
        font-size: 1.2rem;
    }
}
