/* U8 File Manager Styles */

/* WebP Video Preview Styles */
.u8-webp-video-preview {
    position: relative;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 8px;
    border: 2px solid #5a67d8;
}

.u8-video-icon {
    font-size: 24px;
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.u8-play-overlay {
    position: absolute;
    bottom: 2px;
    right: 2px;
    font-size: 12px;
    color: white;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 50%;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-shadow: none;
}

.u8-file-item:hover .u8-webp-video-preview {
    transform: scale(1.05);
    transition: transform 0.2s ease;
}

.u8-file-item:hover .u8-play-overlay {
    background: rgba(0, 0, 0, 0.8);
}

.u8-filemanager-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
}

.u8-filemanager-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
}

.u8-filemanager-container {
    position: relative;
    background: white;
    width: 90%;
    max-width: 1200px;
    height: 80%;
    max-height: 800px;
    margin: 5% auto;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.u8-filemanager-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    border-bottom: 1px solid #e0e0e0;
    background: #f8f9fa;
}

.u8-filemanager-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.u8-filemanager-toolbar {
    display: flex;
    gap: 8px;
}

.u8-filemanager-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    color: #666;
    transition: all 0.2s;
}

.u8-filemanager-close:hover {
    background: #e0e0e0;
    color: #333;
}

.u8-filemanager-body {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.u8-filemanager-sidebar {
    width: 280px;
    border-right: 1px solid #e0e0e0;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
}

.u8-breadcrumb {
    padding: 16px;
    border-bottom: 1px solid #e0e0e0;
    font-size: 13px;
    background: white;
}

.u8-breadcrumb-item {
    background: none;
    border: none;
    color: #0066cc;
    cursor: pointer;
    text-decoration: none;
    padding: 2px 4px;
    border-radius: 3px;
    transition: background 0.2s;
}

.u8-breadcrumb-item:hover {
    background: rgba(0, 102, 204, 0.1);
}

.u8-file-info {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
}

.u8-no-selection {
    color: #999;
    text-align: center;
    margin-top: 40px;
}

.u8-file-details {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.u8-file-preview {
    text-align: center;
}

.u8-file-preview img {
    max-width: 150px;
    max-height: 150px;
    border-radius: 4px;
    border: 1px solid #ddd;
}

.u8-file-icon-large {
    font-size: 48px;
    display: block;
}

.u8-file-meta {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.u8-meta-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.u8-meta-item label {
    font-weight: 600;
    color: #666;
    font-size: 12px;
    text-transform: uppercase;
}

.u8-meta-item span {
    color: #333;
}

.u8-file-url {
    width: 100%;
    padding: 4px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 12px;
    background: #f8f9fa;
}

.u8-filemanager-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.u8-upload-area {
    border-bottom: 1px solid #e0e0e0;
    background: #f8f9fa;
}

.u8-upload-drop-zone {
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    border: 2px dashed #ddd;
    margin: 16px;
    border-radius: 8px;
}

.u8-upload-drop-zone:hover,
.u8-upload-drop-zone.u8-drag-over {
    border-color: #0066cc;
    background: rgba(0, 102, 204, 0.05);
}

.u8-upload-icon {
    font-size: 32px;
    margin-bottom: 8px;
}

.u8-upload-text {
    color: #666;
    font-size: 14px;
}

.u8-file-grid {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 16px;
    align-content: start;
}

.u8-file-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background: white;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    min-height: 120px;
}

.u8-file-item:hover {
    border-color: #0066cc;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.u8-file-item.u8-selected {
    border-color: #0066cc;
    background: rgba(0, 102, 204, 0.1);
    box-shadow: 0 0 0 2px rgba(0, 102, 204, 0.2);
}

.u8-file-icon {
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
}

.u8-file-thumbnail {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid #ddd;
}

.u8-icon {
    font-size: 32px;
}

.u8-file-name {
    font-size: 12px;
    text-align: center;
    word-break: break-word;
    line-height: 1.3;
    max-width: 100%;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    margin-bottom: 4px;
}

.u8-file-size {
    font-size: 11px;
    color: #999;
    margin-top: auto;
}

.u8-file-actions {
    position: absolute;
    top: 4px;
    right: 4px;
    display: none;
    flex-direction: column;
    gap: 2px;
}

.u8-file-item:hover .u8-file-actions {
    display: flex;
}

.u8-file-action {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid #ddd;
    border-radius: 3px;
    padding: 2px 4px;
    cursor: pointer;
    font-size: 12px;
    transition: background 0.2s;
}

.u8-file-action:hover {
    background: white;
    border-color: #0066cc;
}

.u8-filemanager-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    border-top: 1px solid #e0e0e0;
    background: #f8f9fa;
}

.u8-selected-count {
    color: #666;
    font-size: 13px;
}

.u8-filemanager-actions {
    display: flex;
    gap: 8px;
}

.u8-btn {
    padding: 8px 16px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.u8-btn:hover {
    background: #f8f9fa;
    border-color: #ccc;
}

.u8-btn-primary {
    background: #0066cc;
    color: white;
    border-color: #0066cc;
}

.u8-btn-primary:hover {
    background: #0052a3;
    border-color: #0052a3;
}

.u8-btn-primary:disabled {
    background: #ccc;
    border-color: #ccc;
    cursor: not-allowed;
}

.u8-btn-secondary {
    background: #6c757d;
    color: white;
    border-color: #6c757d;
}

.u8-btn-secondary:hover {
    background: #545b62;
    border-color: #545b62;
}

.u8-btn-sm {
    padding: 4px 8px;
    font-size: 12px;
}

.u8-loading {
    text-align: center;
    padding: 40px;
    color: #999;
}

.u8-empty-state {
    text-align: center;
    padding: 40px;
    color: #999;
    font-style: italic;
}

.u8-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.u8-loading-spinner {
    padding: 20px 40px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    font-weight: 500;
}

.u8-notification {
    position: absolute;
    top: 20px;
    right: 20px;
    padding: 12px 16px;
    border-radius: 4px;
    color: white;
    font-weight: 500;
    z-index: 1001;
    transform: translateX(100%);
    opacity: 0;
    transition: all 0.3s ease;
}

.u8-notification-show {
    transform: translateX(0);
    opacity: 1;
}

.u8-notification-success {
    background: #28a745;
}

.u8-notification-error {
    background: #dc3545;
}

.u8-notification-info {
    background: #17a2b8;
}

/* Crop Controls Styles */
.u8-crop-instructions {
    background: #e3f2fd;
    border: 1px solid #90caf9;
    border-radius: 4px;
    padding: 10px;
    margin: 10px 0;
    font-size: 13px;
    color: #1976d2;
}

.u8-control-row {
    display: flex;
    gap: 15px;
    margin-bottom: 10px;
}

.u8-control-row .u8-control-group {
    flex: 1;
    margin-bottom: 0;
}

.u8-crop-preview {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 8px 12px;
    margin: 10px 0;
    font-family: monospace;
    font-size: 13px;
    color: #495057;
}

.u8-crop-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    justify-content: flex-end;
}

/* Interactive Crop Overlay */
.u8-crop-overlay {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    pointer-events: none;
    user-select: none;
    z-index: 10;
}

.u8-crop-selection {
    position: absolute;
    border: 2px solid #007cba;
    background: rgba(0, 124, 186, 0.1);
    cursor: move;
    pointer-events: all;
    min-width: 20px;
    min-height: 20px;
    box-sizing: border-box;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.3);
}

