@charset "UTF-8";

:root {
    --font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --font-size: 14px;
    --font-color: #222222;
    --body-bg: #ffffff;

    --topbar-bg: #555555;
    --topbar-text: #ffffff;

    --bottombar-bg: #555555;
    --bottombar-text: #ffffff;

    --nav-btn-bg: #777777;
    --nav-btn-primary-bg: #888888;
    --nav-btn-text: #ffffff;

    --progress-fill: #ffffff;
}

* {
    box-sizing: border-box;
    font-family: var(--font-family);
}

html,
body {
    margin: 0;
    padding: 0;
    height: 100%;
    overflow: hidden;
    /* hilangkan scroll browser */
}

body {
    display: flex;
    flex-direction: column;
    background: var(--body-bg);
    color: var(--font-color);
    font-size: var(--font-size);
}

/* ===== TOP BAR ===== */
.topbar {
    height: 48px;
    background: var(--topbar-bg) !important;
    color: var(--topbar-text) !important;
    display: flex;
    align-items: center;
    padding: 0 16px;
}

.topbar-menu {
    font-size: 20px;
    margin-right: 12px;
    cursor: pointer;
    line-height: 1;
}

.topbar-title {
    font-size: 14px;
    font-weight: 500;
}

/* ===== MAIN LAYOUT =====
.main-layout {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
 */

.main-layout {
    flex: 1;
    display: flex;
    flex-direction: row;
    min-height: 0;
}


/* ===== SIDEBAR / TOC (overlay modern drawer) =====
.sidebar {
  position: fixed;
  left: 0;
  top: 48px;   
  bottom: 56px; 
  width: 280px;
  background: #f4f4f6;
  border-right: 1px solid #dedede;
  display: flex;
  flex-direction: column;
  transform: translateX(-100%);
  transition: transform 0.25s ease;
  z-index: 20;
  box-shadow: 4px 0 12px rgba(0,0,0,0.18);
}
  */
.sidebar {
    position: relative;
    width: 0;
    flex-shrink: 0;
    overflow-y: auto;
    /* Enable vertical scrolling */
    background: #f4f4f6;
    border-right: 1px solid #dedede;
    transition: width 0.25s ease;
}

.sidebar.open {
    transform: translateX(0);
    width: 280px;
}

.sidebar-header {
    padding: 12px 16px;
    border-bottom: 1px solid #dedede;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #666;
}

.sidebar-close {
    font-size: 18px;
    cursor: pointer;
}

.page-list {
    flex: 1;
    list-style: none;
    margin: 0;
    padding: 0;
    overflow-y: auto;
}

.page-item {
    display: flex;
    align-items: center;
    padding: 8px 14px;
    font-size: 13px;
    color: #666;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.12s ease, color 0.12s ease;
}

.page-item:hover {
    background: #e9eaee;
}

.page-item.active {
    background: #ffffff;
    font-weight: 500;
    color: #222;
}

.toc-icon {
    margin-right: 8px;
    font-size: 16px;
    opacity: 0.7;
}

.page-label {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.page-status {
    width: 18px;
    text-align: right;
    font-size: 13px;
}

.page-status.visited {
    color: #2e7d32;
}

.page-status.not-visited {
    color: #c0c0c0;
}

/* ===== VIEWER ===== */
.viewer {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 12px 16px;
    min-height: 0;
    background: #ffffff;
}

/* area canvas harus mengisi penuh ruang di antara topbar & bottombar */
.canvas-wrapper {
    flex: 1;
    min-height: 0;
    background: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 0;
    box-sizing: border-box;
}

canvas {
    background: #ffffff;
    max-width: 100%;
    max-height: 100%;
    height: auto;
    box-shadow: 0 0 8px rgba(0, 0, 0, 0.1);
    border-radius: 2px;
}

/* BOTTOM BAR (footer) */
.bottombar {
    height: 80px;
    background: var(--bottombar-bg) !important;
    color: var(--bottombar-text) !important;
    display: flex;
    flex-direction: column;
    padding: 8px 16px;
    font-size: 12px;
    gap: 8px;
    flex-shrink: 0;
    width: 100%;
}

/* Progress bar section */
.progress-section {
    display: flex;
    flex-direction: column;
    width: 100%;
    gap: 4px;
}

.progress-bar-container {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #ddd;
}

.progress-bar-fill {
    height: 100%;
    width: 0%;
    background: var(--progress-fill) !important;
    transition: width 0.2s ease;
}

.progress-text {
    white-space: nowrap;
    font-size: 10px;
    color: var(--bottombar-text);
}

/* Posisi tombol previous, page number, dan next */
.page-info-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-grow: 1;
    /* Pastikan elemen ini mengisi sisa ruang */
    justify-content: center;
    /* Default ke center */
    width: 100%;
}

/* CSS untuk posisi left, center, right */
.page-info-wrapper.left {
    justify-content: flex-start;
    /* Tombol dan page number di kiri */
}

.page-info-wrapper.center {
    justify-content: center;
    /* Tombol dan page number di tengah */
}

.page-info-wrapper.right {
    justify-content: flex-end;
    /* Tombol dan page number di kanan */
}

.page-info {
    font-size: 12px;
    color: var(--bottombar-text);
    opacity: 0.9;
}

/* Tombol navigasi di bawah progress bar */
.nav-buttons {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    /* Tombol di kanan */
}

.nav-btn {
    min-width: 90px;
    padding: 8px 16px;
    border-radius: 999px;
    border: none;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    cursor: pointer;
    background: var(--nav-btn-bg) !important;
    color: var(--nav-btn-text) !important;
    opacity: 0.9;
}

.nav-btn.primary {
    background: var(--nav-btn-primary-bg) !important;
}

.nav-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Upload Modal */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: #fff;
    padding: 20px;
    width: 360px;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.modal-content h3 {
    margin-top: 0;
}

.modal-content label {
    display: block;
    margin-bottom: 12px;
    font-size: 14px;
}

.modal-content input[type="text"] {
    width: 100%;
    padding: 8px;
    margin-top: 4px;
}

.checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 16px;
}


/* MOBILE FIXES */
@media (max-width: 600px) {
    .bottombar {
        height: 100px;
        padding: 12px 16px;
    }

    .progress-section {
        gap: 4px;
    }

    .progress-bar-container {
        width: 100%;
    }

    .progress-text,
    .page-info-wrapper {
        font-size: 10px;
    }

    .nav-btn {
        font-size: 10px;
        padding: 6px 12px;
    }

    .page-info-wrapper {
        justify-content: center !important;
        /* Pastikan tombol di center */
    }
}