/**
 * READER STYLE CSS - PERPUSTAKAAN DIGITAL MTS DARUL ULUM
 * CSS untuk Halaman Baca Buku / PDF Viewer
 * Modern, Clean & Focused Reading Experience
 */

/* ============================================
   VARIABLES & COLORS
   ============================================ */
:root {
    /* Primary Colors */
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --secondary: #8b5cf6;
    
    /* Neutral Colors */
    --dark: #0f172a;
    --dark-light: #1e293b;
    --gray: #64748b;
    --gray-light: #94a3b8;
    --gray-lighter: #cbd5e1;
    --light: #f1f5f9;
    --lighter: #f8fafc;
    --white: #ffffff;
    
    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.05);
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 8px 30px rgba(0, 0, 0, 0.12);
    --shadow-lg: 0 15px 50px rgba(0, 0, 0, 0.15);
    
    /* Transitions */
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: all 0.15s ease;
    
    /* Border Radius */
    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 20px;
}

/* ============================================
   RESET & BASE
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--lighter);
    color: var(--dark-light);
    line-height: 1.6;
    overflow-x: hidden;
}

/* ============================================
   READER NAVBAR
   ============================================ */
.reader-navbar {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    padding: 1.2rem 0;
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 0;
    z-index: 1000;
    backdrop-filter: blur(10px);
}

.book-title {
    color: var(--white);
    font-size: 1.3rem;
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.book-title i {
    flex-shrink: 0;
}

.btn-back {
    background: rgba(255, 255, 255, 0.2);
    color: var(--white);
    border: 2px solid rgba(255, 255, 255, 0.3);
    padding: 0.6rem 1.5rem;
    border-radius: var(--radius);
    font-weight: 500;
    transition: var(--transition);
    backdrop-filter: blur(10px);
    display: inline-flex;
    align-items: center;
}

.btn-back:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateX(-5px);
    color: var(--white);
}

/* ============================================
   PDF CONTAINER
   ============================================ */
.pdf-container {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    margin-bottom: 2rem;
}

.pdf-toolbar {
    background: linear-gradient(135deg, var(--dark) 0%, var(--dark-light) 100%);
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.toolbar-controls {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.pdf-toolbar .btn {
    background: rgba(255, 255, 255, 0.1);
    color: var(--white);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.pdf-toolbar .btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

.pdf-toolbar .btn i {
    font-size: 1rem;
}

/* PDF Loading */
.pdf-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--lighter);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.pdf-loading .spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--gray-lighter);
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

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

.pdf-loading p {
    font-size: 1rem;
    color: var(--gray);
}

/* PDF Viewer */
.pdf-viewer {
    width: 100%;
    height: 80vh;
    min-height: 600px;
    border: none;
    display: block;
}

/* ============================================
   BOOK INFO CARD
   ============================================ */
.book-info-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
    position: sticky;
    top: 100px;
}

.book-cover-large {
    width: 100%;
    height: 300px;
    object-fit: cover;
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-md);
}

.book-cover-placeholder {
    width: 100%;
    height: 300px;
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--secondary) 100%);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-md);
}

.book-cover-placeholder i {
    font-size: 4rem;
    color: var(--white);
    opacity: 0.5;
}

.book-info-card h5 {
    color: var(--dark);
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
    line-height: 1.4;
}

.info-item {
    display: flex;
    align-items: flex-start;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--gray-lighter);
    gap: 1rem;
}

.info-item:last-child {
    border-bottom: none;
}

.info-item i {
    font-size: 1.2rem;
    color: var(--primary);
    flex-shrink: 0;
    margin-top: 0.2rem;
}

.info-label {
    font-size: 0.85rem;
    color: var(--gray);
    font-weight: 500;
}

.info-value {
    font-size: 0.95rem;
    color: var(--dark-light);
    font-weight: 600;
}

/* ============================================
   RELATED BOOKS
   ============================================ */
.related-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 1rem;
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    transition: var(--transition);
    border: 1px solid var(--gray-lighter);
}

.related-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-light);
}

.related-cover {
    width: 60px;
    height: 80px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
}

.related-cover-placeholder {
    width: 60px;
    height: 80px;
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--secondary) 100%);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.related-cover-placeholder i {
    font-size: 1.5rem;
    color: var(--white);
    opacity: 0.5;
}

