:root {
    --bg-color: #100000;
    --toolbar-bg: #2a0101;
    --accent: #865e00;
    --text-light: #f5f5f5;
    --icon-color: #f5f5f5;        /* Default icon color — change this to restyle all icons */
    --icon-hover-color: #ffffff;   /* Icon color on hover */
    --icon-size: 20px;             /* Base icon size */
}

* { box-sizing: border-box; margin: 0; padding: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }

body { background-color: var(--bg-color); color: var(--text-light); overflow: hidden; display: flex; flex-direction: column; height: 100vh; }

/* ======================== SVG Icon System ======================== */
.icon {
    width: var(--icon-size);
    height: var(--icon-size);
    color: var(--icon-color);
    flex-shrink: 0;
    display: block;
}
.icon-sm {
    width: 16px;
    height: 16px;
}

/* ======================== Top Bar ======================== */
.top-bar { 
    height: 70px; 
    background: var(--toolbar-bg); 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    padding: 0 20px; 
    box-shadow: 0 2px 10px rgba(0,0,0,0.5); 
    z-index: 10; 
}

.logo { display: flex; align-items: center; text-decoration: none; }
.logo-img { 
    height: 30px; 
    width: auto; 
    display: block; 
}

/* ======================== Icon Buttons ======================== */
.icon-btn { 
    background: none; 
    border: none; 
    color: var(--icon-color); 
    cursor: pointer; 
    padding: 6px 8px; 
    border-radius: 6px; 
    transition: background 0.2s, color 0.2s; 
    display: flex; 
    align-items: center; 
    justify-content: center;
}
.icon-btn:hover { 
    background: rgba(255,255,255,0.1); 
    color: var(--icon-hover-color); 
}
.icon-btn:hover .icon { color: var(--icon-hover-color); }

/* ======================== Main Book Area ======================== */
.book-container { 
    flex: 1; 
    position: relative; 
    display: flex; 
    justify-content: center; 
    align-items: center; 
    overflow: hidden; 
    width: 100%;
    padding: 20px 100px; 
}

#flipbook { 
    box-shadow: 0 0 20px rgba(0,0,0,0.8); 
    transform-origin: center center;
}

#flipbook.zoom-transition {
    transition: transform 0.45s cubic-bezier(0.25, 0.1, 0.25, 1.0);
}

.page { background-color: white; overflow: hidden; }
.page img { width: 100%; height: 100%; object-fit: cover; }

/* ======================== Zoom Overlay ======================== */
#zoom-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 30;
    cursor: grab;
}
#zoom-overlay.hidden { display: none; }
#zoom-overlay.grabbing { cursor: grabbing; }

/* ======================== Navigation Arrows ======================== */
.nav-arrow { 
    position: absolute; 
    top: 50%; 
    transform: translateY(-50%); 
    background: rgba(255, 255, 255, 0.08);
    border: none; 
    cursor: pointer; 
    width: 48px; 
    height: 80px; 
    z-index: 50; 
    border-radius: 10px; 
    backdrop-filter: blur(5px);
    transition: background 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--icon-color);
}
.nav-arrow .icon { 
    width: 28px; 
    height: 28px; 
    color: var(--icon-color);
}
.nav-arrow:hover { background: rgba(255, 255, 255, 0.2); }
.nav-arrow:hover .icon { color: var(--icon-hover-color); }
#prev-btn { left: 25px; }
#next-btn { right: 25px; }

/* ======================== Bottom Toolbar ======================== */
.toolbar { 
    height: 56px; 
    background: var(--toolbar-bg); 
    display: flex; 
    align-items: center; 
    justify-content: space-between; 
    padding: 0 16px; 
    z-index: 10; 
    gap: 12px;
}

/* Page controls group (page display + goto) */
.page-controls { 
    display: flex; 
    align-items: center; 
    gap: 10px; 
    flex-shrink: 0;
}

.page-display {
    font-size: 14px;
    color: var(--text-light);
    white-space: nowrap;
    user-select: none;
}

/* Go-to-page */
.goto-page {
    display: flex;
    align-items: center;
    gap: 2px;
}

#goto-input {
    width: 70px;
    height: 30px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 6px;
    color: var(--text-light);
    font-size: 13px;
    padding: 0 8px;
    outline: none;
    transition: border-color 0.2s, background 0.2s;
    -moz-appearance: textfield;
}
#goto-input::-webkit-outer-spin-button,
#goto-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
#goto-input:focus {
    border-color: var(--accent);
    background: rgba(255,255,255,0.12);
}
#goto-input::placeholder { color: rgba(255,255,255,0.35); font-size: 12px; }

/* Slider */
input[type=range] { 
    flex: 1; 
    min-width: 0;
    max-width: 100%; 
    cursor: pointer; 
    accent-color: var(--accent); 
}

/* Zoom / fullscreen group */
.zoom-controls { 
    display: flex; 
    align-items: center; 
    gap: 4px; 
    flex-shrink: 0;
}

/* ======================== Search Modal ======================== */
#search-modal { 
    position: fixed; top: 0; left: 0; width: 100%; height: 100%; 
    background: rgba(0,0,0,0.8); z-index: 100; 
    display: flex; justify-content: center; align-items: flex-start; 
    padding-top: 80px; backdrop-filter: blur(3px); 
}
#search-modal.hidden { display: none; }

.search-container { 
    background: var(--toolbar-bg); width: 90%; max-width: 600px; 
    border-radius: 10px; overflow: hidden; 
    box-shadow: 0 10px 30px rgba(0,0,0,0.5); 
}

.search-header { 
    display: flex; 
    align-items: center;
    padding: 14px 16px; 
    border-bottom: 1px solid #444; 
    gap: 12px;
}
.search-icon-static { 
    color: rgba(255,255,255,0.4); 
    width: 20px; 
    height: 20px; 
    flex-shrink: 0; 
}
#search-input { 
    flex: 1; background: transparent; border: none; 
    color: white; font-size: 16px; outline: none; 
}
#close-search { padding: 4px; }

#search-results { max-height: 400px; overflow-y: auto; list-style: none; }
#search-results li { padding: 15px; border-bottom: 1px solid #333; cursor: pointer; transition: background 0.2s; }
#search-results li:hover { background: #3a3a3a; }
.result-page { color: var(--accent); font-weight: bold; margin-bottom: 5px; font-size: 14px; }
.result-text { font-size: 13px; color: #ccc; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ======================== Mobile ======================== */
@media (max-width: 768px) {
    .nav-arrow { display: none; } 
    .book-container { padding: 10px; }

    /* Single-line toolbar on mobile */
    .toolbar { 
        height: 48px; 
        padding: 0 10px; 
        gap: 8px;
        flex-wrap: nowrap;
    }
    .page-display { font-size: 13px; }
    #goto-input { width: 48px; height: 28px; font-size: 12px; padding: 0 6px; }
    input[type=range] { max-width: none; }
    .icon { width: 18px; height: 18px; }
    .icon-sm { width: 14px; height: 14px; }
}