/* Autocomplete for sharing */
.autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    z-index: 1000;
    max-height: 200px;
    overflow-y: auto;
}

.autocomplete-item {
    padding: 8px 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid #eee;
}

.autocomplete-item:last-child {
    border-bottom: none;
}

.autocomplete-item:hover {
    background: #f5f5f5;
}

.autocomplete-item .avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #eee;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: #666;
}

.autocomplete-item .info {
    display: flex;
    flex-direction: column;
}

.autocomplete-item .displayname {
    font-weight: bold;
    font-size: 0.9rem;
}

.autocomplete-item .sharewith {
    font-size: 0.8rem;
    color: #888;
}

.relative {
    position: relative;
}

.hidden {
    display: none !important;
}
.file-manager-container {
    display: flex;
    height: calc(100vh - 200px);
    min-height: 500px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
    flex-direction: column;
}

.file-manager-toolbar {
    height: 48px;
    background: #f5f5f5;
    border-bottom: 1px solid #ddd;
    display: flex;
    align-items: center;
    padding: 0 10px;
    gap: 10px;
}

.file-manager-nav-buttons {
    display: flex;
    gap: 5px;
}

.nav-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    cursor: pointer;
    color: #555;
    transition: background 0.2s;
}

.nav-btn:hover {
    background: #e0e0e0;
}

.nav-btn.disabled {
    color: #ccc;
    cursor: default;
}

.nav-btn.disabled:hover {
    background: transparent;
}

.file-manager-address-bar {
    flex: 1;
    height: 30px;
    background: #fff;
    border: 1px solid #ddd;
    display: flex;
    align-items: center;
    padding: 0 10px;
    font-size: 0.9rem;
    overflow: hidden;
    white-space: nowrap;
}

.address-segment {
    cursor: pointer;
    padding: 2px 5px;
    border-radius: 2px;
}

.address-segment:hover {
    background: #eef7ff;
    color: #0067c0;
}

.file-manager-search {
    width: 200px;
    height: 30px;
    position: relative;
}

.file-manager-search input {
    width: 100%;
    height: 100%;
    padding: 0 30px 0 10px;
    border: 1px solid #ddd;
    font-size: 0.85rem;
}

.file-manager-search i {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: #888;
}

.file-manager-main {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Sidebar / Tree View */
.file-manager-sidebar {
    width: 240px;
    min-width: 150px;
    max-width: 600px;
    border-right: none;
    background: #f9f9f9;
    overflow-y: auto;
    padding: 10px 0;
}

#fm-resizer {
    width: 4px;
    cursor: col-resize;
    background: #eee;
    transition: background 0.2s;
    z-index: 100;
}

#fm-resizer:hover, #fm-resizer.resizing {
    background: #0067c0;
}

.tree-item {
    display: flex;
    align-items: center;
    padding: 4px 10px 4px 20px;
    cursor: pointer;
    font-size: 0.9rem;
    gap: 8px;
    color: #333;
    white-space: nowrap;
}

.tree-item:hover {
    background: #e5f3ff;
}

.tree-item.active {
    background: #cce8ff;
    color: #0067c0;
    font-weight: 500;
}

.tree-item i {
    width: 16px;
    text-align: center;
}

.tree-expander {
    width: 12px;
    height: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    color: #888;
    margin-left: -15px;
}

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

/* List View (Table-like but cleaner) */
.file-list-view {
    width: 100%;
    border-collapse: collapse;
}

.file-list-header {
    position: sticky;
    top: 0;
    background: #fff;
    z-index: 10;
    border-bottom: 1px solid #eee;
}

.file-list-header th {
    text-align: left;
    padding: 8px 12px;
    font-size: 0.85rem;
    font-weight: normal;
    color: #666;
    border-right: 1px solid #eee;
}

.file-list-row {
    cursor: pointer;
    border-bottom: 1px solid transparent;
}

.file-list-row:hover {
    background: #f5faff;
}

.file-list-row.selected {
    background: #e5f3ff;
}

.file-list-row td {
    padding: 6px 12px;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Grid / Icon View */
.file-grid-view {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 10px;
    padding: 15px;
}

.grid-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px;
    border-radius: 4px;
    cursor: pointer;
    text-align: center;
    transition: background 0.2s;
    border: 1px solid transparent;
}

.grid-item:hover {
    background: #f5faff;
    border-color: #e5f3ff;
}

.grid-item.selected {
    background: #e5f3ff;
    border-color: #99d1ff;
}

.grid-item i {
    font-size: 2.5rem;
    margin-bottom: 8px;
}

