/**
 * ASUS Product Guide Style Interactive Flipbook Viewer CSS
 * Tribratanews Digital E-Publication System
 * 100% Local, CSP Compliant
 */

:root {
    --fb-bg: #0e1117;
    --fb-surface: rgba(20, 24, 32, 0.94);
    --fb-surface-border: rgba(255, 255, 255, 0.1);
    --fb-text: #f8fafc;
    --fb-text-muted: #94a3b8;
    --fb-accent: #38bdf8;
    --fb-accent-hover: #0284c7;
    --fb-gold: #f59e0b;
    --fb-topbar-h: 56px;
    --fb-bottombar-h: 62px;
}

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

html, body {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    overflow: hidden !important;
    margin: 0 !important;
    padding: 0 !important;
    background-color: var(--fb-bg);
    color: var(--fb-text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    user-select: none;
    -webkit-user-select: none;
}

/* Master Fixed Wrapper */
#flipbook-wrapper {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    display: flex;
    flex-direction: column;
    background: radial-gradient(ellipse at 50% 45%, #242b38 0%, #13171e 65%, #090b0e 100%);
    overflow: hidden !important;
}

/* TOP TOOLBAR */
.fb-topbar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: var(--fb-topbar-h);
    background: var(--fb-surface);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--fb-surface-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    z-index: 100;
}

.fb-topbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
    overflow: hidden;
}

.fb-brand-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--fb-text);
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.08);
    transition: all 0.2s ease;
    white-space: nowrap;
}

.fb-brand-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}

.fb-title-box {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.fb-title {
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.fb-topbar-right {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Toolbar Buttons */
.fb-btn {
    width: 38px;
    height: 38px;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: var(--fb-text-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 15px;
    transition: all 0.2s ease;
    position: relative;
    text-decoration: none;
}

.fb-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.fb-btn.active {
    background: rgba(56, 189, 248, 0.2);
    color: var(--fb-accent);
}

.fb-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.fb-divider {
    width: 1px;
    height: 20px;
    background: var(--fb-surface-border);
    margin: 0 4px;
}

/* VIEWPORT CONTAINER */
.fb-viewport-container {
    position: absolute;
    top: var(--fb-topbar-h);
    bottom: var(--fb-bottombar-h);
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 16px 24px;
}

/* Floating Navigation Arrows */
.fb-nav-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 46px;
    height: 72px;
    background: rgba(20, 24, 32, 0.7);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    cursor: pointer;
    z-index: 50;
    transition: all 0.25s ease;
}

.fb-nav-arrow:hover {
    background: rgba(56, 189, 248, 0.85);
    color: #fff;
    box-shadow: 0 0 20px rgba(56, 189, 248, 0.4);
}

.fb-nav-arrow:disabled {
    opacity: 0;
    pointer-events: none;
}

.fb-nav-arrow.prev {
    left: 14px;
    border-radius: 12px 4px 4px 12px;
}

.fb-nav-arrow.next {
    right: 14px;
    border-radius: 4px 12px 12px 4px;
}

/* StPageFlip Canvas Wrapper */
.fb-book-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.4s cubic-bezier(0.25, 1, 0.5, 1);
    transform-origin: center center;
}

/* Realistic Book Canvas & Container */
#fb-book {
    position: relative !important;
    margin: 0 auto !important;
    border-radius: 4px;
    background: transparent !important;
    box-shadow: none !important;
}

.stf__parent,
.stf__wrapper,
.stf__block {
    background: transparent !important;
}

.stf__parent {
    position: relative !important;
    display: block !important;
    box-sizing: border-box !important;
    transform: translateZ(0);
}

.stf__wrapper {
    position: relative !important;
    width: 100% !important;
    height: 100% !important;
    padding-bottom: 0 !important;
    box-sizing: border-box !important;
}

.stf__block {
    position: absolute !important;
    width: 100% !important;
    height: 100% !important;
    left: 0 !important;
    top: 0 !important;
    box-sizing: border-box !important;
    perspective: 2000px !important;
}

.page-wrapper {
    background-color: #ffffff;
    box-sizing: border-box;
    overflow: hidden;
}

/* Subtle realistic page binding seam without covering text */
.stf__item.--left .page-wrapper {
    border-right: 1px solid rgba(0, 0, 0, 0.07);
}

.stf__item.--right .page-wrapper {
    border-left: 1px solid rgba(0, 0, 0, 0.04);
}

/* Overall Book Shadow */
.stf__parent {
    box-shadow: 
        0 4px 12px rgba(0, 0, 0, 0.25),
        0 14px 38px rgba(0, 0, 0, 0.40),
        0 30px 65px -10px rgba(0, 0, 0, 0.55);
}

.fb-page-canvas {
    width: 100%;
    height: 100%;
    display: block;
    background: #fff;
}

/* Center spine shadow completely removed as requested */
.fb-spine-shadow,
.fb-edge-shadow-left,
.fb-edge-shadow-right {
    display: none !important;
}

/* BOTTOM CONTROL BAR */
.fb-bottombar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--fb-bottombar-h);
    background: var(--fb-surface);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid var(--fb-surface-border);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 16px;
    z-index: 100;
}

