/* Library Resource Enhancement Styles */

/* PDF Viewer Enhancements */
.pdf-preview {
    position: relative;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    overflow: hidden;
    margin: 2rem 0;
}

.pdf-preview::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
    z-index: 1;
}

.pdf-preview iframe {
    width: 100%;
    min-height: 600px;
    border: none;
    display: block;
    background: white;
}

.pdf-fallback {
    display: none;
    padding: 2rem;
    text-align: center;
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 8px;
    margin: 1rem 0;
}

.pdf-fallback.show {
    display: block;
}

.pdf-fallback h4 {
    color: #856404;
    margin-bottom: 1rem;
}

.pdf-fallback p {
    color: #856404;
    margin-bottom: 1rem;
}

.pdf-fallback .btn {
    margin: 0.5rem;
}

/* Enhanced Action Buttons */
.resource-action-buttons .btn {
    position: relative;
    overflow: hidden;
}

.resource-action-buttons .btn::before {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.resource-action-buttons .btn:hover::before {
    left: 100%;
}

/* Download Progress Indicator */
.download-progress {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0,0,0,0.8);
    color: white;
    padding: 2rem;
    border-radius: 8px;
    text-align: center;
    z-index: 9999;
    display: none;
}

.download-progress.show {
    display: block;
}

.download-progress .spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Resource Type Icons */
.resource-type-badge::before {
    margin-right: 0.5rem;
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
}

.badge-pdf::before {
    content: "\f1c1"; /* fa-file-pdf */
}

.badge-video::before {
    content: "\f03d"; /* fa-video */
}

.badge-article::before {
    content: "\f15c"; /* fa-file-text */
}

.badge-research::before {
    content: "\f0f6"; /* fa-file-text-o */
}

/* Accessibility Improvements */
.resource-action-buttons .btn:focus {
    outline: 3px solid var(--accent-color);
    outline-offset: 2px;
}

.pdf-preview iframe:focus {
    outline: 3px solid var(--primary-color);
    outline-offset: 2px;
}

/* Print Styles */
@media print {
    .resource-header,
    .resource-sidebar,
    .resource-navigation,
    .resource-share,
    .back-to-library {
        display: none !important;
    }
    
    .content-wrapper {
        grid-template-columns: 1fr;
    }
    
    .resource-actions-section {
        display: none !important;
    }
}

/* Dark Mode Support (if needed) */
@media (prefers-color-scheme: dark) {
    .pdf-preview {
        background: #2d2d2d;
        border-color: #555;
    }
    
    .pdf-fallback {
        background: #3d3d3d;
        border-color: #666;
        color: #e0e0e0;
    }
    
    .pdf-fallback h4,
    .pdf-fallback p {
        color: #e0e0e0;
    }
}

/* Loading State for PDF */
.pdf-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    background: #f8f9fa;
    border-radius: 8px;
    flex-direction: column;
    gap: 1rem;
}

.pdf-loading .spinner {
    width: 60px;
    height: 60px;
    border: 6px solid #e3e3e3;
    border-top: 6px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.pdf-loading p {
    color: var(--text-light);
    font-size: 1.1rem;
}

/* Enhanced Mobile Experience */
@media (max-width: 768px) {
    .pdf-preview iframe {
        min-height: 400px;
    }
    
    .resource-action-buttons {
        flex-direction: column;
        align-items: stretch;
    }
    
    .resource-action-buttons .btn {
        width: 100%;
        margin-bottom: 0.5rem;
    }
}

@media (max-width: 480px) {
    .pdf-preview iframe {
        min-height: 300px;
    }
    
    .resource-actions-section {
        padding: 1rem;
    }
}
