/* ============================================
   DESKTOP.CSS — Desktop layout, icons, wallpaper
   ============================================ */

*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
  overflow: hidden;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Desktop Grid Layout */
#desktop {
  display: grid;
  grid-template-rows: 28px 1fr 44px;
  height: 100vh;
  width: 100vw;
  background-color: #E8E0D0;
  background-image:
    radial-gradient(circle at 20% 80%, rgba(61, 242, 229, 0.08) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(61, 242, 229, 0.05) 0%, transparent 50%),
    radial-gradient(circle at 50% 50%, rgba(0, 0, 0, 0.02) 0%, transparent 80%);
  position: relative;
}

/* Desktop Icons Area */
#desktop-icons {
  grid-row: 2;
  position: relative;
  padding: 20px;
  display: flex;
  justify-content: space-between;
  pointer-events: none;
  z-index: 1;
}

.icons-column {
  display: flex;
  flex-direction: column;
  gap: 2px;
  pointer-events: auto;
}

.icons-column--left {
  align-items: flex-start;
}

.icons-column--right {
  align-items: flex-end;
}

/* Individual Desktop Icon */
.desktop-icon {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 68px;
  padding: 4px 2px;
  border-radius: 6px;
  cursor: default;
  user-select: none;
  -webkit-user-select: none;
  transition: background-color 0.1s ease;
}

.desktop-icon:hover {
  background-color: rgba(61, 242, 229, 0.1);
}

.desktop-icon.selected {
  background-color: rgba(61, 242, 229, 0.2);
  outline: 1px solid rgba(61, 242, 229, 0.4);
}

.desktop-icon__image {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 3px;
  font-size: 22px;
  line-height: 1;
}

.desktop-icon__image svg {
  width: 100%;
  height: 100%;
}

.desktop-icon__label {
  font-family: 'Space Mono', monospace;
  font-size: 10px;
  color: #1A1A1A;
  text-align: center;
  line-height: 1.3;
  word-break: break-word;
  max-width: 80px;
  text-shadow: 0 1px 2px rgba(232, 224, 208, 0.8);
}

/* Windows Container */
#windows-container {
  position: absolute;
  top: 28px;
  left: 0;
  right: 0;
  bottom: 44px;
  z-index: 2;
  pointer-events: none;
}

#windows-container > * {
  pointer-events: auto;
}

/* Selection prevention during drag */
body.dragging {
  user-select: none;
  -webkit-user-select: none;
  cursor: grabbing !important;
}

body.resizing {
  user-select: none;
  -webkit-user-select: none;
}

/* ============================================
   MOBILE RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
  #desktop {
    grid-template-rows: 28px 1fr 52px;
  }

  #desktop-icons {
    flex-direction: column;
    gap: 0;
    padding: 12px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .icons-column {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 4px;
    justify-content: center;
  }

  .icons-column--right {
    align-items: center;
  }

  .desktop-icon {
    width: 76px;
    padding: 8px 4px;
  }

  .desktop-icon__image {
    width: 36px;
    height: 36px;
    font-size: 28px;
  }

  .desktop-icon__label {
    font-size: 10px;
  }

  #windows-container {
    bottom: 52px;
  }
}
