/* =======================================================
   FILE MANAGER – GRID & LIST VIEW STYLES ONLY
   ======================================================= */

/* Design tokens (light/dark aware) */
:root,
[data-bs-theme="light"] {
  --fm-bg: #ffffff;
  --fm-text: #1a1d21;
  --fm-muted: #6c757d;
  --fm-surface: #ffffff;
  --fm-elevated: #f7f8fa;
  --fm-border: rgba(0,0,0,0.08);
  --fm-ring: rgba(13,110,253,0.35);
  --fm-accent: #0d6efd;
  --fm-hover: rgba(13,110,253,0.06);
  --fm-shadow: 0 10px 30px rgba(0,0,0,0.08);
  --fm-softshadow: 0 4px 16px rgba(0,0,0,0.06);
  --fm-grad-1: linear-gradient(135deg, rgba(13,110,253,0.18), rgba(111,66,193,0.18));
}

[data-bs-theme="dark"] {
  --fm-bg: #0e1117;
  --fm-text: #e7e9ee;
  --fm-muted: #a0a4ab;
  --fm-surface: #12151b;
  --fm-elevated: #141925;
  --fm-border: rgba(255,255,255,0.1);
  --fm-ring: rgba(61,139,253,0.45);
  --fm-accent: #3d8bfd;
  --fm-hover: rgba(61,139,253,0.14);
  --fm-shadow: 0 18px 42px rgba(0,0,0,0.45);
  --fm-softshadow: 0 6px 22px rgba(0,0,0,0.32);
  --fm-grad-1: linear-gradient(135deg, rgba(61,139,253,0.2), rgba(166,126,255,0.18));
}

/* Grid container */
.fm-grid {
  flex: 1 1 auto;
  overflow: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(114px, 1fr));
  gap: 16px;
  padding: 16px;
}

@media (min-width: 576px) {
  .fm-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 18px; }
}

@media (min-width: 992px) {
  .fm-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 20px; }
}

/* File tile */
.fm-filetile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  background: var(--fm-surface);
  border: 1px solid var(--fm-border);
  border-radius: 16px;
  padding: 12px 10px;
  box-shadow: var(--fm-softshadow);
  cursor: pointer;
  user-select: none;
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease, background-color .12s ease;
  background-image: var(--fm-grad-1);
  min-height: 0;
  height: 120px;
  line-height: 1.1;
}

.fm-filetile:hover {
  transform: translateY(-2px);
  box-shadow: var(--fm-shadow);
  background: color-mix(in srgb, var(--fm-hover) 40%, var(--fm-surface));
}

.fm-filetile:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px var(--fm-ring);
}

.fm-filetile.active {
  border-color: var(--fm-accent);
  background: color-mix(in srgb, var(--fm-hover) 60%, var(--fm-surface));
}

/* Thumbnail container */
.fm-thumb {
  position: relative;
  width: 72px;
  height: 72px;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--fm-border);
  background-color: var(--fm-surface);
  flex: 0 0 72px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.fm-thumb--icon i {
  font-size: 28px;
  color: var(--thumb-accent, var(--fm-muted));
}

/* Extension badge */
.fm-ext {
  position: absolute;
  right: 6px;
  bottom: 6px;
  font-size: 10px;
  padding: 3px 6px;
  border-radius: 6px;
  background: color-mix(in srgb, var(--thumb-accent, #6b7280) 18%, var(--fm-surface));
  border: 1px solid color-mix(in srgb, var(--thumb-accent, #6b7280) 35%, var(--fm-border));
  color: var(--fm-text);
  opacity: .9;
  user-select: none;
  pointer-events: none;
}

/* Filename */
.fm-filename {
  max-width: 100%;
  font-size: .82rem;
  text-align: center;
  color: var(--fm-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* List View */
.fm-listview {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.fm-listview-head {
  display: grid;
  grid-template-columns: 1fr 120px 180px;
  gap: 8px;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid var(--fm-border);
  background: var(--fm-elevated);
  font-weight: 600;
  color: var(--fm-muted);
}

.fm-listview-body {
  overflow: auto;
  flex: 1;
}

.fm-listview-row {
  display: grid;
  grid-template-columns: 1fr 120px 180px;
  gap: 8px;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid var(--fm-border);
  cursor: pointer;
}

.fm-listview-row:hover {
  background: var(--fm-hover);
}

.fm-listview-row .cell-name {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.fm-listview-row .nm {
  color: var(--fm-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Small thumb in list */
.fm-thumb.fm-thumb-xs {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid var(--fm-border);
  display: flex;
  align-items: center;
  justify-content: center;
}

.fm-thumb.fm-thumb-xs i {
  font-size: 14px;
  color: var(--thumb-accent, var(--fm-muted));
}

/* Progress bar (zip/upload) */
.fm-progress {
  background: var(--fm-elevated);
  border-bottom: 1px solid var(--fm-border);
  padding: 6px 8px;
}

.fm-progress-bar {
  height: 22px;
  background: var(--fm-accent);
  color: #fff;
  text-align: center;
  line-height: 22px;
  border-radius: 8px;
  box-shadow: var(--fm-softshadow);
}

/* Drag-over highlight */
#fileManager.drag-over {
  box-shadow: 0 0 0 4px var(--fm-ring);
}
