/* Magazine-specific styles that work with original website styles */

/* Override body background for magazine page */
body {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    min-height: 100vh;
}

/* Ensure page container works with original nav */
.page-container {
    padding-top: 80px; /* Account for fixed nav */
}

/* Magazine banner removed per user request */

/* Navigation Panel */
.navigation-panel {
    position: fixed;
    top: 0;
    right: -300px;
    width: 300px;
    height: 100vh;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    box-shadow: -5px 0 20px rgba(0, 0, 0, 0.1);
    transition: right 0.3s ease;
    z-index: 1002;
    overflow-y: auto;
}

.navigation-panel.active {
    right: 0;
}

.nav-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid #eee;
}

.nav-header h3 {
    color: #333;
    font-size: 1.2rem;
}

.close-nav {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #666;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.page-list {
    list-style: none;
    padding: 0;
}

.page-list li {
    border-bottom: 1px solid #f0f0f0;
}

.page-list a {
    display: block;
    padding: 1rem 1.5rem;
    color: #333;
    text-decoration: none;
    transition: all 0.2s ease;
}

.page-list a:hover,
.page-list a.active {
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
    transform: translateX(5px);
}

/* Navigation Overlay */
.nav-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 999;
}

.nav-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Main Content */
.magazine-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2rem;
    gap: 2rem;
    max-width: 1600px;
    margin: 0 auto;
}

/* PDF Viewer Container */
.pdf-viewer-container {
    position: relative;
    background: white;
    border-radius: 15px;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    width: 100%;
    height: 80vh;
    min-height: 600px;
    border: 1px solid #e0e0e0;
}

/* Custom PDF Reader */
.pdf-reader {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
}

/* Book View (Desktop - Side by Side) */
.book-view {
    display: none;
    width: 100%;
    height: 100%;
    align-items: center;
    justify-content: center;
    gap: 20px;
    padding: 20px;
}

.book-view .pdf-canvas {
    max-width: calc(50% - 10px);
    max-height: calc(100% - 40px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    border-radius: 8px;
    background: white;
    cursor: grab;
    transition: transform 0.2s ease;
}

.book-view .pdf-canvas:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.2);
}

.book-view .pdf-canvas:active {
    cursor: grabbing;
}

.left-page {
    border-top-right-radius: 2px;
    border-bottom-right-radius: 2px;
    margin-right: 10px;
}

.right-page {
    border-top-left-radius: 2px;
    border-bottom-left-radius: 2px;
    margin-left: 10px;
}

/* Book spine effect */
.book-view::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 4px;
    height: 80%;
    background: linear-gradient(to bottom, 
        rgba(0, 0, 0, 0.1) 0%,
        rgba(0, 0, 0, 0.2) 50%,
        rgba(0, 0, 0, 0.1) 100%);
    border-radius: 2px;
    z-index: 1;
    pointer-events: none;
}

/* Single View (Mobile - One Page) */
.single-view {
    display: flex;
    width: 100%;
    height: 100%;
    align-items: center;
    justify-content: center;
    padding: 10px;
}

.single-view .pdf-canvas {
    max-width: 100%;
    max-height: 100%;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    border-radius: 8px;
    background: white;
    cursor: grab;
    transition: transform 0.2s ease;
    object-fit: contain;
}

.single-view .pdf-canvas:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.2);
}

.single-view .pdf-canvas:active {
    cursor: grabbing;
}

/* Mobile optimizations */
@media (max-width: 768px) {
    .single-view {
        padding: 5px;
        align-items: stretch;
        justify-content: stretch;
    }
    
    .single-view .pdf-canvas {
        width: 100%;
        height: 100%;
        max-width: none;
        max-height: none;
        border-radius: 4px;
        object-fit: contain;
        object-position: center;
    }
}

/* Desktop Layout */
@media (min-width: 1024px) {
    .pdf-viewer-container {
        height: 85vh;
        min-height: 700px;
        box-shadow: 
            0 20px 60px rgba(0, 0, 0, 0.1),
            0 0 0 1px rgba(0, 0, 0, 0.05),
            inset 0 1px 0 rgba(255, 255, 255, 0.8);
    }
    
    .magazine-content {
        padding: 1rem 1rem 2rem;
        max-width: 1800px;
    }
    
    /* Show book view on desktop */
    .book-view {
        display: flex;
    }
    
    .single-view {
        display: none;
    }
}

/* Mobile Layout */
@media (max-width: 1023px) {
    /* Show single view on mobile */
    .book-view {
        display: none;
    }
    
    .single-view {
        display: flex;
    }
}

