/**
 * DOCUMENT VIEWER STYLES
 * Modal viewer for images, PDFs, and Office documents
 */

/* Modal Overlay */
.document-viewer-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    padding: 20px;
}

.document-viewer-modal.open {
    opacity: 1;
}

/* Container */
.document-viewer-container {
    background: white;
    border-radius: 12px;
    width: 100%;
    max-width: 1400px;
    max-height: 95vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Header */
.document-viewer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 25px;
    border-bottom: 1px solid #e5e7eb;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px 12px 0 0;
    gap: 20px;
    flex-wrap: wrap;
}

.document-viewer-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.2rem;
    font-weight: 600;
    color: white;
    flex: 1;
    min-width: 200px;
}

.document-viewer-title span:first-child {
    font-size: 1.5rem;
}

.document-viewer-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.viewer-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.95rem;
    white-space: nowrap;
}

.viewer-btn-download {
    background: #10b981;
    color: white;
}

.viewer-btn-download:hover {
    background: #059669;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.viewer-btn-close {
    background: #ef4444;
    color: white;
}

.viewer-btn-close:hover {
    background: #dc2626;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

/* Content */
.document-viewer-content {
    flex: 1;
    overflow: auto;
    background: #f9fafb;
    position: relative;
    min-height: 400px;
}

/* Footer */
.document-viewer-footer {
    padding: 15px 25px;
    border-top: 1px solid #e5e7eb;
    background: #f9fafb;
    border-radius: 0 0 12px 12px;
}

.document-description {
    color: #4b5563;
    font-size: 0.95rem;
    line-height: 1.5;
}

/* Image Viewer */
.image-viewer {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 500px;
    padding: 20px;
    position: relative;
}

.image-viewer img {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

/* PDF Viewer */
.pdf-viewer {
    position: relative;
    min-height: 70vh;
}

.pdf-viewer iframe {
    width: 100%;
    height: 70vh;
    border: none;
}

/* Office Viewer */
.office-viewer {
    position: relative;
    min-height: 70vh;
}

.office-viewer iframe {
    width: 100%;
    height: 70vh;
    border: none;
}

.office-viewer-note {
    padding: 15px;
    background: #fef3c7;
    border-left: 4px solid #f59e0b;
    margin: 15px;
    border-radius: 8px;
}

.office-viewer-note small {
    color: #92400e;
    font-size: 0.9rem;
}

/* Loading Indicator */
.loading-indicator {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    z-index: 10;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #e5e7eb;
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-indicator > div:last-child {
    color: #6b7280;
    font-size: 1rem;
    font-weight: 500;
}

/* Error Messages */
.viewer-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 500px;
    padding: 40px;
    text-align: center;
}

.error-icon {
    font-size: 4rem;
    margin-bottom: 20px;
}

.error-message {
    color: #dc2626;
    font-size: 1.1rem;
    font-weight: 500;
    max-width: 500px;
}

/* Unsupported Viewer */
.unsupported-viewer {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 500px;
    padding: 40px;
    text-align: center;
}

.unsupported-icon {
    font-size: 5rem;
    margin-bottom: 20px;
    opacity: 0.5;
}

.unsupported-text {
    color: #6b7280;
    font-size: 1.2rem;
    font-weight: 500;
    max-width: 500px;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .document-viewer-modal {
        padding: 10px;
    }
    
    .document-viewer-container {
        max-height: 98vh;
        border-radius: 8px;
    }
    
    .document-viewer-header {
        padding: 15px;
        border-radius: 8px 8px 0 0;
    }
    
    .document-viewer-title {
        font-size: 1rem;
    }
    
    .document-viewer-title span:first-child {
        font-size: 1.2rem;
    }
    
    .viewer-btn {
        padding: 8px 15px;
        font-size: 0.9rem;
    }
    
    .image-viewer {
        min-height: 300px;
        padding: 10px;
    }
    
    .pdf-viewer iframe,
    .office-viewer iframe {
        height: 60vh;
    }
    
    .office-viewer-note {
        margin: 10px;
        padding: 12px;
    }
}

/* Dark theme support */
@media (prefers-color-scheme: dark) {
    .document-viewer-container {
        background: #1f2937;
        color: white;
    }
    
    .document-viewer-header {
        border-bottom-color: #374151;
    }
    
    .document-viewer-content {
        background: #111827;
    }
    
    .document-viewer-footer {
        background: #1f2937;
        border-top-color: #374151;
    }
    
    .document-description {
        color: #d1d5db;
    }
    
    .loading-indicator > div:last-child {
        color: #9ca3af;
    }
    
    .unsupported-text {
        color: #9ca3af;
    }
}

/* Print styles */
@media print {
    .document-viewer-modal {
        position: static;
        background: white;
    }
    
    .document-viewer-header,
    .document-viewer-footer,
    .viewer-btn {
        display: none;
    }
    
    .document-viewer-container {
        max-width: 100%;
        max-height: none;
        box-shadow: none;
    }
    
    .document-viewer-content {
        overflow: visible;
    }
}