.u8-crop-selection:hover {
    border-color: #0056b3;
    background: rgba(0, 86, 179, 0.15);
}

.u8-crop-handle {
    position: absolute;
    width: 8px;
    height: 8px;
    background: #007cba;
    border: 1px solid white;
    border-radius: 1px;
    pointer-events: all;
    box-sizing: border-box;
    transition: all 0.1s ease;
}

.u8-crop-handle:hover {
    background: #0056b3;
    transform: scale(1.2);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.u8-crop-handle-nw { cursor: nw-resize; }
.u8-crop-handle-ne { cursor: ne-resize; }
.u8-crop-handle-sw { cursor: sw-resize; }
.u8-crop-handle-se { cursor: se-resize; }
.u8-crop-handle-n { cursor: n-resize; }
.u8-crop-handle-s { cursor: s-resize; }
.u8-crop-handle-e { cursor: e-resize; }
.u8-crop-handle-w { cursor: w-resize; }

/* Image Editor Canvas positioning */
.u8-image-editor-canvas {
    position: relative;
    display: inline-block;
    text-align: center;
}

.u8-image-editor-canvas img {
    display: block;
    max-width: 100%;
    max-height: 400px;
    border: 1px solid #ddd;
    border-radius: 4px;
}
.u8-image-editor-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
}