.fb-control-pill {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.06);
    padding: 6px 18px;
    border-radius: 30px;
    border: 1px solid var(--fb-surface-border);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.fb-page-input-box {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--fb-text-muted);
}

.fb-page-input {
    width: 44px;
    height: 28px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--fb-surface-border);
    border-radius: 6px;
    color: #fff;
    text-align: center;
    font-size: 13px;
    font-weight: 700;
    outline: none;
    transition: border-color 0.2s;
}

.fb-page-input:focus {
    border-color: var(--fb-accent);
}

.fb-slider {
    width: 140px;
    height: 4px;
    accent-color: var(--fb-accent);
    cursor: pointer;
}

/* LEFT SIDEBAR THUMBNAILS PANEL (COMPACT & COLLAPSIBLE) */
.fb-sidebar-drawer,
.fb-thumbnails-drawer {
    position: fixed !important;
    top: var(--fb-topbar-h) !important;
    bottom: var(--fb-bottombar-h) !important;
    left: 0 !important;
    width: 220px !important;
    height: auto !important;
    background: rgba(14, 18, 26, 0.96) !important;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-right: 1px solid var(--fb-surface-border) !important;
    border-top: none !important;
    box-shadow: 10px 0 35px rgba(0, 0, 0, 0.6) !important;
    z-index: 95 !important;
    transform: translateX(-105%) !important;
    transition: transform 0.32s cubic-bezier(0.16, 1, 0.3, 1) !important;
    display: flex !important;
    flex-direction: column !important;
}

.fb-sidebar-drawer.open,
.fb-thumbnails-drawer.open {
    transform: translateX(0) !important;
}

.fb-sidebar-header,
.fb-drawer-header {
    height: 44px;
    padding: 0 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.03);
    font-size: 13px;
    font-weight: 700;
    color: #f8fafc;
}

.fb-sidebar-title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 700;
}

.fb-sidebar-count {
    color: var(--fb-text-muted);
    font-size: 11px;
    font-weight: 500;
}

.fb-sidebar-close,
.fb-drawer-close {
    background: none;
    border: none;
    color: var(--fb-text-muted);
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
    padding: 2px 6px;
    border-radius: 6px;
    transition: all 0.2s;
}

.fb-sidebar-close:hover,
.fb-drawer-close:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

.fb-sidebar-scroll,
.fb-thumbnails-track {
    flex: 1;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px !important;
    padding: 12px 10px !important;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

/* Compact Thumbnails (Kecil-kecil & Rapi) */
.fb-thumb-item {
    position: relative;
    width: 100%;
    aspect-ratio: 3 / 4.15;
    background: #1e2430;
    border-radius: 6px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    cursor: pointer;
    overflow: hidden;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.35);
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.fb-thumb-item:hover {
    transform: translateY(-2px) scale(1.03);
    border-color: rgba(56, 189, 248, 0.7);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.5);
}

.fb-thumb-item.active {
    border-color: var(--fb-accent);
    box-shadow: 0 0 14px rgba(56, 189, 248, 0.7);
}

.fb-thumb-canvas {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    opacity: 0;
    transition: opacity 0.3s ease;
    position: relative;
    z-index: 1;
}

.fb-thumb-canvas.loaded {
    opacity: 1;
}

.fb-thumb-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.25);
    font-size: 20px;
    z-index: 0;
}

.fb-thumb-number {
    position: absolute;
    bottom: 3px;
    right: 3px;
    background: rgba(0, 0, 0, 0.82);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 4px;
    z-index: 3;
}

/* Floating Sidebar Toggle Button on Left Edge */
.fb-floating-sidebar-toggle {
    position: fixed;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
    background: rgba(18, 23, 33, 0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-left: none;
    border-radius: 0 10px 10px 0;
    color: #f8fafc;
    padding: 10px 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    z-index: 60;
    box-shadow: 4px 0 15px rgba(0, 0, 0, 0.4);
    transition: all 0.25s ease;
}

.fb-floating-sidebar-toggle i {
    font-size: 15px;
    color: var(--fb-accent);
}

.fb-floating-sidebar-toggle span {
    writing-mode: vertical-rl;
    text-orientation: mixed;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    font-size: 9.5px;
    font-weight: 700;
}

.fb-floating-sidebar-toggle:hover {
    background: rgba(56, 189, 248, 0.25);
    border-color: var(--fb-accent);
    color: #fff;
    padding-right: 10px;
}

/* MODALS / OVERLAYS */
.fb-modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.fb-modal-backdrop.show {
    opacity: 1;
    pointer-events: auto;
}

.fb-modal-box {
    width: 90%;
    max-width: 480px;
    background: #1a1d24;
    border: 1px solid var(--fb-surface-border);
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.6);
}

