/**
 * DSX File Manager Styles
 */

.dsx-filemanager {
    display: flex;
    flex-direction: column;
    height: 100%;
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 0.25rem;
}

.dsx-filemanager.dialog {
    height: 600px;
}

/* Toolbar */
.fm-toolbar {
    display: flex;
    align-items: center;
    padding: 0.5rem;
    background-color: #fff;
    border-bottom: 1px solid #dee2e6;
}

.fm-toolbar .btn-group {
    margin-right: 0.5rem;
}

.fm-search {
    width: 200px;
}

/* Main Area */
.fm-main {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Sidebar */
.fm-sidebar {
    width: 250px;
    background-color: #fff;
    border-right: 1px solid #dee2e6;
    overflow-y: auto;
}

.fm-tree {
    padding: 0.5rem;
}

/* Content Area */
.fm-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.fm-path {
    background-color: #fff;
    border-bottom: 1px solid #dee2e6;
    padding: 0.5rem;
}

.fm-path .breadcrumb {
    margin: 0;
    padding: 0;
    background: none;
}

/* Files Container */
.fm-files-container {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    position: relative;
}

.fm-files {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

/* Grid View */
.fm-files.grid-view .fm-file {
    width: 120px;
    text-align: center;
    padding: 0.5rem;
    border: 1px solid transparent;
    border-radius: 0.25rem;
    cursor: pointer;
    transition: all 0.2s;
}

.fm-files.grid-view .fm-file:hover {
    background-color: #e9ecef;
    border-color: #dee2e6;
}

.fm-files.grid-view .fm-file.selected {
    background-color: rgba(237, 126, 35, 0.1);
    border-color: #ed7e23;
}

.fm-files.grid-view .fm-file-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: 0.25rem;
    background-color: #f8f9fa;
}

.fm-files.grid-view .fm-file-icon img {
    max-width: 100%;
    max-height: 100%;
    object-fit: cover;
}

.fm-files.grid-view .fm-file-icon i {
    font-size: 3rem;
    color: #6c757d;
}

.fm-files.grid-view .fm-file-name {
    font-size: 0.875rem;
    word-break: break-word;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.fm-files.grid-view .fm-file-size {
    font-size: 0.75rem;
    color: #6c757d;
}

/* List View */
.fm-files.list-view {
    display: block;
}

/* List header */
.fm-list-header {
    background-color: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
    position: sticky;
    top: 0;
    z-index: 10;
}

.fm-list-header-row {
    display: flex;
    align-items: center;
    padding: 0.75rem 0.5rem;
    font-weight: 600;
    color: #495057;
}

.fm-list-col {
    display: flex;
    align-items: center;
    padding: 0 0.5rem;
}

.fm-col-icon {
    width: 50px;
    flex-shrink: 0;
}

.fm-col-name {
    flex: 1;
    min-width: 200px;
}

.fm-col-size {
    width: 120px;
    flex-shrink: 0;
    justify-content: flex-end;
}

.fm-col-date {
    width: 180px;
    flex-shrink: 0;
}

.fm-list-header .sortable {
    cursor: pointer;
    user-select: none;
    transition: color 0.2s;
}

.fm-list-header .sortable:hover {
    color: #ed7e23;
}

.fm-list-header .sortable span {
    margin-right: 0.5rem;
}

.fm-list-header .sortable i {
    font-size: 0.875rem;
    color: #adb5bd;
    transition: color 0.2s;
}

.fm-list-header .sortable:hover i {
    color: #ed7e23;
}

.fm-list-header .sortable i.fa-sort-up,
.fm-list-header .sortable i.fa-sort-down {
    color: #ed7e23;
}

/* List row */
.fm-list-row {
    display: flex;
    align-items: center;
    border-bottom: 1px solid #e9ecef;
}

.fm-files.list-view .fm-file {
    padding: 0.5rem;
    border: 1px solid transparent;
    border-radius: 0;
    cursor: pointer;
    transition: all 0.2s;
}

.fm-files.list-view .fm-file:hover {
    background-color: #e9ecef;
    border-color: transparent;
}

.fm-files.list-view .fm-file.selected {
    background-color: rgba(237, 126, 35, 0.1);
    border-color: transparent;
}

.fm-files.list-view .fm-file-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: 0.25rem;
    background-color: #f8f9fa;
}

.fm-files.list-view .fm-file-icon img {
    max-width: 100%;
    max-height: 100%;
    object-fit: cover;
}

.fm-files.list-view .fm-file-icon i {
    font-size: 1.25rem;
    color: #6c757d;
}

.fm-files.list-view .fm-file-name {
    font-size: 0.875rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.fm-files.list-view .fm-file-size {
    color: #6c757d;
    font-size: 0.875rem;
    text-align: right;
    width: 100%;
}

.fm-files.list-view .fm-file-date {
    color: #6c757d;
    font-size: 0.875rem;
}

/* Upload Zone */
.fm-upload-zone {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(237, 126, 35, 0.1);
    border: 2px dashed #ed7e23;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.fm-upload-zone i {
    font-size: 4rem;
    color: #ed7e23;
    margin-bottom: 1rem;
}

.fm-upload-zone p {
    font-size: 1.25rem;
    color: #ed7e23;
    margin: 0;
}

/* Empty State */
.fm-empty {
    text-align: center;
    color: #6c757d;
    padding: 3rem;
}

/* Status Bar */
.fm-statusbar {
    display: flex;
    justify-content: space-between;
    padding: 0.25rem 0.5rem;
    background-color: #fff;
    border-top: 1px solid #dee2e6;
    font-size: 0.875rem;
    color: #6c757d;
}

/* Context Menu Adjustments */
.context-menu-list {
    z-index: 1100;
}

.context-menu-icon.fa {
    color: inherit;
}

/* Custom Context Menu */
.fm-context-menu {
    position: absolute;
    display: none;
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.15);
    padding: 0;
    margin: 0;
    z-index: 9999;
    min-width: 180px;
}

.fm-context-menu-list {
    list-style: none;
    margin: 0;
    padding: 4px 0;
}

.fm-context-menu-item {
    padding: 8px 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    transition: background-color 0.2s;
}

.fm-context-menu-item:hover {
    background-color: #f5f5f5;
}

.fm-context-menu-item i {
    margin-right: 10px;
    width: 20px;
    text-align: center;
    font-size: 14px;
}

.fm-context-menu-item span {
    font-size: 14px;
    color: #333;
}

.fm-context-menu-separator {
    height: 1px;
    background-color: #e0e0e0;
    margin: 4px 0;
}

/* jsTree Adjustments */
.fm-tree .jstree-default .jstree-icon {
    color: #ed7e23;
}

.fm-tree .jstree-default .jstree-icon.fad:before {
    color: #ed7e23;
}

.fm-tree .jstree-default .jstree-clicked {
    background-color: rgba(237, 126, 35, 0.1);
    border-color: #ed7e23;
    box-shadow: none;
}

.fm-tree .jstree-default .jstree-hovered {
    background-color: rgba(237, 126, 35, 0.05);
    border-color: #ed7e23;
    box-shadow: none;
}

/* jsTree folder icons */
.fm-tree .jstree-icon.jstree-themeicon.fad.fa-folder:before {
    color: #ed7e23 !important;
}

/* Disabled folders (no direct access) */
.fm-tree .jstree-default .jstree-disabled {
    opacity: 0.6;
}

.fm-tree .jstree-default .jstree-disabled > .jstree-icon {
    color: #999 !important;
}

.fm-tree .jstree-default .jstree-disabled > a {
    color: #999 !important;
    font-style: italic;
}

.fm-tree .jstree-default .jstree-disabled.jstree-hovered {
    background-color: transparent;
    border-color: transparent;
    cursor: not-allowed;
}

/* Responsive */
@media (max-width: 768px) {
    .fm-sidebar {
        width: 200px;
    }
    
    .fm-files.grid-view .fm-file {
        width: 100px;
    }
    
    .fm-files.grid-view .fm-file-icon {
        width: 60px;
        height: 60px;
    }
    
    .fm-search {
        width: 150px;
    }
}

/* Loading Overlay */
.fm-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.fm-loading-spinner {
    width: 3rem;
    height: 3rem;
    border: 0.25rem solid #f3f3f3;
    border-top: 0.25rem solid #007bff;
    border-radius: 50%;
    animation: fm-spin 1s linear infinite;
}

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

/* Active button state */
.fm-toolbar .btn.active {
    background-color: #ed7e23;
    border-color: #ed7e23;
    color: white;
}

/* Breadcrumb links */
.fm-path .breadcrumb-item a {
    color: #ed7e23;
    text-decoration: none;
}

.fm-path .breadcrumb-item a:hover {
    color: #ed5000;
    text-decoration: underline;
}

/* File Type Icons */
.fm-file-icon i.fad {
    --fa-primary-color: #6c757d;
    --fa-secondary-color: #6c757d;
    --fa-secondary-opacity: 0.4;
}

.fm-file-icon.video i.fad {
    --fa-primary-color: #dc3545;
    --fa-secondary-color: #dc3545;
}

.fm-file-icon.image i.fad {
    --fa-primary-color: #28a745;
    --fa-secondary-color: #28a745;
}

.fm-file-icon.folder i.fad {
    --fa-primary-color: #ffc107;
    --fa-secondary-color: #ffc107;
    font-size: 3.5rem;
}

/* Folder specific styles */
.fm-file.fm-folder {
    cursor: pointer;
}

.fm-file.fm-folder:hover .fm-file-icon i.fad {
    --fa-primary-color: #ffab00;
    --fa-secondary-color: #ffab00;
}

/* Toolbar duotone icons */
.fm-toolbar i.fad {
    --fa-primary-color: currentColor;
    --fa-secondary-color: currentColor;
    --fa-secondary-opacity: 0.4;
}

.btn-mediativ i.fad {
    --fa-primary-color: #ffffff;
    --fa-secondary-color: #ffffff;
    --fa-secondary-opacity: 0.6;
}

/* Scrollbar Styling */
.fm-sidebar::-webkit-scrollbar,
.fm-files-container::-webkit-scrollbar {
    width: 8px;
}

.fm-sidebar::-webkit-scrollbar-track,
.fm-files-container::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.fm-sidebar::-webkit-scrollbar-thumb,
.fm-files-container::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.fm-sidebar::-webkit-scrollbar-thumb:hover,
.fm-files-container::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Upload Modal Styles */
.upload-modal-container {
    padding: 20px 0;
}

.upload-modal-header {
    text-align: center;
    margin-bottom: 30px;
}

.upload-icon-wrapper {
    position: relative;
    width: 120px;
    height: 120px;
    margin: 0 auto 20px;
}

.upload-icon {
    font-size: 120px;
    color: #ed7e23;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.upload-icon-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(237, 126, 35, 0.2);
    height: 100%;
    transition: height 0.3s ease;
    border-radius: 60px;
}

/* New prominent progress bar */
.upload-overall-progress {
    margin: 20px 0;
    background: #f0f0f0;
    border-radius: 10px;
    height: 30px;
    position: relative;
    overflow: hidden;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}

.upload-overall-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #ed7e23 0%, #f59e4c 100%);
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 10px;
    position: relative;
    box-shadow: 0 2px 4px rgba(237, 126, 35, 0.3);
}

