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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #2c5f2d 0%, #1e3a1e 100%);
    height: 100vh;
    overflow: hidden;
}

.app-container {
    display: flex;
    height: 100vh;
    width: 100%;
    position: relative;
}

/* Mobile menu button - hidden on desktop */
.mobile-menu-btn {
    display: none;
    position: fixed;
    top: 15px;
    left: 15px;
    z-index: 1000;
    background: linear-gradient(135deg, #2c5f2d 0%, #1e3a1e 100%);
    color: #f5f0dc;
    border: none;
    width: 45px;
    height: 45px;
    border-radius: 8px;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
    transition: all 0.3s ease;
}

.mobile-menu-btn:hover {
    transform: scale(1.05);
    background: linear-gradient(135deg, #3a7a3a 0%, #2a4a2a 100%);
}

/* Sidebar - with mobile overlay behavior */
.chapter-sidebar {
    width: 280px;
    background: rgba(245, 240, 220, 0.98);
    backdrop-filter: blur(10px);
    box-shadow: 2px 0 20px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    z-index: 100;
    transition: transform 0.3s ease;
}

/* Mobile sidebar - hidden by default, slides in */
@media (max-width: 768px) {
    .chapter-sidebar {
        position: fixed;
        left: 0;
        top: 0;
        height: 100vh;
        transform: translateX(-100%);
        z-index: 999;
        width: 280px;
    }
    
    .chapter-sidebar.open {
        transform: translateX(0);
        box-shadow: 2px 0 30px rgba(0,0,0,0.3);
    }
    
    .mobile-menu-btn {
        display: block;
    }
    
    /* Overlay when sidebar is open on mobile */
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0,0,0,0.5);
        z-index: 998;
    }
    
    .sidebar-overlay.active {
        display: block;
    }
}

.sidebar-header {
    background: linear-gradient(135deg, #2c5f2d 0%, #1e3a1e 100%);
    color: #f5f0dc;
    padding: 20px 15px;
    text-align: center;
    border-bottom: 3px solid #d4a017;
}

.sidebar-header h1 {
    font-size: 18px;
    margin-bottom: 5px;
}

.sidebar-header p {
    font-size: 11px;
    opacity: 0.9;
    font-style: italic;
}

.chapter-list {
    flex: 1;
    padding: 15px 0;
}

.chapter-item {
    padding: 10px 15px;
    margin: 3px 12px;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    border-left: 3px solid #d4a017;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.chapter-item:hover {
    transform: translateX(3px);
    background: #f5f0dc;
}

.chapter-item.active {
    background: linear-gradient(135deg, #2c5f2d 0%, #1e3a1e 100%);
    color: #f5f0dc;
    border-left-color: #d4a017;
}

.chapter-number {
    font-weight: bold;
    font-size: 11px;
    margin-bottom: 3px;
    opacity: 0.8;
}

.chapter-title {
    font-size: 13px;
    font-weight: 600;
}

.flipbook-content {
    flex: 1;
    padding: 20px;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* Mobile adjustments for flipbook area */
@media (max-width: 768px) {
    .flipbook-content {
        padding: 10px;
        padding-top: 60px; /* Space for mobile menu button */
    }
    
    .flipbook-wrapper {
        padding: 8px;
    }
    
    .flipbook-header {
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
    }
    
    .current-chapter-info {
        text-align: center;
        font-size: 12px;
    }
    
    .nav-controls {
        justify-content: center;
    }
    
    .nav-btn {
        padding: 5px 12px;
        font-size: 11px;
    }
    
    .chapter-dropdown {
        font-size: 11px;
        padding: 5px 10px;
    }
}

.flipbook-wrapper {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    padding: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.flipbook-header {
    background: rgba(245, 240, 220, 0.95);
    padding: 8px 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    flex-shrink: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.current-chapter-info {
    font-size: 14px;
    font-weight: bold;
    color: #2c5f2d;
}

.nav-controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

.nav-buttons {
    display: flex;
    gap: 10px;
}

.nav-btn {
    background: linear-gradient(135deg, #2c5f2d 0%, #1e3a1e 100%);
    color: #f5f0dc;
    border: none;
    padding: 6px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 13px;
    font-weight: bold;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 5px;
}

.nav-btn:hover:not(.disabled) {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    background: linear-gradient(135deg, #3a7a3a 0%, #2a4a2a 100%);
}

.nav-btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.chapter-dropdown {
    background: linear-gradient(135deg, #2c5f2d 0%, #1e3a1e 100%);
    color: #f5f0dc;
    border: none;
    padding: 6px 12px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 13px;
    font-weight: bold;
    transition: all 0.3s ease;
}

.chapter-dropdown:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    background: linear-gradient(135deg, #3a7a3a 0%, #2a4a2a 100%);
}

.chapter-dropdown:focus {
    outline: none;
}

.iframe-container {
    flex: 1;
    position: relative;
    min-height: 0;
}

iframe {
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 8px;
    background: #f5f0dc;
    display: block;
}

/* Large desktop screens */
@media (min-width: 1440px) {
    .chapter-sidebar {
        width: 320px;
    }
    
    .flipbook-content {
        padding: 30px;
    }
    
    .current-chapter-info {
        font-size: 16px;
    }
}

/* Fullscreen button styling */
.df-fullscreen-btn {
    cursor: pointer !important;
    z-index: 100 !important;
}

/* Ensure flipbook fills fullscreen properly */
#flipbook:-webkit-full-screen {
    width: 100% !important;
    height: 100% !important;
    background: #f5f0dc !important;
}

#flipbook:fullscreen {
    width: 100% !important;
    height: 100% !important;
    background: #f5f0dc !important;
}

/* For when the flipbook container is fullscreen */
:-webkit-full-screen {
    background: #f5f0dc !important;
}

:fullscreen {
    background: #f5f0dc !important;
}
