/* ============================================================
   desktop.css — Desktop Wallpaper (Animated Gradient) &
                 Icon Grid
   ============================================================ */

/* ── Desktop Shell ── */
.desktop {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 0;
}

/* ── Animated Gradient Wallpaper ── */

/* Dark theme gradient */
.desktop-wallpaper {
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(135deg, #1c1c1e 0%, #2c2c2e 40%, #3a3a3c 100%);
  background-size: 400% 400%;
  animation: gradientShift 20s ease infinite;
}

[data-theme="dark"] .desktop-wallpaper {
  background: linear-gradient(135deg, #1c1c1e 0%, #2c2c2e 40%, #3a3a3c 100%);
  background-size: 400% 400%;
}

[data-theme="light"] .desktop-wallpaper {
  background: linear-gradient(135deg, #e8e8ed 0%, #f5f5f7 35%, #d2d2d7 65%, #ffffff 100%);
  background-size: 400% 400%;
}

[data-theme="neon"] .desktop-wallpaper {
  background: linear-gradient(135deg, #0a0a12 0%, #1a0a2e 30%, #0a122a 60%, #0a0a12 100%);
  background-size: 400% 400%;
}

/* Optional neon accent sweep overlay */
[data-theme="neon"] .desktop-wallpaper::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 30% 50%, rgba(0, 255, 200, 0.04) 0%, transparent 60%),
              radial-gradient(ellipse at 70% 30%, rgba(255, 0, 200, 0.03) 0%, transparent 50%);
  pointer-events: none;
}

@keyframes gradientShift {
  0%   { background-position: 0% 50%; }
  25%  { background-position: 100% 0%; }
  50%  { background-position: 100% 100%; }
  75%  { background-position: 0% 100%; }
  100% { background-position: 0% 50%; }
}

/* ── Desktop Icon Grid ── */

.desktop-icons {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(auto-fill, var(--desktop-icon-size));
  grid-auto-rows: calc(var(--desktop-icon-size) + 24px);
  gap: 8px;
  padding: 16px;
  align-content: start;
  justify-content: start;
  overflow-y: auto;
  overflow-x: hidden;
}

/* Individual icon item */
.desktop-icon {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: var(--desktop-icon-size);
  height: calc(var(--desktop-icon-size) + 24px);
  padding: 4px;
  border-radius: var(--border-radius-md);
  cursor: pointer;
  user-select: none;
  text-decoration: none;
  transition: background-color 0.15s ease, transform 0.15s ease;
  will-change: transform;
}

.desktop-icon:hover {
  background-color: var(--bg-hover);
}

.desktop-icon:active {
  transform: scale(0.94);
}

/* Icon image */
.desktop-icon__image {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  object-fit: cover;
  pointer-events: none;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

/* Icon label */
.desktop-icon__label {
  margin-top: 4px;
  font-size: 11px;
  line-height: 1.3;
  color: var(--desktop-icon-label-color);
  text-align: center;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: var(--desktop-icon-size);
  pointer-events: none;
}

/* Selected icon */
.desktop-icon.selected {
  background-color: var(--bg-selected);
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

/* ── Dock (fixed at bottom) ── */
.dock {
  position: fixed;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: rgba(44, 44, 46, 0.65);
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  border-radius: 20px;
  border: 1px solid var(--border-color);
  box-shadow: 0 -2px 20px rgba(0, 0, 0, 0.3);
  z-index: 100;
}

[data-theme="light"] .dock {
  background: rgba(255, 255, 255, 0.6);
}

[data-theme="neon"] .dock {
  background: rgba(10, 10, 18, 0.75);
  border-color: rgba(0, 255, 200, 0.2);
}

.dock-item {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  cursor: pointer;
  transition: transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1),
              filter 0.15s ease;
  object-fit: cover;
}

.dock-item:hover {
  transform: scale(1.15);
}

.dock-item.active {
  filter: brightness(1.3);
  box-shadow: 0 0 12px var(--accent-glow);
}

/* ── Desktop Context Menu ── */
.desktop-context-menu {
  position: absolute;
  min-width: 200px;
  background: var(--bg-window);
  backdrop-filter: blur(30px) saturate(1.5);
  -webkit-backdrop-filter: blur(30px) saturate(1.5);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  box-shadow: var(--shadow-lg);
  padding: 4px;
  z-index: 200;
}

.desktop-context-menu__item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--border-radius-sm);
  font-size: 13px;
  color: var(--text-primary);
  cursor: pointer;
  transition: background-color 0.12s ease;
}

.desktop-context-menu__item:hover {
  background-color: var(--accent);
  color: var(--text-inverse);
}

.desktop-context-menu__separator {
  height: 1px;
  margin: 4px 8px;
  background: var(--border-color);
}
