:root {
    --bg-color: #FAF9F6;
    --sidebar-bg: #F0EFEA;
    --text-main: #2C2C2C;
    --text-muted: #666666;
    --accent: #7A3B4F;
    --accent-hover: #612d3e;
    --accent-alpha: rgba(122, 59, 79, 0.1);
    --border: #DEDDDF;
    --card-bg: #FFFFFF;
    --text-story: #333333;
    --shadow-color: rgba(0, 0, 0, 0.03);
    --shadow-fab: rgba(122, 59, 79, 0.4);
    --hover-bg: rgba(0, 0, 0, 0.05);
    
    /* Typography: Warm Classic */
    --font-ui: 'Inter', sans-serif;
    --font-title: 'Playfair Display', serif;
    --font-story: 'Lora', serif;
    --story-align: justify;
    --story-line-height: 1.85;
    --story-letter-spacing: normal;
    --story-font-weight: 400;
}

/* --- THEME OVERRIDES --- */
html.theme-dark {
    --bg-color: #0F0F11;
    --sidebar-bg: #161619;
    --text-main: #E5E5E7;
    --text-muted: #8E8E93;
    --accent: #FF7A59; /* Warm Coral */
    --accent-hover: #E56240;
    --accent-alpha: rgba(255, 122, 89, 0.15);
    --border: #242428;
    --card-bg: #1B1B1F;
    --text-story: #D1D1D6;
    --shadow-color: rgba(0, 0, 0, 0.4);
    --shadow-fab: rgba(255, 122, 89, 0.4);
    --hover-bg: rgba(255, 255, 255, 0.04);

    /* Typography: Modern Cyber Sans */
    --font-ui: 'Space Mono', monospace;
    --font-title: 'Space Grotesk', sans-serif;
    --font-story: 'Plus Jakarta Sans', sans-serif;
    --story-align: justify;
    --story-line-height: 1.75;
    --story-letter-spacing: -0.01em;
    --story-font-weight: 400;
}

html.theme-forest {
    --bg-color: #F4F6F4;
    --sidebar-bg: #E6ECE6;
    --text-main: #2E4031;
    --text-muted: #5C7360;
    --accent: #2C5E3B; /* Moss Green */
    --accent-hover: #1E4427;
    --accent-alpha: rgba(44, 94, 59, 0.1);
    --border: #D2DDD4;
    --card-bg: #FFFFFF;
    --text-story: #2E4031;
    --shadow-color: rgba(44, 94, 59, 0.04);
    --shadow-fab: rgba(44, 94, 59, 0.4);
    --hover-bg: rgba(44, 94, 59, 0.05);

    /* Typography: Organic Bookish Serif (Light) */
    --font-ui: 'Outfit', sans-serif;
    --font-title: 'Fraunces', serif;
    --font-story: 'Merriweather', serif;
    --story-align: justify;
    --story-line-height: 1.95;
    --story-letter-spacing: normal;
    --story-font-weight: 400;
}

html.theme-forest-dark {
    --bg-color: #111512;
    --sidebar-bg: #171E19;
    --text-main: #DCE5DD;
    --text-muted: #798D7F;
    --accent: #5EAA71; /* Leaf Green */
    --accent-hover: #4A945C;
    --accent-alpha: rgba(94, 170, 113, 0.15);
    --border: #202A23;
    --card-bg: #1B231D;
    --text-story: #DCE5DD;
    --shadow-color: rgba(0, 0, 0, 0.45);
    --shadow-fab: rgba(94, 170, 113, 0.4);
    --hover-bg: rgba(255, 255, 255, 0.04);

    /* Typography: Organic Bookish Serif (Dark) */
    --font-ui: 'Outfit', sans-serif;
    --font-title: 'Fraunces', serif;
    --font-story: 'Merriweather', serif;
    --story-align: justify;
    --story-line-height: 1.95;
    --story-letter-spacing: normal;
    --story-font-weight: 400;
}

