/* ==========================================================================
   DESIGN SYSTEM & VARIABLES
   ========================================================================== */
:root {
    /* Harmony Color Palette (Deep Dark & Neon Violet/Cyan) */
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-radial-glow: radial-gradient(circle at center, #2a1b4d 0%, #0a0a0f 70%);
    
    --accent-violet: #7c4dff;
    --accent-violet-glow: rgba(124, 77, 255, 0.4);
    --accent-cyan: #00e5ff;
    --accent-cyan-glow: rgba(0, 229, 255, 0.4);
    
    --text-primary: #f0f0f5;
    --text-secondary: #9a9ab0;
    --text-muted: #62627a;
    
    /* Glassmorphism Design Tokens */
    --glass-bg: linear-gradient(135deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0.03) 100%);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-border-hover: rgba(255, 255, 255, 0.2);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.4), inset 0 1px 0 0 rgba(255, 255, 255, 0.08);
    
    /* Font Families */
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;
    
    /* Layout Constants */
    --control-height: 64px;
    --sidebar-width: 280px;
    
    /* Book Dynamics */
    --book-aspect-ratio: 1.414; /* A4 Ratio */
    --book-width: 900px;
    --book-height: calc(var(--book-width) / 2 / var(--book-aspect-ratio)); /* Dynamic height based on half-width A4 */
}

/* ==========================================================================
   RESET & BASE STYLES
   ========================================================================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body, html {
    width: 100%;
    height: 100%;
    height: 100dvh;
    overflow: hidden;
    background: var(--bg-primary);
    background-image: var(--bg-radial-glow);
    font-family: var(--font-body);
    color: var(--text-primary);
}

/* Custom Scrollbars */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--accent-violet);
}

/* Utility classes */
.hidden {
    display: none !important;
}

/* ==========================================================================
   LOADER SCREEN
   ========================================================================== */
.loader-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--bg-primary);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.5s ease;
}

.loader-content {
    text-align: center;
    max-width: 400px;
    width: 90%;
    padding: 2rem;
}

.loader-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(124, 77, 255, 0.1);
    border-top: 4px solid var(--accent-violet);
    border-radius: 50%;
    margin: 0 auto 2rem;
    animation: spin 1s linear infinite;
    box-shadow: 0 0 15px var(--accent-violet-glow);
}

.loader-title {
    font-family: var(--font-heading);
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, #fff 0%, var(--text-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.loader-subtitle {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.progress-bar-container {
    width: 100%;
    height: 6px;
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-violet), var(--accent-cyan));
    box-shadow: 0 0 8px var(--accent-violet-glow);
    transition: width 0.2s ease;
}

.progress-text {
    font-size: 0.85rem;
    color: var(--accent-cyan);
    font-weight: 600;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ==========================================================================
   MAIN LAYOUT & APP CONTAINER
   ========================================================================== */
.app-container {
    display: flex;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    position: relative;
}

/* ==========================================================================
   SIDEBAR (THUMBNAILS)
   ========================================================================== */
.sidebar {
    width: var(--sidebar-width);
    height: 100%;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-right: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: transform 0.4s cubic-bezier(0.25, 1, 0.5, 1);
    box-shadow: 5px 0 25px rgba(0,0,0,0.3);
}

.sidebar.collapsed {
    transform: translateX(calc(-1 * var(--sidebar-width)));
    position: absolute;
}

.sidebar-header {
    padding: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--glass-border);
}

.sidebar-header h3 {
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 1.2rem;
    color: var(--text-primary);
}

.thumbnails-container {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    align-content: start;
}

.thumbnail-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
}

.thumbnail-box {
    position: relative;
    width: 100%;
    aspect-ratio: 0.707; /* A4 portrait */
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--glass-border);
    border-radius: 4px;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

.thumbnail-box canvas {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.thumbnail-wrapper span {
    margin-top: 0.4rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
    transition: color 0.3s ease;
}

.thumbnail-wrapper:hover .thumbnail-box {
    transform: translateY(-4px);
    border-color: var(--glass-border-hover);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.4);
}

.thumbnail-wrapper:hover span {
    color: var(--text-primary);
}

