/**
 * Three.js PDF Viewer Styles
 * استایل‌های نمایشگر سه‌بعدی PDF
 */

/* Container اصلی نمایشگر */
.threejs-pdf-container {
    position: relative;
    width: 100%;
    height: 600px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    margin: 20px 0;
}

/* Canvas Three.js */
.threejs-pdf-container canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
    border-radius: 15px;
}

/* پنل کنترل‌ها */
.threejs-pdf-controls {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    user-select: none;
}

.controls-panel {
    background: rgba(0, 0, 0, 0.85);
    padding: 12px 25px;
    border-radius: 30px;
    display: flex;
    align-items: center;
    gap: 18px;
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

.controls-panel:hover {
    background: rgba(0, 0, 0, 0.9);
    transform: translateY(-2px);
}

/* دکمه‌های کنترل */
.control-btn {
    background: linear-gradient(45deg, #3498db, #2980b9);
    color: white;
    border: none;
    padding: 10px 18px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    min-width: 80px;
    text-align: center;
}

.control-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;
}

.control-btn:hover {
    background: linear-gradient(45deg, #2980b9, #1f5f8b);
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(52, 152, 219, 0.4);
}

.control-btn:hover::before {
    left: 100%;
}

.control-btn:active {
    transform: translateY(-1px);
}

.control-btn:disabled {
    background: #7f8c8d;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* اطلاعات صفحه */
#pageInfo {
    color: white;
    font-weight: bold;
    font-size: 16px;
    min-width: 80px;
    text-align: center;
    background: rgba(255, 255, 255, 0.1);
    padding: 8px 15px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Loading Screen */
.threejs-loading {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999;
    border-radius: 15px;
}

.loading-content {
    text-align: center;
    color: white;
    max-width: 300px;
}

.loading-content h3 {
    margin-bottom: 20px;
    font-size: 24px;
    font-weight: 300;
}

.loading-content p {
    font-size: 16px;
    margin-bottom: 30px;
    opacity: 0.8;
}

/* Loading Spinner */
.loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-top: 4px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 30px;
    position: relative;
}

.loading-spinner::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 30px;
    height: 30px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid #e74c3c;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    animation: spin 0.8s linear infinite reverse;
}

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

/* Progress Bar */
.loading-progress {
    width: 200px;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    margin: 20px auto;
    overflow: hidden;
}

.loading-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #3498db, #2ecc71);
    border-radius: 2px;
    transition: width 0.3s ease;
    width: 0%;
}

/* Error Screen */
.threejs-error {
    text-align: center;
    padding: 60px 40px;
    color: #e74c3c;
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    border-radius: 15px;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.threejs-error h3 {
    margin-bottom: 20px;
    font-size: 28px;
    font-weight: 300;
}

.threejs-error p {
    margin-bottom: 30px;
    font-size: 16px;
    opacity: 0.8;
    max-width: 400px;
    line-height: 1.6;
}

.threejs-error button {
    background: linear-gradient(45deg, #e74c3c, #c0392b);
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.threejs-error button:hover {
    background: linear-gradient(45deg, #c0392b, #a93226);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(231, 76, 60, 0.4);
}

/* Modal Styles */
.threejs-pdf-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;
    padding: 20px;
}

.threejs-pdf-modal-content {
    width: 90%;
    height: 90%;
    max-width: 1200px;
    max-height: 800px;
    position: relative;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
}

.threejs-pdf-modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 24px;
    z-index: 1001;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.threejs-pdf-modal-close:hover {
    background: rgba(231, 76, 60, 0.8);
    transform: scale(1.1);
}

/* Fullscreen Styles */
.threejs-pdf-container:-webkit-full-screen {
    width: 100vw;
    height: 100vh;
    border-radius: 0;
}

.threejs-pdf-container:-moz-full-screen {
    width: 100vw;
    height: 100vh;
    border-radius: 0;
}

.threejs-pdf-container:fullscreen {
    width: 100vw;
    height: 100vh;
    border-radius: 0;
}

/* Responsive Design */
@media (max-width: 768px) {
    .threejs-pdf-container {
        height: 500px;
        margin: 10px 0;
        border-radius: 10px;
    }
    
    .controls-panel {
        padding: 10px 20px;
        gap: 12px;
        border-radius: 25px;
    }
    
    .control-btn {
        padding: 8px 14px;
        font-size: 12px;
        min-width: 60px;
    }
    
    #pageInfo {
        font-size: 14px;
        min-width: 60px;
        padding: 6px 12px;
    }
    
    .loading-content h3 {
        font-size: 20px;
    }
    
    .loading-content p {
        font-size: 14px;
    }
    
    .loading-spinner {
        width: 50px;
        height: 50px;
    }
    
    .threejs-pdf-modal {
        padding: 10px;
    }
    
    .threejs-pdf-modal-content {
        width: 95%;
        height: 95%;
        border-radius: 15px;
    }
}

@media (max-width: 480px) {
    .threejs-pdf-container {
        height: 400px;
    }
    
    .controls-panel {
        padding: 8px 15px;
        gap: 8px;
        flex-wrap: wrap;
    }
    
    .control-btn {
        padding: 6px 10px;
        font-size: 11px;
        min-width: 50px;
    }
    
    #pageInfo {
        font-size: 12px;
        min-width: 50px;
        padding: 4px 8px;
    }
    
    .threejs-error {
        padding: 40px 20px;
    }
    
    .threejs-error h3 {
        font-size: 22px;
    }
}

/* Animation Classes */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

.fade-out {
    animation: fadeOut 0.5s ease-out;
}

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

@keyframes fadeOut {
    from { opacity: 1; transform: translateY(0); }
    to { opacity: 0; transform: translateY(-20px); }
}

/* Page Flip Animation */
.page-flip {
    animation: pageFlip 0.6s ease-in-out;
}

@keyframes pageFlip {
    0% { transform: rotateY(0deg); }
    50% { transform: rotateY(90deg); }
    100% { transform: rotateY(0deg); }
}

/* Hover Effects */
.threejs-pdf-container:hover .controls-panel {
    opacity: 1;
    transform: translateX(-50%) translateY(-5px);
}

/* Dark Theme Support */
@media (prefers-color-scheme: dark) {
    .threejs-pdf-container {
        background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    }
    
    .controls-panel {
        background: rgba(255, 255, 255, 0.1);
        border: 1px solid rgba(255, 255, 255, 0.2);
    }
    
    .control-btn {
        background: linear-gradient(45deg, #4a90e2, #357abd);
    }
    
    .control-btn:hover {
        background: linear-gradient(45deg, #357abd, #2968a3);
    }
}

/* Print Styles */
@media print {
    .threejs-pdf-controls,
    .threejs-pdf-modal-close {
        display: none !important;
    }
    
    .threejs-pdf-container {
        width: 100% !important;
        height: auto !important;
        box-shadow: none !important;
        border-radius: 0 !important;
    }
}