/* =============================
   E-BOOK VIEWER STYLES
   ============================= */

.pdf-viewer-section {
    padding: 6rem 0;
    background: #f8f9fa;
}

.pdf-viewer-container {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 1.5rem;
    margin: 2rem 0;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: none;
}

.pdf-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    background: #7A34F3;
    color: white;
    border-radius: 12px 12px 0 0;
    margin: -1.5rem -1.5rem 1.5rem -1.5rem;
}

.pdf-header h3 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
}

.pdf-actions {
    display: flex;
    gap: 1rem;
}

.pdf-actions .btn {
    border-color: rgba(255, 255, 255, 0.3);
    color: white;
}

.pdf-actions .btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.5);
    color: white;
}

.pdf-viewer-container-main {
    display: flex;
    gap: 1rem;
    height: 80vh;
    min-height: 600px;
}

.pdf-sidebar {
    width: 180px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    transition: width 0.3s ease;
    overflow: hidden;
}

.pdf-sidebar.collapsed {
    width: 50px;
}

.pdf-sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid #e5e7eb;
    background: #f8f9fa;
}

.pdf-sidebar-header h4 {
    margin: 0;
    font-size: 1rem;
    color: #374151;
}

.sidebar-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem;
    color: #6b7280;
    transition: color 0.2s ease;
}

.sidebar-toggle:hover {
    color: #374151;
}

.pdf-sidebar.collapsed .pdf-sidebar-header h4 {
    display: none;
}

.pdf-thumbnails {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
}

.pdf-thumbnail {
    position: relative;
    margin-bottom: 0.5rem;
    cursor: pointer;
    border: 2px solid transparent;
    border-radius: 4px;
    overflow: hidden;
    transition: all 0.2s ease;
    min-height: 120px;
}

.pdf-thumbnail:hover {
    border-color: #7A34F3;
    transform: scale(1.02);
}

.pdf-thumbnail.active {
    border-color: #7A34F3;
    box-shadow: 0 0 0 2px rgba(122, 52, 243, 0.2);
}

.thumbnail-canvas {
    width: 100%;
    height: auto;
    display: block;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
}

.thumbnail-page-number {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    text-align: center;
    font-size: 0.75rem;
    padding: 0.25rem;
}

.pdf-sidebar.collapsed .pdf-thumbnails {
    display: none;
}

.pdf-viewer {
    flex: 1;
    display: flex;
    justify-content: center;
    background: white;
    border-radius: 8px;
    padding: 1rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    overflow: auto;
    position: relative;
}

#pdfCanvas {
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    max-width: 100%;
    height: auto;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
}

.pdf-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-top: 1.5rem;
    flex-wrap: wrap;
}

.pdf-btn {
    background: #7A34F3;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
}

.pdf-btn:hover:not(:disabled) {
    background: #6a2fd8;
    transform: translateY(-2px);
}

.pdf-btn:disabled {
    background: #9ca3af;
    cursor: not-allowed;
    transform: none;
}

.page-info, .zoom-info {
    font-weight: 600;
    color: #374151;
    min-width: 120px;
    text-align: center;
}

.pdf-loading {
    text-align: center;
    padding: 3rem;
    display: none;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f4f6;
    border-top: 4px solid #7A34F3;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

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

/* =============================
   RESPONSIVE DESIGN
   ============================= */

@media (max-width: 768px) {
    .pdf-header {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }

    .pdf-actions {
        flex-direction: column;
        width: 100%;
    }

    .pdf-actions .btn {
        width: 100%;
    }

    .pdf-controls {
        flex-direction: column;
        gap: 0.5rem;
    }

    .pdf-btn {
        width: 100%;
        justify-content: center;
    }

    .pdf-viewer-container-main {
        flex-direction: column;
        height: auto;
    }

    .pdf-sidebar {
        width: 100%;
        height: 200px;
        order: 2;
    }

    .pdf-sidebar.collapsed {
        height: 50px;
    }

    .pdf-viewer {
        order: 1;
        min-height: 500px;
    }

    .pdf-thumbnails {
        display: flex;
        overflow-x: auto;
        overflow-y: hidden;
        padding: 0.5rem;
    }

    .pdf-thumbnail {
        flex-shrink: 0;
        width: 140px;
        margin-right: 0.5rem;
        margin-bottom: 0;
        min-height: 100px;
    }
}

@media (max-width: 480px) {
    .pdf-viewer-section {
        padding: 2rem 1rem;
    }

    .pdf-header {
        padding: 1rem;
    }

    .pdf-header h3 {
        font-size: 1.2rem;
    }

    .pdf-viewer {
        min-height: 50vh;
    }
}