.thumbnail-wrapper.active .thumbnail-box {
    border-color: var(--accent-violet);
    box-shadow: 0 0 10px var(--accent-violet-glow);
}

.thumbnail-wrapper.active span {
    color: var(--accent-cyan);
    font-weight: 600;
}

/* ==========================================================================
   VIEWPORT & BOOK container
   ========================================================================== */
.viewport {
    flex: 1;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
    padding-bottom: calc(var(--control-height) + 3rem); /* extra space for floating control bar */
    perspective: 2200px;
    position: relative;
    transition: padding-left 0.4s ease;
    touch-action: none; /* Disable default scrolling and bounce on touch surfaces */
}

.app-container:not(.sidebar-collapsed-layout) .viewport {
    /* If sidebar is active, viewport shifts left */
}

/* Navigation Arrow Overlays */
.nav-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 80px;
    background: rgba(20, 20, 30, 0.4);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 1.5rem;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    z-index: 10;
    transition: all 0.3s ease;
    opacity: 0;
}

.viewport:hover .nav-arrow {
    opacity: 1;
}

.nav-arrow:hover {
    color: var(--text-primary);
    background: rgba(124, 77, 255, 0.2);
    border-color: var(--accent-violet);
    box-shadow: 0 0 15px rgba(124, 77, 255, 0.3);
}

.nav-arrow-left {
    left: 2rem;
}

.nav-arrow-right {
    right: 2rem;
}

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

/* ==========================================================================
   THE 3D BOOK ENGINE
   ========================================================================== */
.book-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    transform-style: preserve-3d;
    transition: transform 0.3s ease; /* For Zoom */
}

.book {
    position: relative;
    width: var(--book-width);
    height: var(--book-height);
    transform-style: preserve-3d;
    transition: transform 0.5s ease;
    border-radius: 4px;
}

/* Dynamic depth shadows on the book edges */
.book::before, .book::after {
    content: '';
    position: absolute;
    top: 0;
    height: 100%;
    width: 15px;
    background: linear-gradient(to right, rgba(0,0,0,0.3), transparent);
    z-index: -1;
    pointer-events: none;
    transition: opacity 0.5s ease;
}

/* Left page shadow stack */
.book::before {
    left: -15px;
    box-shadow: -5px 0 10px rgba(0,0,0,0.5);
    border-radius: 4px 0 0 4px;
}

/* Right page shadow stack */
.book::after {
    right: -15px;
    background: linear-gradient(to left, rgba(0,0,0,0.3), transparent);
    box-shadow: 5px 0 10px rgba(0,0,0,0.5);
    border-radius: 0 4px 4px 0;
}

/* Book Spine (folding line) */
.book-spine {
    position: absolute;
    left: 50%;
    top: 0;
    width: 2px;
    height: 100%;
    background: linear-gradient(to bottom, #15151f 0%, #05050a 100%);
    box-shadow: 0 0 10px rgba(0,0,0,0.8);
    transform: translateZ(1px);
    z-index: 50;
}

/* Sheets (Leaves) */
.sheet {
    position: absolute;
    width: 50%;
    height: 100%;
    left: 50%;
    top: 0;
    transform-origin: left center;
    transform-style: preserve-3d;
    transition: transform 0.8s cubic-bezier(0.25, 1, 0.5, 1);
    pointer-events: none;
    z-index: 1;
}

.sheet.active {
    pointer-events: auto;
}

/* Turning Class */
.sheet.flipped {
    transform: rotateY(-180deg);
}

/* Pages inside sheet */
.page {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    background-color: #f6f6f9;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.05);
}

/* Page corners curling effect for hints */
.page::before {
    content: '';
    position: absolute;
    bottom: 0;
    width: 40px;
    height: 40px;
    pointer-events: none;
    z-index: 10;
    transition: all 0.3s ease;
}

.page.front::before {
    right: 0;
    background: linear-gradient(135deg, transparent 50%, rgba(0,0,0,0.05) 50%, rgba(0,0,0,0.02) 100%);
}

.page.back::before {
    left: 0;
    background: linear-gradient(225deg, transparent 50%, rgba(0,0,0,0.05) 50%, rgba(0,0,0,0.02) 100%);
}

/* Hover peel indicator (slightly curl the corner) */
.sheet.peel-next:not(.flipped) {
    transform: rotateY(-8deg);
}

.sheet.peel-prev.flipped {
    transform: rotateY(-172deg);
}

/* Page canvas to render PDF */
.page-canvas {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background-color: #fff;
}

.page.front {
    z-index: 2;
    transform: rotateY(0deg);
    border-radius: 0 4px 4px 0;
}

.page.back {
    transform: rotateY(180deg);
    border-radius: 4px 0 0 4px;
}

/* 3D shading / Gradient Overlay on turning pages */
.page-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5;
    mix-blend-mode: multiply;
    transition: opacity 0.8s cubic-bezier(0.25, 1, 0.5, 1);
    opacity: 0;
}

