/* ============================================================
   desktop-icons.css — Desktop File Icons
   macOS Desktop Website
   ============================================================ */

/* ── Layer container ────────────────────────────────────────── */
#desktop-icons-layer {
  position: absolute;
  inset: 0;
  pointer-events: none; /* icons handle their own events */
  z-index: 5;
}

/* ── Single icon ────────────────────────────────────────────── */
.desktop-icon {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  width: 72px;
  cursor: default;
  pointer-events: auto;
  border-radius: 8px;
  padding: 6px 4px;
  user-select: none;
  -webkit-user-select: none;
  transition: background 0.1s ease;
}

.desktop-icon:hover {
  background: rgba(255, 255, 255, 0.12);
}

.desktop-icon.selected {
  background: rgba(255, 255, 255, 0.2);
}

.desktop-icon.di-dragging {
  opacity: 0.7;
  cursor: grabbing;
}

/* ── Icon image ─────────────────────────────────────────────── */
.di-icon {
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
  transition: transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.desktop-icon:hover .di-icon,
.desktop-icon.selected .di-icon {
  transform: scale(1.06);
}

/* ── Label ──────────────────────────────────────────────────── */
.di-label {
  font-family: var(--font-system);
  font-size: 11px;
  font-weight: 500;
  color: #fff;
  text-align: center;
  line-height: 1.3;
  overflow-wrap: break-word;
  max-width: 80px;
  text-shadow: 0 1px 3px rgba(0,0,0,0.7), 0 0 8px rgba(0,0,0,0.4);
}

.desktop-icon.selected .di-label {
  background: rgba(58, 122, 214, 0.85);
  border-radius: 3px;
  padding: 0 2px;
  text-shadow: none;
}

/* ── Folder drop-target highlight ───────────────────────────── */
.desktop-folder.folder-dragover .di-icon {
  transform: scale(1.12);
  filter: drop-shadow(0 0 10px rgba(91, 156, 246, 0.85))
          drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

/* ── Folder badge (item count) ──────────────────────────────── */
.di-badge {
  position: absolute;
  top: 3px;
  right: 1px;
  min-width: 16px;
  height: 16px;
  background: var(--color-error);
  border: 1.5px solid rgba(255,255,255,0.7);
  border-radius: 8px;
  font-size: 9px;
  font-weight: 700;
  color: #fff;
  display: none; /* shown by JS when count > 0 */
  align-items: center;
  justify-content: center;
  padding: 0 3px;
  pointer-events: none;
  font-family: var(--font-system);
  line-height: 1;
}

/* ── Finder window ─────────────────────────────────────────── */
.finder-window {
  min-width: 380px;
  min-height: 220px;
}

/* Finder titlebar extensions (extra controls beyond traffic lights) */
.finder-window .fw-titlebar {
  gap: 10px;
}

/* Back / Forward nav */
.fw-nav {
  display: flex;
  gap: 2px;
  flex-shrink: 0;
}

.fw-nav-btn {
  width: 20px;
  height: 20px;
  background: none;
  border: none;
  border-radius: 4px;
  color: var(--text-quaternary, #ccc);
  font-size: 16px;
  cursor: default;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
  font-family: var(--font-system);
}

.fw-nav-btn.fw-nav-active {
  color: var(--text-secondary, #555);
  cursor: pointer;
}

/* Toolbar right */
.fw-toolbar-right {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.fw-view-btn {
  width: 24px;
  height: 24px;
  background: none;
  border: none;
  border-radius: 5px;
  color: var(--text-quaternary, #aaa);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background 0.1s;
}

.fw-view-btn:hover    { background: var(--sidebar-hover, rgba(0, 0, 0, 0.07)); }
.fw-view-btn.fw-view-active { color: var(--accent, #4A88EE); }

/* Finder window-content needs to fill and flex */
.fw-window-content {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
  min-height: 0;
}

/* Body row: sidebar + content */
.fw-body {
  display: flex;
  flex: 1;
  overflow: hidden;
  min-height: 0;
}

/* Sidebar */
.fw-sidebar {
  width: 144px;
  flex-shrink: 0;
  background: var(--sidebar-bg, rgba(230, 230, 230, 0.75));
  border-right: 1px solid var(--border-primary, rgba(0, 0, 0, 0.09));
  padding: 10px 0 8px;
  overflow-y: auto;
}

.fw-sidebar-section { padding-bottom: 6px; }

.fw-sidebar-heading {
  display: block;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-tertiary, #999);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0 12px 5px;
  font-family: var(--font-system);
}

.fw-sidebar-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px 5px 12px;
  margin: 0 4px;
  font-size: 12px;
  color: var(--text-secondary, #444);
  font-family: var(--font-system);
  border-radius: 5px;
  cursor: default;
  transition: background 0.08s;
}

.fw-sidebar-item:hover { background: var(--sidebar-hover, rgba(0, 0, 0, 0.06)); }

.fw-sidebar-active {
  background: var(--sidebar-active, rgba(74, 136, 238, 0.14)) !important;
  color: var(--accent, #1a5cbf);
  font-weight: 500;
}

/* Content pane */
.fw-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

/* Column headers */
.fw-col-headers {
  display: flex;
  align-items: center;
  height: 26px;
  padding: 0 10px;
  background: var(--surface-secondary, rgba(244, 244, 244, 0.9));
  border-bottom: 1px solid var(--border-secondary, rgba(0, 0, 0, 0.09));
  flex-shrink: 0;
}

.fw-col-headers > div {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-tertiary, #666);
  font-family: var(--font-system);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fw-col-name     { flex: 1; min-width: 0; }
.fw-col-modified { width: 128px; flex-shrink: 0; }
.fw-col-size     { width: 54px;  flex-shrink: 0; text-align: right; padding-right: 14px; }
.fw-col-kind     { width: 108px; flex-shrink: 0; }
.fw-sort-arrow   { color: var(--text-quaternary, #999); font-size: 9px; }

/* File list */
.fw-file-list {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

.fw-file-empty {
  padding: 28px 0;
  text-align: center;
  color: var(--text-quaternary, #b0b0b0);
  font-size: 12px;
  font-family: var(--font-system);
}

/* Individual file rows */
.fw-file-row {
  display: flex;
  align-items: center;
  height: 30px;
  padding: 0 10px;
  cursor: default;
  position: relative;
  transition: background 0.07s;
}

.fw-file-row.fw-row-clickable { cursor: pointer; }
.fw-file-row:nth-child(even) { background: var(--surface-secondary, rgba(0, 0, 0, 0.022)); }
.fw-file-row:hover            { background: var(--sidebar-hover, rgba(74, 136, 238, 0.1)) !important; }
.fw-file-row.fw-row-selected  { background: var(--sidebar-active, rgba(74, 136, 238, 0.2)) !important; }

/* Name cell */
.fw-file-name {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  font-size: 12px;
  color: var(--text-primary, #1a1a1a);
  font-family: var(--font-system);
}

.fw-file-name span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Small row icon */
.fw-row-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.18));
}

.fw-row-icon .di-icon {
  width: 18px;
  height: 18px;
  filter: none;
  transform: none;
}

.fw-row-icon .di-icon svg {
  width: 16px;
  height: auto;
}

/* Metadata cells */
.fw-file-modified,
.fw-file-size,
.fw-file-kind {
  font-size: 11px;
  color: var(--text-tertiary, #666);
  font-family: var(--font-system);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fw-file-modified { width: 128px; flex-shrink: 0; }
.fw-file-size     { width: 54px;  flex-shrink: 0; text-align: right; padding-right: 14px; }
.fw-file-kind     { width: 108px; flex-shrink: 0; }

/* Eject button (remove from folder) */
.fw-file-row .fw-eject {
  position: absolute;
  right: 6px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--surface-tertiary, rgba(0, 0, 0, 0.11));
  border: none;
  font-size: 9px;
  color: var(--text-secondary, #555);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.1s, background 0.1s;
  padding: 0;
}

.fw-file-row:hover .fw-eject  { opacity: 1; }
.fw-eject:hover                { background: var(--surface-quaternary, rgba(0, 0, 0, 0.22)) !important; }

/* Status bar */
.fw-statusbar {
  height: 26px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface-secondary, rgba(244, 244, 244, 0.9));
  border-top: 1px solid var(--border-secondary, rgba(0, 0, 0, 0.09));
  flex-shrink: 0;
}

#fw-item-count {
  font-size: 10.5px;
  color: var(--text-tertiary, #888);
  font-family: var(--font-system);
}

.fw-path {
  display: flex;
  align-items: center;
  gap: 3px;
}

.fw-path-seg {
  font-size: 10px;
  color: var(--text-tertiary, #999);
  font-family: var(--font-system);
}

.fw-path-sep {
  font-size: 9px;
  color: var(--text-quaternary, #ccc);
  font-family: var(--font-system);
}

/* ── Finder window drag-over highlight ──────────────────────── */
#window-finder.folder-win-dragover {
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.38),
    0 0 0 2px rgba(74, 136, 238, 0.7),
    0 0 20px rgba(74, 136, 238, 0.3);
}

/* ── Static icon cells (Downloads easter egg) ──────────────── */
.fw-row-icon-static {
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.18));
}

.fw-row-icon-static svg {
  width: auto;
  height: 16px;
}


/* ── Row drag ghost ─────────────────────────────────────────── */
.fw-drag-ghost {
  position: fixed !important;
  pointer-events: none !important;
  z-index: 9999;
  opacity: 0.82;
  transform: scale(0.88) !important;
  transform-origin: top left;
  transition: none !important;
  animation: none !important;
  cursor: grabbing;
}

/* ── Reduced motion ─────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .di-icon { transition: none; }
  .desktop-icon { transition: none; }
  .finder-window { animation: none; }
}