/* Loading Spinner */
.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    padding: 3rem;
    color: #666;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Error State */
.pdf-error {
    text-align: center;
    padding: 3rem;
    color: #e74c3c;
}

.pdf-error button {
    background: #e74c3c;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 5px;
    cursor: pointer;
    margin-top: 1rem;
}

/* Mobile Reading Toggle - Hidden by default */
.mobile-reading-toggle {
    display: none;
}

/* Enhanced PDF Controls */
.pdf-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(15px);
    padding: 1.25rem 2rem;
    border-radius: 60px;
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.1),
        0 0 0 1px rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.control-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.control-btn {
    background: linear-gradient(135deg, #667eea, #764ba2);
    border: none;
    color: white;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 16px;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.control-btn:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

.control-btn:active {
    transform: translateY(0) scale(0.98);
}

.control-btn.active {
    background: linear-gradient(135deg, #2c3e50, #3498db);
    box-shadow: 0 6px 20px rgba(52, 152, 219, 0.4);
}

.control-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.2);
}

.page-info {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(118, 75, 162, 0.1));
    padding: 0.75rem 1.25rem;
    border-radius: 25px;
    color: #2c3e50;
    font-weight: 600;
    min-width: 100px;
    text-align: center;
    border: 1px solid rgba(102, 126, 234, 0.2);
    font-size: 14px;
}

.zoom-level {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(118, 75, 162, 0.1));
    padding: 0.75rem 1.25rem;
    border-radius: 25px;
    color: #2c3e50;
    font-weight: 600;
    min-width: 80px;
    text-align: center;
    border: 1px solid rgba(102, 126, 234, 0.2);
    font-size: 14px;
}

/* Mobile Full-Screen Reading Mode */
@media (max-width: 768px) {
    .page-container {
        padding-top: 70px;
        transition: padding-top 0.3s ease;
    }
    
    /* Mobile full-screen mode */
    .page-container.mobile-reading-mode {
        padding-top: 0;
    }
    
    .page-container.mobile-reading-mode .main-nav {
        transform: translateY(-100%);
        transition: transform 0.3s ease;
    }
    
    .page-container.mobile-reading-mode .main-nav.nav-visible {
        transform: translateY(0);
    }
    
    .navigation-panel {
        width: 280px;
        right: -280px;
    }
    
    .magazine-content {
        padding: 0.25rem;
        gap: 0.5rem;
    }
    
    /* Maximize PDF area on mobile */
    .pdf-viewer-container {
        height: calc(100vh - 100px); /* Account for controls */
        min-height: 400px;
        border-radius: 8px;
        margin: 0;
        width: 100%;
    }
    
    .page-container.mobile-reading-mode .pdf-viewer-container {
        height: calc(100vh - 70px); /* More space when header hidden */
    }
    
    /* Horizontal/compact controls for mobile */
    .pdf-controls {
        position: fixed;
        bottom: 10px;
        left: 50%;
        transform: translateX(-50%);
        width: calc(100% - 20px);
        max-width: 500px;
        padding: 0.75rem 1rem;
        border-radius: 25px;
        gap: 0.5rem;
        backdrop-filter: blur(20px);
        background: rgba(255, 255, 255, 0.95);
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
        z-index: 100;
        flex-wrap: nowrap;
        overflow-x: auto;
        scrollbar-width: none;
        -ms-overflow-style: none;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        animation: slideUpFadeIn 0.5s ease-out;
    }
    
    @keyframes slideUpFadeIn {
        from {
            opacity: 0;
            transform: translateX(-50%) translateY(20px);
        }
        to {
            opacity: 1;
            transform: translateX(-50%) translateY(0);
        }
    }
    
    .pdf-controls::-webkit-scrollbar {
        display: none;
    }
    
    .control-group {
        flex-shrink: 0;
        gap: 0.4rem;
    }
    
    .control-btn {
        width: 36px;
        height: 36px;
        font-size: 13px;
        flex-shrink: 0;
    }
    
    .page-info,
    .zoom-level {
        padding: 0.4rem 0.8rem;
        font-size: 12px;
        min-width: 60px;
        flex-shrink: 0;
    }
    
    /* Mobile reading mode indicator */
    .mobile-reading-toggle {
        display: block;
        position: fixed;
        top: 10px;
        right: 10px;
        z-index: 101;
        background: rgba(0, 0, 0, 0.7);
        color: white;
        border: none;
        width: 40px;
        height: 40px;
        border-radius: 20px;
        cursor: pointer;
        transition: all 0.3s ease;
    }
    
    .mobile-reading-toggle:hover {
        background: rgba(0, 0, 0, 0.9);
        transform: scale(1.1);
    }
}

