/* files.css — the Files view: browse, upload, file grid/list */

.files-layout {
    display: flex;
    flex-direction: row;
    height: calc(100dvh - 50px);
}

/* --- Tree sidebar --- */
.files-tree {
    width: 220px;
    min-width: 180px;
    border-right: 1px solid var(--border);
    overflow-y: auto;
    flex-shrink: 0;
}
.tree-header {
    padding: 14px 16px 8px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-dim);
}
.tree-root {
    padding-bottom: 16px;
}
.tree-item {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 5px 12px;
    cursor: pointer;
    font-size: 12px;
    color: var(--text-secondary);
    transition: background 0.1s, color 0.1s;
    border-left: 2px solid transparent;
    user-select: none;
}
.tree-item:hover {
    background: rgba(0,200,255,0.04);
    color: var(--text-primary);
}
.tree-item.tree-active {
    background: rgba(0,200,255,0.08);
    color: var(--cyan);
    border-left-color: var(--cyan);
}
.tree-toggle {
    width: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--text-dim);
    cursor: pointer;
}
.tree-toggle:hover { color: var(--cyan); }
.tree-toggle-spacer { width: 16px; flex-shrink: 0; }
.tree-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.tree-icon {
    display: inline-flex;
    align-items: center;
    color: var(--text-dim);
}
.tree-icon svg { vertical-align: middle; }
.tree-active .tree-icon { color: var(--cyan); }

.files-content {
    flex: 1;
    overflow-y: auto;
    padding: 24px 28px;
    min-width: 0;
}

/* --- File grid --- */
.file-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}
.file-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.file-card:hover {
    border-color: var(--border-focus);
    background: rgba(0,200,255,0.03);
}
.file-card.folder { border-left: 3px solid var(--violet); }
.file-card .file-icon { line-height: 1; color: var(--text-muted); }
.file-card .file-icon svg { vertical-align: middle; }
.file-card.folder .file-icon { color: var(--cyan); }
.file-card .file-name {
    font-size: 13px;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.file-card .file-meta {
    font-size: 11px;
    color: var(--text-muted);
    display: flex;
    gap: 8px;
}

/* --- File list (table) --- */
.file-list { width: 100%; }
.file-list .file-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-bottom: 1px solid rgba(255,255,255,0.03);
    cursor: pointer;
    transition: background 0.1s;
}
.file-list .file-row:hover { background: rgba(0,200,255,0.02); }
.file-list .file-list-header {
    cursor: default;
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-dim);
    border-bottom: 1px solid var(--border);
}
.file-list .file-list-header:hover { background: transparent; }
.file-list .file-list-header .file-name { font-weight: 500; font-size: 11px; }
.file-list .file-row .file-icon { flex-shrink: 0; width: 24px; text-align: center; color: var(--text-muted); }
.file-list .file-row .file-icon svg { vertical-align: middle; }
.file-list .file-row[data-folder-id] .file-icon { color: var(--cyan); }
.file-list .file-row .file-name { flex: 1; font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-list .file-row .file-size { font-size: 12px; color: var(--text-muted); width: 80px; text-align: right; }
.file-list .file-row .file-date { font-size: 12px; color: var(--text-muted); width: 140px; }
.file-list .file-row .file-sensitivity { width: 80px; }

/* --- View toggle --- */
.view-toggle {
    display: flex;
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
}
.view-toggle button {
    padding: 6px 12px;
    font-size: 14px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s;
}
.view-toggle button.active {
    background: rgba(0,200,255,0.12);
    color: var(--cyan);
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .files-tree { display: none; }
}
@media (max-width: 640px) {
    .files-content { padding: 16px 12px; }
    .file-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
    .file-card { padding: 12px; }
    .file-card .file-icon { font-size: 22px; }
    .file-list .file-row .file-size,
    .file-list .file-row .file-sensitivity { display: none; }
    .file-list .file-row .file-date { width: 100px; }
    .toolbar { gap: 8px; }
    .modal { min-width: unset; max-width: 95vw; padding: 20px; }
    .modal-wide { min-width: unset; max-width: 95vw; }
}