.page.front .page-overlay {
    background: linear-gradient(to right, rgba(0,0,0,0.15), transparent 30%);
}

.page.back .page-overlay {
    background: linear-gradient(to left, rgba(0,0,0,0.15), transparent 30%);
}

/* Page number displays */
.page-num {
    position: absolute;
    bottom: 12px;
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
    z-index: 6;
    letter-spacing: 0.05em;
    user-select: none;
}

.page.front .page-num {
    right: 20px;
}

.page.back .page-num {
    left: 20px;
}

/* Spine shading overlays on stationary pages */
.spine-shading {
    position: absolute;
    top: 0;
    width: 25px;
    height: 100%;
    pointer-events: none;
    z-index: 6;
}

.page.front .spine-shading {
    left: 0;
    background: linear-gradient(to right, rgba(0,0,0,0.2) 0%, rgba(0,0,0,0.08) 20%, transparent 100%);
}

.page.back .spine-shading {
    right: 0;
    background: linear-gradient(to left, rgba(0,0,0,0.2) 0%, rgba(0,0,0,0.08) 20%, transparent 100%);
}

/* Dynamic Page stack thickness effects */
.sheet-edge-left, .sheet-edge-right {
    position: absolute;
    top: 0.5%;
    height: 99%;
    width: 0px; /* modified dynamically in JS */
    background: #e8e8ed;
    border-top: 1px solid rgba(0,0,0,0.1);
    border-bottom: 1px solid rgba(0,0,0,0.1);
    z-index: -1;
}

.sheet-edge-left {
    right: 100%;
    transform-origin: right center;
    transform: rotateY(-90deg);
    background: linear-gradient(to right, #cfcfd6, #e8e8ed);
}

.sheet-edge-right {
    left: 100%;
    transform-origin: left center;
    transform: rotateY(90deg);
    background: linear-gradient(to left, #cfcfd6, #e8e8ed);
}

/* ==========================================================================
   FLOATING BENUTZEROBERFLÄCHE (GLASSMORPHISM PANEL)
   ========================================================================== */
.controls-container {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    height: var(--control-height);
    background: var(--glass-bg);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    gap: 1.5rem;
    z-index: 110;
    box-shadow: var(--glass-shadow);
    transition: all 0.3s ease;
    width: auto;
    min-width: 600px;
}

.controls-container:hover {
    border-color: var(--glass-border-hover);
    box-shadow: 0 20px 48px rgba(0, 0, 0, 0.6);
}

.control-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.control-group.main-nav {
    gap: 0.75rem;
}

.control-divider {
    width: 1px;
    height: 24px;
    background: rgba(255, 255, 255, 0.1);
    margin: 0 0.25rem;
}

/* Control Buttons */
.control-btn, .icon-btn {
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-secondary);
    width: 38px;
    height: 38px;
    border-radius: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    font-size: 1.05rem;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.control-btn:hover, .icon-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.12);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.control-btn:active, .icon-btn:active {
    transform: scale(0.95);
}

/* Highlighting Active controls (like autoplay on) */
.control-btn.active {
    color: var(--accent-cyan);
    background: rgba(0, 229, 255, 0.08);
    border-color: rgba(0, 229, 255, 0.2);
    box-shadow: 0 0 10px rgba(0, 229, 255, 0.1), inset 0 0 8px rgba(0, 229, 255, 0.1);
}

.control-btn:disabled {
    opacity: 0.3;
    pointer-events: none;
}

/* Page Indicator display */
.page-indicator {
    display: flex;
    align-items: center;
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    padding: 0 0.5rem;
    user-select: none;
}

.page-separator {
    color: var(--text-muted);
    margin: 0 0.4rem;
}

#current-page-display {
    color: var(--accent-violet);
    text-shadow: 0 0 10px rgba(124, 77, 255, 0.2);
}