.related-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.related-title {
    color: var(--dark);
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: 0.5rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.related-views {
    color: var(--gray);
    font-size: 0.8rem;
    display: flex;
    align-items: center;
}

/* ============================================
   READING MODE BUTTON
   ============================================ */
.reading-mode-btn {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: var(--white);
    border: none;
    border-radius: 50%;
    box-shadow: var(--shadow-lg);
    cursor: pointer;
    transition: var(--transition);
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.reading-mode-btn:hover {
    transform: scale(1.1) rotate(5deg);
    box-shadow: var(--shadow-xl);
}

.reading-mode-btn i {
    font-size: 1.5rem;
}

/* ============================================
   FULLSCREEN MODE
   ============================================ */
body.fullscreen-mode {
    overflow: hidden;
}

body.fullscreen-mode .reader-navbar,
body.fullscreen-mode .book-info-card,
body.fullscreen-mode .col-lg-3,
body.fullscreen-mode .reading-mode-btn {
    display: none;
}

body.fullscreen-mode .col-lg-9 {
    width: 100%;
    max-width: 100%;
    flex: 0 0 100%;
}

body.fullscreen-mode .pdf-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    margin: 0;
    border-radius: 0;
    z-index: 9999;
}

body.fullscreen-mode .pdf-viewer {
    height: calc(100vh - 60px);
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */
@media (max-width: 992px) {
    .book-info-card {
        position: relative;
        top: 0;
    }
    
    .pdf-viewer {
        height: 70vh;
        min-height: 500px;
    }
}

@media (max-width: 768px) {
    .reader-navbar {
        padding: 1rem 0;
    }
    
    .book-title {
        font-size: 1rem;
        margin-bottom: 0.5rem;
    }
    
    .btn-back {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
        width: 100%;
        justify-content: center;
    }
    
    .pdf-toolbar {
        padding: 0.75rem;
    }
    
    .toolbar-controls {
        flex-wrap: wrap;
        width: 100%;
    }
    
    .pdf-toolbar .btn {
        padding: 0.4rem 0.75rem;
        font-size: 0.85rem;
        flex: 1;
        min-width: 120px;
    }
    
    .pdf-viewer {
        height: 60vh;
        min-height: 400px;
    }
    
    .book-cover-large,
    .book-cover-placeholder {
        height: 250px;
    }
    
    .reading-mode-btn {
        bottom: 1rem;
        right: 1rem;
        width: 48px;
        height: 48px;
    }
    
    .reading-mode-btn i {
        font-size: 1.2rem;
    }
}

@media (max-width: 576px) {
    .book-title {
        font-size: 0.9rem;
    }
    
    .book-title i {
        display: none;
    }
    
    .pdf-toolbar .btn span {
        display: none;
    }
    
    .pdf-toolbar .btn {
        min-width: auto;
        padding: 0.4rem 0.6rem;
    }
    
    .pdf-viewer {
        height: 50vh;
        min-height: 350px;
    }
    
    .info-item {
        padding: 0.5rem 0;
    }
    
    .info-item i {
        font-size: 1rem;
    }
    
    .info-label {
        font-size: 0.75rem;
    }
    
    .info-value {
        font-size: 0.85rem;
    }
}

/* ============================================
   PRINT STYLES
   ============================================ */
@media print {
    .reader-navbar,
    .pdf-toolbar,
    .book-info-card,
    .reading-mode-btn {
        display: none !important;
    }
    
    .pdf-container {
        box-shadow: none;
        border-radius: 0;
    }
    
    .pdf-viewer {
        height: auto;
        min-height: auto;
    }
}

/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
    }
    to {
        transform: translateX(0);
    }
}

.pdf-container,
.book-info-card {
    animation: fadeIn 0.5s ease-out;
}

/* ============================================
   UTILITIES
   ============================================ */
.text-muted {
    color: var(--gray) !important;
}

.fw-bold {
    font-weight: 700 !important;
}

.mb-3 {
    margin-bottom: 1rem !important;
}

/* ============================================
   DARK MODE SUPPORT (Optional)
   ============================================ */
@media (prefers-color-scheme: dark) {
    :root {
        --dark: #f8fafc;
        --dark-light: #e2e8f0;
        --lighter: #0f172a;
        --white: #1e293b;
        --light: #334155;
    }
    
    body {
        background: var(--lighter);
        color: var(--dark-light);
    }
    
    .pdf-container,
    .book-info-card,
    .related-card {
        background: var(--white);
    }
    
    .info-item {
        border-color: #334155;
    }
}

/* ============================================
   ACCESSIBILITY
   ============================================ */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

*:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* ============================================
   CUSTOM SCROLLBAR
   ============================================ */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--light);
}

::-webkit-scrollbar-thumb {
    background: var(--gray-light);
    border-radius: var(--radius-sm);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gray);
}