/* YRewrite Metainfo Media Preview Styles */

.rex-media-preview-container {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 10px;
    margin-top: 10px;
}

.rex-media-preview-item {
    position: relative;
    transition: all 0.3s ease;
}

.rex-media-preview-item:hover {
    transform: translateY(-2px);
}

.rex-js-media-preview-click {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}

.rex-js-media-preview-click:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
    transform: scale(1.05);
}

/* Modal Styling */
.rex-media-preview-modal .modal-content {
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}

.rex-media-preview-modal .modal-header {
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
}

.rex-media-preview-modal .modal-body {
    background: #fff;
}

/* SVG specific styling */
.rex-media-preview-item img[src$=".svg"],
.rex-media-preview-item img[title*="(SVG)"] {
    background: #f8f9fa;
    padding: 8px;
    object-fit: contain !important;
}

.rex-media-preview-view img[src$=".svg"],
.rex-media-preview-view img[title*="(SVG)"] {
    background: #f8f9fa;
    padding: 4px;
    object-fit: contain !important;
}

/* Responsive Improvements */
@media (max-width: 768px) {
    .rex-media-preview-item img {
        width: 60px !important;
        height: 60px !important;
    }
    
    .modal-lg {
        max-width: 95vw;
    }
    
    .modal-dialog {
        margin: 15px auto;
    }
}

/* Lazy Loading Styles */
.rex-media-lazy {
    opacity: 0.7;
    background: #f8f9fa;
    transition: opacity 0.3s ease;
    position: relative;
}

.rex-media-lazy.loaded {
    opacity: 1;
}

.rex-media-lazy:not(.loaded)::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    border: 2px solid #ddd;
    border-top: 2px solid #337ab7;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    pointer-events: none;
}

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

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .rex-media-preview-container {
        background: #343a40;
    }
    
    .rex-js-media-preview-click {
        border-color: #495057;
    }
    
    .rex-media-preview-modal .modal-content {
        background: #212529;
        color: #fff;
    }
    
    .rex-media-preview-modal .modal-header {
        background: #343a40;
        border-color: #495057;
    }
    
    .rex-media-lazy {
        background: #343a40;
    }
    
    .rex-media-lazy:not(.loaded)::after {
        border-color: #495057;
        border-top-color: #007bff;
    }
}