/* Zoom percentage display */
.zoom-display {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    width: 45px;
    text-align: center;
    user-select: none;
}

/* Tooltips */
.control-btn[title]::after {
    /* Simple dynamic tooltip using data-title is possible, but browser native tooltips are okay, we can make it look clean */
}

/* Close button for sidebar */
#close-sidebar-btn {
    width: 32px;
    height: 32px;
}

/* ==========================================================================
   BRAND LOGO & WATERMARK STYLES (DESKTOP)
   ========================================================================== */
.brand-container {
    position: absolute;
    top: 1.5rem;
    left: 1.5rem;
    z-index: 90;
    transition: all 0.3s ease;
    text-decoration: none;
}

.brand-container:hover .brand-logo {
    transform: scale(1.04);
    filter: drop-shadow(0 4px 12px rgba(124, 77, 255, 0.4));
}

.brand-logo {
    height: 54px;
    width: auto;
    filter: drop-shadow(0 2px 8px rgba(0,0,0,0.4));
    transition: all 0.3s ease;
}

.app-watermark {
    position: absolute;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 90;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 500;
    opacity: 0.7;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: rgba(18, 18, 26, 0.4);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 6px 14px;
    border-radius: 20px;
    border: 1px solid var(--glass-border);
}

.app-watermark:hover {
    opacity: 1;
    transform: translateY(-2px);
    color: var(--text-primary);
    border-color: var(--accent-violet);
    box-shadow: 0 4px 15px var(--accent-violet-glow);
    background: rgba(18, 18, 26, 0.6);
}

.watermark-logo {
    height: 18px;
    width: auto;
    transition: all 0.3s ease;
}

/* ==========================================================================
   WATERMARK POPOVER STYLES
   ========================================================================== */
.watermark-group {
    position: relative;
    display: none !important; /* Hide on desktop */
}

.control-watermark-logo {
    height: 20px;
    width: auto;
    border-radius: 2px;
}

.watermark-popover {
    position: absolute;
    bottom: calc(var(--control-height) + 10px);
    left: 50%;
    transform: translateX(-50%) translateY(10px) scale(0.95);
    background: linear-gradient(135deg, rgba(20, 20, 30, 0.85) 0%, rgba(10, 10, 15, 0.8) 100%);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 10px 16px;
    border-radius: 12px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.4), inset 0 1px 0 0 rgba(255, 255, 255, 0.05);
    white-space: nowrap;
    z-index: 130;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.25);
    opacity: 0;
    pointer-events: none;
}

.watermark-popover:not(.hidden) {
    opacity: 1;
    pointer-events: auto;
    transform: translateX(-50%) translateY(0) scale(1);
}

.watermark-popover::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 6px;
    border-style: solid;
    border-color: rgba(10, 10, 15, 0.8) transparent transparent transparent;
}

.popover-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 500;
    transition: color 0.2s ease;
}

.popover-link strong {
    color: #ff7600;
    font-weight: 600;
    text-shadow: 0 0 8px rgba(255, 118, 0, 0.3);
}

.popover-link:hover {
    color: var(--text-primary);
}

/* ==========================================================================
   RESPONSIVENESS (MOBILE ADAPTATION)
   ========================================================================== */
@media (max-width: 1024px) {
    :root {
        --book-width: 700px;
    }
}

