/* File Manager Styles */

.file-manager-window {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 900px;
    height: 600px;
    min-width: 700px;
    min-height: 500px;
    background: #2d2d2d;
    border: 1px solid #555;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    display: none;
    z-index: 9998;
    overflow: hidden;
    resize: both;
}

.file-manager-window.show {
    display: block;
    animation: windowOpen 0.3s ease-out;
}

.file-manager-content {
    display: flex;
    flex-direction: column;
    height: calc(100% - 32px); /* Subtract title bar height */
    color: #ffffff;
}

/* Navigation Bar */
.file-manager-nav {
    display: flex;
    align-items: center;
    background: #3d3d3d;
    border-bottom: 1px solid #555;
    padding: 8px 12px;
    gap: 8px;
}

.nav-btn {
    background: #4d4d4d;
    border: 1px solid #666;
    color: #ffffff;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
}

.nav-btn:hover:not(:disabled) {
    background: #5d5d5d;
    border-color: #777;
}

.nav-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.address-bar {
    flex: 1;
    margin: 0 8px;
}

.address-bar input {
    width: 100%;
    background: #2d2d2d;
    border: 1px solid #666;
    color: #ffffff;
    padding: 6px 12px;
    border-radius: 4px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 13px;
}

.address-bar input:focus {
    outline: none;
    border-color: #0078d4;
    box-shadow: 0 0 0 1px #0078d4;
}

/* Toolbar */
.file-manager-toolbar {
    display: flex;
    align-items: center;
    background: #3d3d3d;
    border-bottom: 1px solid #555;
    padding: 8px 12px;
    gap: 4px;
}

.toolbar-btn {
    background: transparent;
    border: 1px solid transparent;
    color: #ffffff;
    padding: 6px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 4px;
}

.toolbar-btn:hover:not(:disabled) {
    background: #4d4d4d;
    border-color: #666;
}

.toolbar-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.toolbar-separator {
    width: 1px;
    height: 20px;
    background: #555;
    margin: 0 8px;
}

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

/* Sidebar */
.file-manager-sidebar {
    width: 200px;
    background: #353535;
    border-right: 1px solid #555;
    overflow-y: auto;
    padding: 12px 0;
}

.sidebar-section {
    margin-bottom: 20px;
}

.sidebar-section h3 {
    color: #cccccc;
    font-size: 12px;
    font-weight: 600;
    margin: 0 0 8px 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sidebar-item {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    cursor: pointer;
    transition: background 0.2s ease;
    gap: 8px;
    font-size: 13px;
}

.sidebar-item:hover {
    background: #4d4d4d;
}

.sidebar-item.active {
    background: #0078d4;
    color: #ffffff;
}

.sidebar-icon {
    font-size: 16px;
    width: 20px;
    text-align: center;
}

/* Content Area */
.file-manager-content-area {
    flex: 1;
    background: #2d2d2d;
    overflow: auto;
    position: relative;
}

.file-listing {
    padding: 12px;
}

.loading-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 200px;
    color: #cccccc;
    font-size: 14px;
}

/* File/Folder Items */
.file-item, .folder-item {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    gap: 12px;
    margin-bottom: 2px;
    user-select: none;
}

.file-item:hover, .folder-item:hover {
    background: #404040;
}

.file-item.selected, .folder-item.selected {
    background: #0078d4;
    color: #ffffff;
}

.file-icon, .folder-icon {
    font-size: 20px;
    width: 24px;
    text-align: center;
    flex-shrink: 0;
}

.file-info, .folder-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.file-name, .folder-name {
    font-size: 13px;
    font-weight: 500;
}

.file-details, .folder-details {
    font-size: 11px;
    color: #cccccc;
    display: flex;
    gap: 16px;
}

/* Grid View */
.file-listing.grid-view {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 12px;
    padding: 16px;
}

.file-listing.grid-view .file-item,
.file-listing.grid-view .folder-item {
    flex-direction: column;
    text-align: center;
    padding: 12px 8px;
    height: 100px;
    justify-content: center;
}

.file-listing.grid-view .file-icon,
.file-listing.grid-view .folder-icon {
    font-size: 32px;
    margin-bottom: 8px;
}

.file-listing.grid-view .file-info,
.file-listing.grid-view .folder-info {
    align-items: center;
}

.file-listing.grid-view .file-details,
.file-listing.grid-view .folder-details {
    justify-content: center;
    flex-wrap: wrap;
}

/* Status Bar */
.file-manager-status {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #3d3d3d;
    border-top: 1px solid #555;
    padding: 6px 12px;
    font-size: 12px;
    color: #cccccc;
}

.file-manager-status span {
    flex: 1;
}

.file-manager-status span:last-child {
    text-align: right;
}

/* Context Menu for Files */
.file-context-menu {
    position: fixed;
    background: rgba(32, 32, 32, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    z-index: 10001;
    display: none;
    min-width: 180px;
    overflow: hidden;
}

.file-context-menu.show {
    display: block;
}

.file-context-menu-item {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    color: #ffffff;
    cursor: pointer;
    transition: background 0.2s ease;
    font-size: 13px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    gap: 8px;
}

.file-context-menu-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.file-context-menu-item.disabled {
    color: rgba(255, 255, 255, 0.5);
    cursor: default;
}

.file-context-menu-item.disabled:hover {
    background: transparent;
}

.file-context-menu-separator {
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: 4px 0;
}

/* Responsive Design */
@media (max-width: 800px) {
    .file-manager-window {
        width: 95vw;
        height: 90vh;
    }

    .file-manager-sidebar {
        width: 150px;
    }

    .file-listing.grid-view {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    }
}

/* Drag and Drop Styles */
.file-item.drag-over, .folder-item.drag-over {
    background: #0078d4;
    opacity: 0.7;
}

.file-listing.drag-over {
    background: rgba(0, 120, 212, 0.1);
    border: 2px dashed #0078d4;
}

/* Animation for file operations */
@keyframes fileOperation {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.file-item.operation, .folder-item.operation {
    animation: fileOperation 0.3s ease-out;
}

/* Scrollbar Styling */
.file-manager-sidebar::-webkit-scrollbar,
.file-manager-content-area::-webkit-scrollbar {
    width: 8px;
}

.file-manager-sidebar::-webkit-scrollbar-track,
.file-manager-content-area::-webkit-scrollbar-track {
    background: #2d2d2d;
}

.file-manager-sidebar::-webkit-scrollbar-thumb,
.file-manager-content-area::-webkit-scrollbar-thumb {
    background: #555;
    border-radius: 4px;
}

.file-manager-sidebar::-webkit-scrollbar-thumb:hover,
.file-manager-content-area::-webkit-scrollbar-thumb:hover {
    background: #666;
}