/* Loader */
.fb-loader-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #0e1117;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 300;
    transition: opacity 0.4s ease;
}

.fb-loader-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--fb-accent);
    border-radius: 50%;
    animation: fb-spin 0.8s linear infinite;
    margin-bottom: 16px;
}

@keyframes fb-spin {
    to { transform: rotate(360deg); }
}

.fb-loader-text {
    font-size: 14px;
    color: var(--fb-text-muted);
    font-weight: 500;
}

/* Toast Notifications */
.fb-toast {
    position: fixed;
    top: 70px;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    background: rgba(30, 34, 43, 0.95);
    border: 1px solid var(--fb-surface-border);
    color: #fff;
    padding: 10px 20px;
    border-radius: 30px;
    font-size: 13px;
    font-weight: 600;
    box-shadow: 0 10px 25px rgba(0,0,0,0.4);
    z-index: 300;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.fb-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* RESPONSIVE DESIGN */
@media (max-width: 768px) {
    .fb-topbar {
        padding: 0 8px;
    }
    .fb-title-box {
        max-width: 140px;
    }
    .fb-nav-arrow {
        width: 36px;
        height: 54px;
        font-size: 18px;
    }
    .fb-slider {
        display: none;
    }
    .fb-control-pill {
        gap: 6px;
        padding: 4px 10px;
    }
}

/* ==========================================================================
   StPageFlip Core Layout Styles (Moved from vendor bundle for CSP compliance)
   ========================================================================== */
.stf__parent {
    position: relative;
    display: block;
    box-sizing: border-box;
    transform: translateZ(0);
    -ms-touch-action: pan-y;
    touch-action: pan-y;
}

.sft__wrapper {
    position: relative;
    width: 100%;
    box-sizing: border-box;
}

.stf__parent canvas {
    position: absolute;
    width: 100%;
    height: 100%;
    left: 0;
    top: 0;
    z-index: 2;
}

.stf__block {
    position: absolute;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    perspective: 2000px;
}

.stf__item {
    display: none;
    position: absolute;
    transform-style: preserve-3d;
}

.stf__outerShadow {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    z-index: 4;
}

.stf__innerShadow {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    z-index: 3;
}

.stf__hardShadow {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    z-index: 4;
}

.stf__hardInnerShadow {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    z-index: 3;
}

/* ==========================================================================
   Share Modal UI Elements (Extracted from viewer inline styles for CSP)
   ========================================================================== */
.fb-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.fb-modal-title {
    font-size: 18px;
    font-weight: 700;
    margin: 0;
}

.fb-modal-title-icon {
    color: var(--fb-accent);
    margin-right: 8px;
}

.fb-modal-close-btn {
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 22px;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s ease;
}

.fb-modal-close-btn:hover {
    color: #fff;
}

.fb-modal-field {
    margin-bottom: 18px;
}

.fb-modal-label {
    font-size: 12px;
    font-weight: 600;
    color: #94a3b8;
    display: block;
    margin-bottom: 6px;
}

.fb-modal-input-group {
    display: flex;
    gap: 8px;
}

.fb-modal-input {
    flex: 1;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--fb-surface-border);
    border-radius: 8px;
    color: #fff;
    padding: 8px 12px;
    font-size: 13px;
    outline: none;
}

.fb-modal-input:focus {
    border-color: var(--fb-accent);
}

.fb-modal-btn-copy {
    width: auto !important;
    padding: 0 16px !important;
    background: var(--fb-accent) !important;
    color: #000 !important;
    font-weight: 700 !important;
    border-radius: 8px !important;
}

.fb-modal-btn-copy-embed {
    width: auto !important;
    padding: 0 16px !important;
    background: rgba(255, 255, 255, 0.15) !important;
    color: #fff !important;
    font-weight: 600 !important;
    border-radius: 8px !important;
}

.fb-modal-social-group {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.fb-modal-btn-wa {
    flex: 1 !important;
    width: auto !important;
    background: #25D366 !important;
    color: #fff !important;
    font-weight: 600 !important;
    text-decoration: none !important;
    border-radius: 8px !important;
    gap: 6px !important;
}

.fb-modal-btn-fb {
    flex: 1 !important;
    width: auto !important;
    background: #1877F2 !important;
    color: #fff !important;
    font-weight: 600 !important;
    text-decoration: none !important;
    border-radius: 8px !important;
    gap: 6px !important;
}