@media (max-width: 768px) {
    /* Mobile styles: Switch to single-page slide transition */
    :root {
        --book-width: 90vw;
        --book-height: 75vh;
    }
    
    .viewport {
        padding: 1rem;
        padding-bottom: calc(var(--control-height) + 2rem + env(safe-area-inset-bottom, 0px));
    }
    
    .book {
        width: calc(var(--book-width) / 2); /* Single page width */
        height: var(--book-height);
    }
    
    /* Modify spine so it disappears or moves to the edge */
    .book-spine {
        display: none;
    }
    
    /* Modify sheet arrangement for single page stack */
    .sheet {
        width: 100%;
        left: 0;
        transform-origin: center center;
    }
    
    /* Disable 3D rotation and use slider instead on mobile */
    .sheet:not(.active-mobile) {
        opacity: 0;
        pointer-events: none;
        transform: translateX(100%) scale(0.9) !important;
    }
    
    .sheet.active-mobile {
        opacity: 1;
        pointer-events: auto;
        transform: translateX(0) scale(1) !important;
        z-index: 10;
    }
    
    .sheet.flipped-mobile {
        transform: translateX(-100%) scale(0.9) !important;
        opacity: 0;
        pointer-events: none;
    }
    
    /* On mobile, sheets cover the full book container flatly */
    .sheet {
        width: 100% !important;
        height: 100% !important;
        left: 0 !important;
        top: 0 !important;
        position: absolute !important;
        transform: none !important;
        pointer-events: none;
    }
    
    .sheet.active-mobile {
        pointer-events: auto;
    }
    
    /* Simple flat page visibility and card transitions on mobile */
    .sheet .page {
        display: flex !important;
        position: absolute !important;
        width: 100% !important;
        height: 100% !important;
        left: 0 !important;
        top: 0 !important;
        transform: translateX(100%) scale(0.95) !important;
        opacity: 0;
        pointer-events: none;
        transition: transform 0.4s cubic-bezier(0.25, 1, 0.5, 1), opacity 0.4s ease !important;
        border-radius: 8px !important;
        box-shadow: 0 8px 30px rgba(0,0,0,0.35) !important;
    }
    
    .sheet .page.flipped-page-mobile {
        transform: translateX(-100%) scale(0.95) !important;
        opacity: 0;
        pointer-events: none;
    }
    
    .sheet .page.active-page-mobile {
        transform: translateX(0) scale(1) !important;
        opacity: 1;
        pointer-events: auto;
        z-index: 10;
    }
    
    /* Adjust controls container */
    .controls-container {
        min-width: 92%;
        width: 92%;
        gap: 0.25rem;
        padding: 0 0.6rem;
        padding-bottom: env(safe-area-inset-bottom, 0px);
        bottom: calc(1.25rem + env(safe-area-inset-bottom, 0px));
        border-radius: 14px;
        height: 56px;
    }
    
    .watermark-popover {
        bottom: calc(56px + 12px + env(safe-area-inset-bottom, 0px));
    }
    
    .watermark-popover::after {
        left: auto;
        right: 24px;
        transform: none;
    }
    
    .page-indicator {
        font-size: 0.9rem;
        padding: 0 0.2rem;
    }
    
    /* Hide unnecessary buttons on mobile to prevent clutter */
    #first-page-btn,
    #last-page-btn,
    .utility-controls #autoplay-btn,
    .utility-controls .zoom-display,
    .utility-controls #zoom-in-btn,
    .utility-controls #zoom-out-btn,
    .utility-controls .control-divider,
    .utility-controls #fullscreen-btn {
        display: none !important;
    }
    
    .sidebar {
        width: 100%;
        --sidebar-width: 100vw;
    }
    
    .sidebar.collapsed {
        transform: translateX(-100%);
    }

    .nav-arrow {
        display: none !important;
    }
    
    /* Mobile brand and watermark adjustments */
    .brand-container {
        top: 1rem;
        left: 1rem;
    }
    
    .brand-logo {
        height: 36px;
    }
    
    .app-watermark {
        display: none !important; /* Hide watermark on mobile to prevent screen clutter */
    }
    
    .watermark-group {
        display: flex !important;
    }
}

/* Screen Reader and SEO only content — bulletproof hide */
.sr-only-seo {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    clip-path: inset(50%) !important;
    white-space: nowrap !important;
    border: 0 !important;
    opacity: 0 !important;
    pointer-events: none !important;
    visibility: hidden;
}


