/**
 * 3D Product Previewer - Frontend CSS
 * Styles pour le viewer 3D et les contrôles
 */

/* Container principal du viewer */
.tpp-viewer-container {
    position: relative;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    background: #f9f9f9;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin: 20px 0;
}

/* Viewer 3D */
.tpp-viewer {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 300px;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.tpp-viewer canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
    cursor: grab;
}

.tpp-viewer canvas:active {
    cursor: grabbing;
}

/* Contrôles du viewer */
.tpp-controls {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 100;
    display: flex;
    gap: 5px;
}

.tpp-controls-group {
    display: flex;
    gap: 5px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 6px;
    padding: 5px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.tpp-btn {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #555;
    font-size: 16px;
}

.tpp-btn:hover {
    background: #f0f0f0;
    border-color: #999;
    color: #333;
    transform: translateY(-1px);
}

.tpp-btn:active {
    transform: translateY(0);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.tpp-btn .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
}

/* Loading state */
.tpp-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 50;
}

.tpp-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    animation: tpp-spin 1s linear infinite;
    margin-bottom: 15px;
}

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

.tpp-loading p {
    margin: 0;
    color: #666;
    font-size: 14px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

/* Error state */
.tpp-error-message {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
}

.tpp-error-message p {
    color: #d63031;
    font-size: 16px;
    text-align: center;
    margin: 0;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

/* Informations du modèle */
.tpp-model-info {
    padding: 15px;
    background: #fff;
    border-top: 1px solid #eee;
}

.tpp-model-info h4 {
    margin: 0 0 8px 0;
    font-size: 16px;
    color: #333;
    font-weight: 600;
}

.tpp-model-meta {
    display: flex;
    gap: 15px;
    font-size: 12px;
    color: #777;
}

.tpp-file-type {
    background: #e3f2fd;
    color: #1976d2;
    padding: 2px 6px;
    border-radius: 3px;
    font-weight: 500;
    text-transform: uppercase;
}

.tpp-file-size {
    font-weight: 500;
}

/* Fullscreen mode */
.tpp-viewer-container:fullscreen {
    background: #000;
}

.tpp-viewer-container:fullscreen .tpp-viewer {
    background: #000;
}

.tpp-viewer-container:fullscreen .tpp-model-info {
    display: none;
}

/* Responsive design */
@media (max-width: 768px) {
    .tpp-controls {
        top: 5px;
        right: 5px;
    }
    
    .tpp-btn {
        width: 32px;
        height: 32px;
    }
    
    .tpp-btn .dashicons {
        font-size: 16px;
        width: 16px;
        height: 16px;
    }
    
    .tpp-model-info {
        padding: 10px;
    }
    
    .tpp-model-info h4 {
        font-size: 14px;
    }
    
    .tpp-model-meta {
        font-size: 11px;
    }
}

@media (max-width: 480px) {
    .tpp-viewer {
        min-height: 250px;
    }
    
    .tpp-model-meta {
        flex-direction: column;
        gap: 5px;
    }
}

/* Personnalisation pour le mode sombre */
@media (prefers-color-scheme: dark) {
    .tpp-viewer-container {
        border-color: #444;
        background: #2c2c2c;
    }
    
    .tpp-viewer {
        background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    }
    
    .tpp-controls-group {
        background: rgba(44, 44, 44, 0.9);
    }
    
    .tpp-btn {
        background: #444;
        border-color: #666;
        color: #ccc;
    }
    
    .tpp-btn:hover {
        background: #555;
        border-color: #888;
        color: #fff;
    }
    
    .tpp-model-info {
        background: #2c2c2c;
        border-color: #444;
    }
    
    .tpp-model-info h4 {
        color: #fff;
    }
    
    .tpp-model-meta {
        color: #aaa;
    }
    
    .tpp-loading {
        background: rgba(44, 44, 44, 0.95);
    }
    
    .tpp-loading p {
        color: #ccc;
    }
    
    .tpp-error-message {
        background: rgba(44, 44, 44, 0.95);
    }
}