@media (max-width: 480px) {
    .page-container {
        padding-top: 65px;
        transition: padding-top 0.3s ease;
    }
    
    .page-container.mobile-reading-mode {
        padding-top: 0;
    }
    
    .navigation-panel {
        width: 100vw;
        right: -100vw;
    }
    
    .magazine-content {
        padding: 0.1rem;
        gap: 0.25rem;
    }
    
    .pdf-viewer-container {
        height: calc(100vh - 80px);
        min-height: 300px;
        border-radius: 4px;
        margin: 0;
        width: 100%;
    }
    
    .page-container.mobile-reading-mode .pdf-viewer-container {
        height: calc(100vh - 60px);
    }
    
    .pdf-controls {
        bottom: 5px;
        width: calc(100% - 10px);
        padding: 0.5rem 0.75rem;
        border-radius: 20px;
        gap: 0.3rem;
    }
    
    .control-group {
        gap: 0.3rem;
    }
    
    .control-btn {
        width: 32px;
        height: 32px;
        font-size: 12px;
    }
    
    .page-info,
    .zoom-level {
        padding: 0.3rem 0.6rem;
        font-size: 11px;
        min-width: 50px;
    }
    
    .mobile-reading-toggle {
        width: 36px;
        height: 36px;
        font-size: 14px;
        top: 8px;
        right: 8px;
    }
}

/* Enhanced Fullscreen Styles */
.pdf-viewer-container:fullscreen {
    border-radius: 0 !important;
    box-shadow: none !important;
}

.pdf-viewer-container:fullscreen iframe {
    border-radius: 0 !important;
}

/* Fullscreen Navigation Arrows */
.fullscreen-nav {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 1000;
}

.fullscreen-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    width: 60px;
    height: 60px;
    border-radius: 30px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    transition: all 0.3s ease;
    pointer-events: auto;
    backdrop-filter: blur(10px);
}

.fullscreen-arrow:hover {
    background: rgba(0, 0, 0, 0.9);
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.fullscreen-prev {
    left: 20px;
}

.fullscreen-next {
    right: 20px;
}

.fullscreen-arrow:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    transform: translateY(-50%) scale(0.9);
}

/* Hide fullscreen arrows on mobile */
@media (max-width: 768px) {
    .fullscreen-arrow {
        width: 50px;
        height: 50px;
        border-radius: 25px;
        font-size: 16px;
    }
    
    .fullscreen-prev {
        left: 10px;
    }
    
    .fullscreen-next {
        right: 10px;
    }
}

/* Loading and Error States */
.pdf-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    color: #e74c3c;
    text-align: center;
    background: #fff;
    border-radius: 15px;
    margin: 2rem;
}

.pdf-error button {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 25px;
    cursor: pointer;
    margin-top: 1rem;
    font-weight: 600;
    transition: all 0.3s ease;
}

.pdf-error button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(231, 76, 60, 0.3);
}

/* Navigation Panel Scrollbar Styling */
.navigation-panel::-webkit-scrollbar {
    width: 6px;
}

.navigation-panel::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
}

.navigation-panel::-webkit-scrollbar-thumb {
    background: rgba(102, 126, 234, 0.3);
    border-radius: 3px;
}

.navigation-panel::-webkit-scrollbar-thumb:hover {
    background: rgba(102, 126, 234, 0.5);
}

/* Enhanced Animations */
.control-btn,
.page-info,
.zoom-level {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.pdf-viewer-container {
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.navigation-panel {
    transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-overlay {
    transition: all 0.3s ease;
}

/* Active nav link styling */
.nav-link.active {
    background: rgba(52, 152, 219, 0.1) !important;
    color: #2c3e50 !important;
    font-weight: 600;
}

/* Print Styles */
@media print {
    .main-nav,
    .magazine-header-section,
    .pdf-controls,
    .navigation-panel,
    .nav-overlay {
        display: none !important;
    }
    
    .page-container {
        padding-top: 0 !important;
    }
    
    .pdf-viewer-container {
        box-shadow: none !important;
        border: none !important;
        height: 100vh !important;
        width: 100% !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .control-btn {
        border: 2px solid currentColor;
    }
    
    .page-info,
    .zoom-level {
        border: 2px solid currentColor;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    * {
        transition: none !important;
        animation: none !important;
    }
}