.grid-item .item-name {
    font-size: 0.85rem;
    word-break: break-word;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Status Bar */
.file-manager-status {
    height: 24px;
    background: #fff;
    border-top: 1px solid #ddd;
    display: flex;
    align-items: center;
    padding: 0 15px;
    font-size: 0.75rem;
    color: #666;
    gap: 20px;
}

/* Context Menu */
.context-menu {
    position: fixed;
    background: #fff;
    border: 1px solid #ccc;
    box-shadow: 2px 2px 5px rgba(0,0,0,0.2);
    padding: 5px 0;
    min-width: 160px;
    z-index: 2000;
}

.context-menu-item {
    padding: 8px 15px;
    cursor: pointer;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.context-menu-item:hover {
    background: #f0f0f0;
}

.context-menu-item i {
    width: 16px;
    text-align: center;
    color: #555;
}

.context-menu-divider {
    height: 1px;
    background: #eee;
    margin: 5px 0;
}

/* Icon Colors */
.fa-folder.text-warning { color: #ffca28 !important; }
.fa-file-pdf.text-danger { color: #f44336 !important; }
.fa-file-word.text-primary { color: #2b579a !important; }
.fa-file-excel.text-success { color: #217346 !important; }
.fa-file-powerpoint { color: #d24726 !important; }
.fa-file-image { color: #4caf50 !important; }
.fa-file-archive { color: #795548 !important; }
.fa-file-code { color: #607d8b !important; }

/* View Toggle Buttons */
.view-toggle {
    display: flex;
    background: #eee;
    padding: 2px;
    border-radius: 4px;
    margin-left: auto;
}

.view-btn {
    padding: 4px 8px;
    cursor: pointer;
    border-radius: 3px;
    font-size: 0.8rem;
}

.view-btn.active {
    background: #fff;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

/* Drag and Drop Overlays */
.drop-zone-active {
    background: #e3f2fd !important;
    border: 2px dashed #2196f3 !important;
}

/* Sharing Enhancements */
.sidebar-separator {
    padding: 15px 15px 5px 15px;
    font-size: 0.75rem;
    font-weight: bold;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.share-badge {
    position: absolute;
    font-size: 0.65rem;
    background: #fff;
    color: #0067c0;
    border-radius: 50%;
    width: 14px;
    height: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    bottom: 4px;
    right: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.grid-share-badge {
    position: absolute;
    top: 35px;
    right: 25px;
    font-size: 0.8rem;
    background: #fff;
    color: #0067c0;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.pending-badge {
    background: #fff3cd;
    color: #856404;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.7rem;
    margin-top: 4px;
    border: 1px solid #ffeeba;
}

.share-dialog-container {
    min-width: 350px;
    padding: 0.5rem;
}

.share-dialog-container h6 {
    margin-bottom: 0.75rem;
    color: #333;
    display: flex;
    align-items: center;
    gap: 8px;
}

.share-item:last-child {
    border-bottom: none;
}

.mobile-only {
    display: none;
}

/* Mobile Optimierung */
@media (max-width: 767px) {
    .file-manager-container {
        height: calc(100vh - 120px);
        margin: -1rem; /* Full width on mobile */
        border: none;
        border-radius: 0;
    }

    .file-manager-toolbar {
        flex-wrap: wrap;
        height: auto;
        padding: 5px;
        gap: 5px;
    }

    .file-manager-nav-buttons {
        order: 1;
    }

    .view-toggle {
        order: 2;
    }

    .file-manager-search {
        order: 3;
        width: 100% !important;
        margin: 5px 0;
    }

    .sub-toolbar {
        height: auto !important;
        padding: 5px !important;
        overflow-x: auto;
        white-space: nowrap;
        justify-content: flex-start !important;
    }

    .sub-toolbar button {
        flex-shrink: 0;
    }

    .file-manager-main {
        flex-direction: column;
    }

    .file-manager-sidebar {
        width: 100% !important;
        height: auto;
        max-height: 200px;
        border-right: none;
        border-bottom: 1px solid #ddd;
        display: none; /* Hidden by default on mobile */
    }

    .file-manager-sidebar.mobile-open {
        display: block;
        max-height: 300px;
        overflow-y: auto;
    }

    .sidebar-toggle {
        display: flex !important;
        align-items: center;
        justify-content: center;
        background: #f0f0f0;
        border: 1px solid #ddd;
        border-radius: 4px;
        padding: 5px 10px;
        cursor: pointer;
    }

    #fm-resizer {
        display: none;
    }

    .file-manager-content {
        height: auto;
        flex: 1;
    }

    .file-list-header th:nth-child(3),
    .file-list-header th:nth-child(4),
    .file-list-header th:nth-child(5),
    .file-list-body td:nth-child(3),
    .file-list-body td:nth-child(4),
    .file-list-body td:nth-child(5) {
        display: none;
    }

    .grid-item {
        padding: 5px;
    }

    .grid-item i {
        font-size: 2rem;
    }

    .mobile-only {
        display: block !important;
    }

    .grid-menu-btn {
        position: absolute;
        top: 5px;
        right: 5px;
        background: rgba(255,255,255,0.8);
        border-radius: 50%;
        width: 24px;
        height: 24px;
        display: flex !important;
        align-items: center;
        justify-content: center;
    }

    .context-menu {
        width: 200px;
        max-width: 80vw;
    }
}