html.theme-ocean {
    --bg-color: #0B132B;
    --sidebar-bg: #111A35;
    --text-main: #F4F6F9;
    --text-muted: #8D99AE;
    --accent: #48CAE4; /* Cyan/Light Blue */
    --accent-hover: #00B4D8;
    --accent-alpha: rgba(72, 202, 228, 0.15);
    --border: #1F283E;
    --card-bg: #1C2541;
    --text-story: #E2EAF8;
    --shadow-color: rgba(0, 0, 0, 0.35);
    --shadow-fab: rgba(72, 202, 228, 0.4);
    --hover-bg: rgba(255, 255, 255, 0.05);

    /* Typography: Fluid Avant-Garde Sans */
    --font-ui: 'Outfit', sans-serif;
    --font-title: 'Syne', sans-serif;
    --font-story: 'Sora', sans-serif;
    --story-align: justify;
    --story-line-height: 1.75;
    --story-letter-spacing: 0.01em;
    --story-font-weight: 400;
}

html.theme-retro-paper {
    --bg-color: #F1ECE4;
    --sidebar-bg: #E3DCD0;
    --text-main: #23201D;
    --text-muted: #6B645C;
    --accent: #8B0000; /* Dark Crimson Red */
    --accent-hover: #660000;
    --accent-alpha: rgba(139, 0, 0, 0.08);
    --border: #D5CBBF;
    --card-bg: #F8F5EE;
    --text-story: #23201D;
    --shadow-color: rgba(0, 0, 0, 0.05);
    --shadow-fab: rgba(139, 0, 0, 0.4);
    --hover-bg: rgba(0, 0, 0, 0.06);

    /* Typography: Retro Typewriter (Kertas Tua) */
    --font-ui: 'Courier Prime', monospace;
    --font-title: 'Cinzel', serif;
    --font-story: 'Courier Prime', monospace;
    --story-align: justify;
    --story-line-height: 1.75;
    --story-letter-spacing: 0.02em;
    --story-font-weight: 400;
}

html.theme-retro-dark {
    --bg-color: #181614;
    --sidebar-bg: #221E1B;
    --text-main: #EADAC9; /* Warm parchment text */
    --text-muted: #9C8E80;
    --accent: #D4AF37; /* Antique Gold */
    --accent-hover: #BD9A2C;
    --accent-alpha: rgba(212, 175, 55, 0.15);
    --border: #2E2925;
    --card-bg: #201D1A;
    --text-story: #EADAC9;
    --shadow-color: rgba(0, 0, 0, 0.45);
    --shadow-fab: rgba(212, 175, 55, 0.4);
    --hover-bg: rgba(255, 255, 255, 0.04);

    /* Typography: Retro Typewriter (Dark) */
    --font-ui: 'Courier Prime', monospace;
    --font-title: 'Cinzel', serif;
    --font-story: 'Courier Prime', monospace;
    --story-align: justify;
    --story-line-height: 1.75;
    --story-letter-spacing: 0.02em;
    --story-font-weight: 400;
}

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

body {
    font-family: var(--font-ui);
    background-color: var(--bg-color);
    color: var(--text-main);
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* --- SIDEBAR --- */
.sidebar {
    width: 320px;
    background-color: var(--sidebar-bg);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    flex-shrink: 0;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), margin-left 0.3s ease;
    margin-left: 0;
    z-index: 1000;
}

/* Logic Menyembunyikan Sidebar di Desktop */
body.desktop-sidebar-closed .sidebar {
    margin-left: -320px;
}

.sidebar-header { padding: 24px; border-bottom: 1px solid var(--border); }
.sidebar-header h1 { font-family: var(--font-title); font-size: 1.5rem; color: var(--accent); }
.folder-list { padding: 16px; padding-bottom:7em; }

details { margin-bottom: 8px; }
summary { font-weight: 500; padding: 10px 12px; cursor: pointer; border-radius: 6px; transition: background 0.2s; list-style: none; display: flex; align-items: center; }
summary::-webkit-details-marker { display: none; }
summary::before { content: "\1F4C1"; margin-right: 10px; font-size: 1.1rem; }
details[open] summary::before { content: "\1F4C2"; }
details[open] summary { background-color: var(--hover-bg); }
summary:hover { background-color: var(--hover-bg); }