.upload-overall-progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-weight: bold;
    color: #333;
    font-size: 14px;
    text-shadow: 0 1px 2px rgba(255,255,255,0.8);
    z-index: 1;
}

.upload-overall-progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(255,255,255,0.3) 50%, 
        transparent 100%);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.upload-description {
    font-size: 16px;
    color: #666;
    margin: 0;
}

#upload-progress-container {
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 20px;
}

.upload-file-item {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
    transition: all 0.3s ease;
}

.upload-file-item:hover {
    background: #e9ecef;
}

.upload-file-item.upload-complete {
    background: #d4edda;
}

.upload-file-item.upload-error {
    background: #f8d7da;
}

.file-info {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

.file-icon {
    width: 40px;
    height: 40px;
    background: #fff;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 15px;
    font-size: 20px;
    color: #6c757d;
}

.file-icon .fad {
    --fa-primary-color: #6c757d;
    --fa-secondary-color: #6c757d;
    --fa-secondary-opacity: 0.4;
}

.file-icon i.fa-file-image {
    --fa-primary-color: #28a745;
}

.file-icon i.fa-file-video {
    --fa-primary-color: #dc3545;
}

.file-icon i.fa-file-pdf {
    --fa-primary-color: #dc3545;
}

.file-icon i.fa-file-word {
    --fa-primary-color: #007bff;
}

.file-icon i.fa-file-excel {
    --fa-primary-color: #28a745;
}

.file-icon i.fa-file-powerpoint {
    --fa-primary-color: #ff6f00;
}

.file-icon i.fa-file-archive {
    --fa-primary-color: #6f42c1;
}

.file-icon i.fa-file-audio {
    --fa-primary-color: #17a2b8;
}

.file-details {
    flex: 1;
}

.file-name {
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-meta {
    display: flex;
    align-items: center;
    font-size: 14px;
    color: #666;
}

.file-size {
    margin-right: 15px;
}

.file-status {
    color: #007bff;
}

.file-status i {
    margin-right: 5px;
}

.progress-wrapper {
    position: relative;
}

.progress {
    height: 24px;
    background-color: #e9ecef;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 5px;
}

.progress-bar {
    background-color: #ed7e23;
    transition: width 0.3s ease;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.progress-bar-success {
    background-color: #28a745;
}

.progress-bar-danger {
    background-color: #dc3545;
}

.progress-text {
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.upload-speed {
    font-size: 12px;
    color: #666;
    text-align: right;
}

.upload-stats {
    display: flex;
    justify-content: space-around;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-top: 20px;
}

.stat-item {
    text-align: center;
}

.stat-item i {
    font-size: 24px;
    color: #ed7e23;
    display: block;
    margin-bottom: 10px;
}

.stat-label {
    display: block;
    font-size: 12px;
    color: #666;
    margin-bottom: 5px;
}

.stat-value {
    display: block;
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

/* Custom scrollbar for upload progress container */
#upload-progress-container::-webkit-scrollbar {
    width: 6px;
}

#upload-progress-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

#upload-progress-container::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

#upload-progress-container::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* Dialog theme override for upload modal */
.jconfirm.jconfirm-modern .jconfirm-box {
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.1);
}

.jconfirm.jconfirm-modern .jconfirm-title {
    color: #333;
    font-size: 20px;
    font-weight: 600;
}

.jconfirm.jconfirm-modern .jconfirm-content {
    padding: 0;
}

/* File Preview Styles */
.file-preview-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 20px;
}

.preview-image-wrapper {
    text-align: center;
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.preview-image {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.preview-video-wrapper {
    background: #000;
    padding: 0;
    border-radius: 8px;
    overflow: hidden;
}

.preview-video {
    width: 100%;
    height: auto;
    max-height: 500px;
}

.preview-pdf-wrapper {
    height: 600px;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    overflow: hidden;
}

.preview-pdf {
    width: 100%;
    height: 100%;
    border: none;
}

.preview-other {
    text-align: center;
    padding: 60px 20px;
    background: #f8f9fa;
    border-radius: 8px;
}

.preview-file-icon {
    font-size: 120px;
    color: #6c757d;
    margin-bottom: 20px;
}

.preview-file-icon.fa-file-image {
    --fa-primary-color: #28a745;
}

.preview-file-icon.fa-file-video {
    --fa-primary-color: #dc3545;
}

.preview-file-icon.fa-file-pdf {
    --fa-primary-color: #dc3545;
}

.preview-file-icon.fa-file-word {
    --fa-primary-color: #007bff;
}

.preview-file-icon.fa-file-excel {
    --fa-primary-color: #28a745;
}

.preview-file-icon.fa-file-powerpoint {
    --fa-primary-color: #ff6f00;
}

.preview-file-icon.fa-file-archive {
    --fa-primary-color: #6f42c1;
}

.preview-file-icon.fa-file-audio {
    --fa-primary-color: #17a2b8;
}

.preview-info {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #dee2e6;
}

.preview-info table {
    margin: 0;
}

.preview-info td:first-child {
    width: 120px;
    color: #6c757d;
}

.preview-info td:last-child {
    word-break: break-word;
}