.u8-image-editor-container {
    background: white;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    width: 90%;
    max-width: 800px;
    max-height: 90%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.u8-image-editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    border-bottom: 1px solid #e0e0e0;
    background: #f8f9fa;
}

.u8-image-editor-header h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.u8-close-btn {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    color: #666;
    transition: all 0.2s;
}

.u8-close-btn:hover {
    background: #e0e0e0;
    color: #333;
}

.u8-image-editor-body {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
}

.u8-image-editor-toolbar {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.u8-image-editor-canvas {
    text-align: center;
    margin: 16px 0;
}

.u8-image-editor-controls {
    margin-top: 16px;
    padding: 16px;
    background: #f8f9fa;
    border-radius: 4px;
    border: 1px solid #e0e0e0;
}

.u8-control-group {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.u8-control-group label {
    min-width: 60px;
    font-weight: 500;
    font-size: 13px;
}

.u8-control-group input {
    padding: 4px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    width: 100px;
}

.u8-image-editor-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 16px 24px;
    border-top: 1px solid #e0e0e0;
    background: #f8f9fa;
}

/* Icons */
.u8-icon-upload:before { content: '📤'; }
.u8-icon-folder:before { content: '📁'; }
.u8-icon-refresh:before { content: '🔄'; }

/* Responsive Design */
@media (max-width: 768px) {
    .u8-filemanager-container {
        width: 95%;
        height: 90%;
        margin: 2.5% auto;
    }
    
    .u8-filemanager-body {
        flex-direction: column;
    }
    
    .u8-filemanager-sidebar {
        width: 100%;
        height: 200px;
        border-right: none;
        border-bottom: 1px solid #e0e0e0;
    }
    
    .u8-file-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 12px;
        padding: 12px;
    }
    
    .u8-file-item {
        min-height: 100px;
        padding: 8px;
    }
    
    .u8-file-icon {
        width: 50px;
        height: 50px;
    }
    
    .u8-file-thumbnail {
        width: 50px;
        height: 50px;
    }
    
    .u8-icon {
        font-size: 24px;
    }
    
    .u8-filemanager-toolbar {
        flex-wrap: wrap;
    }
    
    .u8-image-editor-container {
        width: 95%;
        height: 95%;
    }
    
    .u8-image-editor-toolbar {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .u8-filemanager-header {
        padding: 12px 16px;
    }
    
    .u8-filemanager-header h3 {
        font-size: 16px;
    }
    
    .u8-filemanager-footer {
        padding: 12px 16px;
        flex-direction: column;
        gap: 12px;
    }
    
    .u8-filemanager-actions {
        width: 100%;
        justify-content: stretch;
    }
    
    .u8-btn {
        flex: 1;
        justify-content: center;
    }
    
    .u8-file-grid {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
        gap: 8px;
        padding: 8px;
    }
    
    .u8-file-item {
        min-height: 80px;
        padding: 6px;
    }
    
    .u8-file-icon {
        width: 40px;
        height: 40px;
    }
    
    .u8-file-thumbnail {
        width: 40px;
        height: 40px;
    }
    
    .u8-icon {
        font-size: 20px;
    }
    
    .u8-file-name {
        font-size: 11px;
    }
}