.file-list { list-style: none; padding-left: 32px; margin-top: 5px; margin-bottom: 10px; }
.file-list li { margin-bottom: 4px; }
.file-link { text-decoration: none; color: var(--text-muted); font-size: 0.95rem; display: block; padding: 6px 8px; border-radius: 4px; transition: all 0.2s; }
.file-link:hover, .file-link.active { color: var(--accent); background-color: var(--accent-alpha); transform: translateX(4px); }

/* --- TOMBOL FLOATING MENU (FAB) ICON SAJA --- */
.fab-menu {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 56px;
    height: 56px;
    background-color: var(--accent);
    color: white;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 15px var(--shadow-fab);
    z-index: 1001; 
    transition: transform 0.2s, background 0.2s;
}
.fab-menu:hover { transform: translateY(-3px) scale(1.05); background-color: var(--accent-hover); }

.sidebar-overlay { display: none; }

/* Area Membaca */
.reader-container { flex: 1; overflow-y: auto; padding: 40px; scroll-behavior: smooth; }
.reader-content { max-width: 700px; margin: 0 auto; background-color: var(--card-bg); padding: 60px; border-radius: 8px; box-shadow: 0 10px 30px var(--shadow-color); min-height: 80vh; padding-bottom: 100px; } 

.reader-content h1 { font-family: var(--font-title); font-size: 2.8rem; line-height: 1.2; margin-bottom: 20px; color: var(--text-main); text-align: center; }
.reader-content h2, .reader-content h3 { font-family: var(--font-title); margin-top: 30px; margin-bottom: 15px; color: var(--accent); }
.reader-content p { font-family: var(--font-story); font-size: 1.15rem; line-height: var(--story-line-height); margin-bottom: 24px; color: var(--text-story); text-align: var(--story-align); letter-spacing: var(--story-letter-spacing); font-weight: var(--story-font-weight); }

.cover-image { max-width: 100%; width: auto; height: auto; max-height: 420px; object-fit: cover; object-position: center 20%; border-radius: 12px; margin: 24px auto 36px auto; box-shadow: 0 8px 24px rgba(0,0,0,0.08); display: block; -webkit-backface-visibility: hidden; transform: translateZ(0); filter: blur(0px); image-rendering: auto; }

.reader-content > p:first-of-type::first-letter { font-family: var(--font-title); font-size: 4rem; float: left; line-height: 0.8; margin-right: 10px; margin-top: 4px; color: var(--accent); }
.reader-content hr { border: 0; text-align: center; margin: 40px 0; }
.reader-content hr::before { content: "\2726   \2726   \2726"; font-size: 1.2rem; letter-spacing: 10px; color: var(--text-muted); opacity: 0.5; }
.reader-content blockquote { font-style: italic; border-left: 3px solid var(--accent); padding-left: 20px; margin-left: 0; color: var(--text-muted); }
.empty-state { text-align: center; color: var(--text-muted); margin-top: 100px; font-family: var(--font-story); font-style: italic; }

/* --- RESPONSIF HP --- */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        top: 0; left: 0;
        height: 100vh;
        width: 85%;
        max-width: 340px;
        margin-left: 0; 
        transform: translateX(-100%); 
        box-shadow: 4px 0 25px rgba(0,0,0,0.15);
        border-right: none;
    }

    body.desktop-sidebar-closed .sidebar { margin-left: 0; }

    body.mobile-sidebar-open .sidebar {
        transform: translateX(0);
    }

    .sidebar-overlay {
        display: block; position: fixed; top: 0; left: 0; right: 0; bottom: 0;
        background: rgba(0,0,0,0.5); z-index: 999;
        opacity: 0; visibility: hidden; transition: all 0.3s ease;
    }
    body.mobile-sidebar-open .sidebar-overlay {
        opacity: 1; visibility: visible;
    }

    .reader-container { padding: 15px; }
    .reader-content { padding: 30px 20px; }
    .reader-content h1 { font-size: 2rem; }
    .reader-content p { font-size: 1.1rem; text-align: left !important; }
    .cover-image { max-height: 280px; margin: 16px auto 24px auto; border-radius: 8px; }
    
    .fab-menu { bottom: 20px; right: 20px; width: 50px; height: 50px; } /* Tombol sedikit mengecil di HP */
}
