.file-name-ellipsis {
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: inline-block;
    vertical-align: bottom;
}

@media (min-width: 992px) {
    .file-name-ellipsis {
        max-width: 180px;
    }
}

.file-action-btn {
    min-width: 32px;
    min-height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 5px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s;
}

.card:hover>.card-footer .file-action-btn {
    opacity: 1;
    pointer-events: auto;
}

.card-footer.bg-white.border-0.d-flex.justify-content-center.gap-2 {
    min-height: 40px;
}

.card.file-card {
    cursor: pointer;
}

.card.file-card .select-item-checkbox,
.card.file-card .file-action-btn {
    cursor: pointer;
}

#upBtn.hidden {
    display: none !important;
}

#fileGrid.list-view {
    display: block;
    padding: 0;
    width: 100%;
}

#fileGrid.list-view table {
    width: 100%;
    border-collapse: collapse;
    background: var(--white);
    margin: 0;
}

#fileGrid.list-view th,
#fileGrid.list-view td {
    padding: 0.5rem 1rem;
    border-bottom: 1px solid var(--border-light);
    text-align: left;
    font-size: 0.95rem;
    vertical-align: middle;
}

#fileGrid.list-view th {
    background: var(--bg-color);
    color: var(--text-muted);
    font-weight: 500;
    position: sticky;
    top: 0;
    z-index: 1;
}

#fileGrid.list-view tr:hover td {
    background-color: #edf4f5;
    transition: background 0.15s;
}

#fileGrid.list-view .file-icon {
    width: 40px;
    text-align: center;
}

#fileGrid.list-view .file-actions {
    min-width: 90px;
    text-align: right;
}

#fileGrid.list-view .file-action-btn {
    opacity: 1;
    pointer-events: auto;
    min-width: 28px;
    min-height: 28px;
    font-size: 0.875rem;
    margin-left: 0.25rem;
}

.list-view-header {
    display: grid;
    grid-template-columns: 40px 2fr 1fr 1fr 1fr;
    padding: 0.5rem 1rem;
    background-color: var(--bg-color);
    border-bottom: 1px solid var(--border-light);
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.btn-group.btn-group-sm .btn {
    background-color: var(--white);
    border-color: var(--border-light);
    color: var(--text-muted);
    transition: background-color 0.15s, color 0.15s;
}

.btn-group.btn-group-sm .btn.active,
.btn-group.btn-group-sm .btn:active {
    background-color: var(--primary-bg-light) !important;
    color: var(--primary-color) !important;
    border-color: var(--primary-color) !important;
    box-shadow: none;
}

.btn-group.btn-group-sm .btn:focus {
    box-shadow: 0 0 0 0.1rem var(--primary-opacity-20);
}

.btn-group.btn-group-sm .btn:hover:not(.active) {
    background-color: var(--bg-color);
    color: var(--primary-color);
}

#fileGrid.table-mode {
    padding: 0;
}

#fileGrid.table-mode table {
    width: 100%;
    border-collapse: collapse;
    background: var(--white);
}

#fileGrid.table-mode th,
#fileGrid.table-mode td {
    padding: 0.5rem 1rem;
    border-bottom: 1px solid var(--border-light);
    text-align: left;
    font-size: 0.95rem;
    vertical-align: middle;
}

#fileGrid.table-mode th {
    background: var(--bg-color);
    color: var(--text-muted);
    font-weight: 500;
}

#fileGrid.table-mode tr:hover td {
    background-color: var(--primary-opacity-8);
    transition: background 0.15s;
}

#fileGrid.table-mode .file-icon {
    width: 40px;
    text-align: center;
}

#fileGrid.table-mode .file-actions {
    min-width: 90px;
    text-align: right;
}

#fileGrid.table-mode .file-action-btn {
    opacity: 1;
    pointer-events: auto;
    min-width: 28px;
    min-height: 28px;
    font-size: 0.875rem;
    margin-left: 0.25rem;
}

#fileGrid.table-mode tr.selected {
    background-color: var(--primary-bg-light) !important;
}

/* Disable text selection for file grid and table rows/cards */
#fileGrid,
#fileGrid * {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

#fileGrid .card.file-card {
    cursor: pointer;
}

#fileGrid.list-view tr {
    cursor: pointer;
}

#fileGrid.table-mode tr {
    cursor: pointer;
}

#fileGrid.table-mode tr.selected {
    background-color: #e6f3f4 !important;
}

.details-sidebar {
    background: #f8fafc;
    border-left: 1.5px solid #e6f3f4;
    box-shadow: -2px 0 8px rgba(0, 0, 0, 0.08);
    font-size: 0.97rem;
    width: 320px;
    height: 100%;
    right: 0;
    top: 0;
    left: auto;
    border-radius: 0;
    position: fixed;
    z-index: 1050;
    padding: 1.3rem 1.2rem 1.2rem 1.2rem;
    overflow-y: auto;
}

.sidebar-ellipsis {
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: block;
}

.sidebar-path-wrap {
    max-width: 220px;
    overflow-x: auto;
    white-space: nowrap;
    text-overflow: ellipsis;
    display: block;
    font-size: 0.91rem;
}

.details-sidebar h5,
.details-sidebar .fw-bold {
    font-size: 1.05rem;
    color: #16767b;
}

.details-sidebar strong {
    color: #16767b;
    font-weight: 500;
}

.details-sidebar .rounded-circle {
    border: 1.5px solid #e6f3f4;
}

.details-sidebar hr {
    margin: 0.7rem 0 0.5rem 0;
    border-color: #e6f3f4;
}

.sidebar-meta-grid {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 0.2rem 0.7rem;
    font-size: 0.91rem;
    color: #555;
    margin-bottom: 0.2rem;
}

.sidebar-meta-grid div:first-child {
    color: #16767b;
    font-weight: 500;
}

@media (max-width: 900px) {
    .details-sidebar {
        width: 100vw !important;
        right: 0;
        left: 0;
        border-radius: 0;
        top: 0;
        transform: none;
        max-width: 100vw;
        max-height: 100vh;
        padding: 1.1rem 0.7rem 0.7rem 0.7rem;
    }

    .sidebar-ellipsis,
    .sidebar-path-wrap {
        max-width: 90vw;
    }
}

.progress-bar {
    background-color: var(--primary-color) !important;
    color: white !important;
    transition: background-color 0.2s;
}