/**
 * Documents System Styles
 * Independent styling for documents/books archive system
 * Version: 1.0.0
 * Author: Syria Today Theme
 */

/* ==========================================================================
   1. Single Document Page Styles
   ========================================================================== */

.single-document-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px 15px;
    background: #f5f7fa;
    min-height: 100vh;
}

.document-breadcrumbs {
    margin-bottom: 20px;
    font-size: 14px;
}

/* ==========================================================================
   2. Document Header Section
   ========================================================================== */

.document-header {
    background: #ffffff;
    border-radius: 16px;
    padding: 40px;
    margin-bottom: 30px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

.header-content {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 40px;
    align-items: start;
}

/* Document Thumbnail */
.document-thumbnail,
.document-thumbnail-default {
    width: 100%;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.document-thumbnail img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
}

.document-thumbnail-default {
    aspect-ratio: 3/4;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.thumb-icon {
    font-size: 100px;
    color: rgba(255, 255, 255, 0.9);
}

/* Meta Badges */
.document-meta-badges {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.badge {
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    display: inline-block;
}

.badge-type {
    background: #edf2f7;
    color: #4a5568;
}

.badge-language {
    background: #e6fffa;
    color: #047857;
}

.badge-year {
    background: #fef3c7;
    color: #92400e;
}

/* Document Title */
.document-title {
    font-size: 36px;
    font-weight: 800;
    color: #2d3748;
    margin: 0 0 15px 0;
    line-height: 1.3;
}

/* Author Info */
.document-author-info {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #718096;
    font-size: 16px;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

.document-author-info svg {
    flex-shrink: 0;
}

.document-author-info .author-link {
    color: inherit;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s ease;
}

.document-author-info .author-link:hover {
    color: #f59e0b;
    text-decoration: underline;
}

.separator {
    color: #cbd5e0;
}

/* Stats Header */
.document-stats-header {
    display: flex;
    gap: 30px;
    flex-wrap: wrap;
    margin-bottom: 25px;
    padding: 20px 0;
    border-top: 2px solid #e8ecf1;
    border-bottom: 2px solid #e8ecf1;
}

.document-stats-header .stat-item {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #4a5568;
    font-size: 15px;
}

.document-stats-header .stat-item svg {
    flex-shrink: 0;
    color: #667eea;
}

/* Action Buttons */
.document-actions-header {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.btn-download-primary,
.btn-preview,
.btn-source {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 28px;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-download-primary {
    background: #667eea;
    color: #ffffff;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.btn-download-primary:hover {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
    color: #ffffff;
    text-decoration: none;
}

.btn-preview {
    background: #48bb78;
    color: #ffffff;
}

.btn-preview:hover {
    background: #38a169;
    transform: translateY(-2px);
}

.btn-preview.active {
    background: #2f855a;
    box-shadow: 0 4px 15px rgba(56, 161, 105, 0.4);
}

.btn-source {
    background: #f7fafc;
    color: #4a5568;
    border: 2px solid #e2e8f0;
}

.btn-source:hover {
    background: #edf2f7;
    border-color: #cbd5e0;
    color: #2d3748;
    text-decoration: none;
}

/* ==========================================================================
   3. PDF Preview Modal
   ========================================================================== */

.pdf-preview-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 10000;
    padding: 20px;
    display: none;
}

.pdf-preview-container.active {
    display: block;
}

.pdf-preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    color: #ffffff;
}

.pdf-preview-header h3 {
    margin: 0;
    font-size: 20px;
}

.close-preview {
    background: #f56565;
    border: none;
    color: #ffffff;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.close-preview:hover {
    background: #e53e3e;
    transform: scale(1.1);
}

.pdf-iframe {
    width: 100%;
    height: calc(100% - 60px);
    border: none;
    border-radius: 8px;
    background: #ffffff;
}

/* ==========================================================================
   3.5. Embedded Preview Section (PDF, EPUB, HTML)
   ========================================================================== */

.embedded-preview-container {
    background: #ffffff;
    border-radius: 16px;
    margin: 30px auto;
    max-width: 1200px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.preview-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #ffffff;
}

.preview-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.preview-info h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
}

.preview-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.control-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #ffffff;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.3s ease;
}

.control-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
}

#zoomLevel {
    font-size: 14px;
    font-weight: 600;
    min-width: 50px;
    text-align: center;
}

.separator {
    color: rgba(255, 255, 255, 0.5);
    font-size: 18px;
}

.preview-content {
    position: relative;
    background: #f5f7fa;
    min-height: 600px;
}

/* PDF Viewer */
.document-iframe {
    width: 100%;
    height: 700px;
    border: none;
    display: block;
}

.pdf-viewer {
    transition: transform 0.3s ease;
}

/* EPUB Viewer */
.epub-viewer {
    width: 100%;
    min-height: 600px;
    background: #ffffff;
    position: relative;
    padding: 20px;
}

.epub-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.epub-controls {
    background: #ffffff;
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 2px solid #e8ecf1;
}

.epub-nav-btn {
    background: #667eea;
    color: #ffffff;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.epub-nav-btn:hover {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.epub-nav-btn:disabled {
    background: #cbd5e0;
    cursor: not-allowed;
    transform: none;
}

#epubLocation {
    font-size: 15px;
    color: #4a5568;
    font-weight: 500;
}

/* HTML Viewer */
.html-viewer {
    background: #ffffff;
}

/* Fullscreen mode */
.embedded-preview-container:fullscreen {
    padding: 0;
}

.embedded-preview-container:fullscreen .preview-content {
    height: calc(100vh - 80px);
}

.embedded-preview-container:fullscreen .document-iframe {
    height: 100%;
}

/* ==========================================================================
   4. Content Sections
   ========================================================================== */

.document-content-wrapper {
    background: #ffffff;
    border-radius: 16px;
    padding: 40px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

.content-section {
    margin-bottom: 40px;
}

.content-section:last-child {
    margin-bottom: 0;
}

.section-title {
    font-size: 24px;
    font-weight: 700;
    color: #2d3748;
    margin: 0 0 20px 0;
    padding-bottom: 15px;
    border-bottom: 3px solid #667eea;
}

.document-description {
    font-size: 16px;
    line-height: 1.8;
    color: #4a5568;
}

.document-description p {
    margin-bottom: 15px;
}

.document-description p:last-child {
    margin-bottom: 0;
}

/* ==========================================================================
   5. Information Grid
   ========================================================================== */

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.info-item {
    background: #f7fafc;
    padding: 15px 20px;
    border-radius: 10px;
    border-left: 4px solid #667eea;
    transition: all 0.3s ease;
}

.info-item:hover {
    background: #edf2f7;
    transform: translateX(5px);
}

.info-label {
    font-size: 13px;
    color: #718096;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 5px;
}

.info-value {
    font-size: 16px;
    color: #2d3748;
    font-weight: 500;
}

.info-value a {
    color: #f59e0b;
    text-decoration: none;
    font-weight: 600;
    transition: opacity 0.3s ease;
}

.info-value a:hover {
    opacity: 0.7;
    text-decoration: underline;
}

/* ==========================================================================
   6. Taxonomy (Categories & Tags)
   ========================================================================== */

.taxonomy-group {
    margin-bottom: 20px;
}

.taxonomy-group:last-child {
    margin-bottom: 0;
}

.taxonomy-label {
    font-size: 14px;
    font-weight: 600;
    color: #4a5568;
    margin-bottom: 10px;
}

.taxonomy-terms {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.term-badge {
    background: #edf2f7;
    color: #4a5568;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
    display: inline-block;
}

.term-badge:hover {
    background: #667eea;
    color: #ffffff;
    text-decoration: none;
    transform: translateY(-2px);
}

.tag-badge {
    background: #e6fffa;
    color: #047857;
}

.tag-badge:hover {
    background: #0d9488;
    color: #ffffff;
}

/* ==========================================================================
   7. Related Documents - Compact Horizontal Cards
   ========================================================================== */

.related-documents-compact {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.related-doc-card-horizontal {
    display: flex;
    gap: 15px;
    padding: 12px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.related-doc-card-horizontal:hover {
    border-color: #f59e0b;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.15);
    transform: translateX(-3px);
}

.related-doc-thumb {
    flex-shrink: 0;
    width: 60px;
    height: 85px;
    border-radius: 6px;
    overflow: hidden;
    background: #f1f5f9;
}

.related-doc-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.related-doc-thumb-default {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
}

.related-doc-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.related-doc-title {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.4;
}

.related-doc-title a {
    color: #1e293b;
    text-decoration: none;
    transition: color 0.3s ease;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-clamp: 2;
    overflow: hidden;
}

.related-doc-title a:hover {
    color: #f59e0b;
}

.related-doc-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    font-size: 12px;
    color: #64748b;
}

.related-doc-meta span {
    display: flex;
    align-items: center;
    gap: 3px;
}

.related-documents-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
}

/* ==========================================================================
   8. Responsive Design
   ========================================================================== */

/* Tablets (992px and below) */
@media (max-width: 992px) {
    .header-content {
        grid-template-columns: 1fr;
        gap: 25px;
    }
    
    .document-thumbnail,
    .document-thumbnail-default {
        max-width: 300px;
        margin: 0 auto;
    }
    
    .document-title {
        font-size: 32px;
    }
}

/* Mobile Devices (768px and below) */
@media (max-width: 768px) {
    .single-document-wrapper {
        padding: 15px 10px;
    }
    
    .document-header,
    .document-content-wrapper {
        padding: 25px 20px;
        border-radius: 12px;
    }
    
    .document-title {
        font-size: 28px;
    }
    
    .document-stats-header {
        flex-direction: column;
        gap: 15px;
    }
    
    .document-actions-header {
        flex-direction: column;
    }
    
    .btn-download-primary,
    .btn-preview,
    .btn-source {
        width: 100%;
        justify-content: center;
    }
    
    .info-grid {
        grid-template-columns: 1fr;
    }
    
    .related-documents-grid {
        grid-template-columns: 1fr;
    }
    
    .section-title {
        font-size: 20px;
    }
    
    /* Embedded Preview Mobile */
    .preview-header {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }
    
    .preview-controls {
        width: 100%;
        justify-content: space-between;
    }
    
    .document-iframe {
        height: 500px;
    }
    
    .epub-controls {
        flex-direction: column;
        gap: 15px;
    }
    
    .epub-nav-btn {
        width: 100%;
        justify-content: center;
    }
}

/* Small Mobile (480px and below) */
@media (max-width: 480px) {
    .document-header,
    .document-content-wrapper {
        padding: 20px 15px;
    }
    
    .document-title {
        font-size: 24px;
    }
    
    .thumb-icon {
        font-size: 70px;
    }
    
    .badge {
        font-size: 12px;
        padding: 5px 12px;
    }
}

/* ==========================================================================
   9. Print Styles
   ========================================================================== */

@media print {
    .document-actions-header,
    .btn-preview,
    .pdf-preview-container,
    .related-documents-grid {
        display: none !important;
    }
    
    .single-document-wrapper {
        background: #ffffff;
    }
    
    .document-header,
    .document-content-wrapper {
        box-shadow: none;
    }
}
