/* UGABUGA OS - Desktop, Icons, Taskbar, Start Menu */

#desktopScreen {
  flex-direction: column;
  animation: fadeIn 0.5s ease;
  align-items: stretch;
  justify-content: stretch;
}

#desktop {
  flex: 1;
  position: relative;
  overflow: hidden;
  background-image: url('../assets/Ugabuga.png');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

#desktopIcons {
  position: absolute;
  top: 8px; left: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 1;
  max-height: calc(100% - 8px);
  flex-wrap: wrap;
  align-content: flex-start;
}

#windowContainer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 10;
}
#windowContainer > * { pointer-events: all; }

/* Desktop Icons */
.desktop-icon {
  width: 72px;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 4px;
  cursor: pointer;
  user-select: none;
  border: 1px solid transparent;
  transition: background 0.1s;
}
.desktop-icon:hover .icon-label {
  background: #000080;
  color: #fff;
}
.desktop-icon.selected .icon-label {
  background: #000080;
  color: #fff;
}
.desktop-icon.selected {
  border-color: rgba(255,255,255,0.3);
  background: rgba(0,0,128,0.15);
}

.icon-img {
  width: 40px;
  height: 40px;
  image-rendering: pixelated;
  filter: drop-shadow(1px 1px 0 rgba(0,0,0,0.5));
  pointer-events: none;
}

.icon-label {
  font-family: var(--font-main);
  font-size: 10px;
  color: #fff;
  text-align: center;
  margin-top: 3px;
  padding: 1px 3px;
  text-shadow: 1px 1px 1px #000, -1px -1px 1px #000,
               1px -1px 1px #000, -1px 1px 1px #000;
  word-break: break-word;
  max-width: 70px;
  line-height: 1.2;
  pointer-events: none;
}

/* Taskbar */
#taskbar {
  position: relative;
  height: 40px;
  background: #c0c0c0;
  border-top: 2px solid #ffffff;
  display: flex;
  align-items: center;
  padding: 0 4px;
  gap: 4px;
  z-index: 9000;
  user-select: none;
  flex-shrink: 0;
}

.home-btn {
  background: #c0c0c0;
  border-top: 2px solid #ffffff;
  border-left: 2px solid #ffffff;
  border-right: 2px solid #404040;
  border-bottom: 2px solid #404040;
  font-family: var(--font-main);
  font-size: 12px;
  font-weight: bold;
  padding: 2px 10px;
  height: 30px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  flex-shrink: 0;
  color: #000;
}
.home-btn:active, .home-btn.active {
  border-top: 2px solid #404040;
  border-left: 2px solid #404040;
  border-right: 2px solid #ffffff;
  border-bottom: 2px solid #ffffff;
}
.home-icon {
  width: 18px; height: 18px;
  flex-shrink: 0;
}

.back-btn {
  background: #c0c0c0;
  border-top: 2px solid #ffffff;
  border-left: 2px solid #ffffff;
  border-right: 2px solid #404040;
  border-bottom: 2px solid #404040;
  font-family: var(--font-main);
  font-size: 10px;
  padding: 2px 8px;
  height: 28px;
  cursor: pointer;
  color: #000;
  white-space: nowrap;
  flex-shrink: 0;
}
.back-btn:active {
  border-top: 2px solid #404040;
  border-left: 2px solid #404040;
  border-right: 2px solid #ffffff;
  border-bottom: 2px solid #ffffff;
}

.taskbar-divider {
  width: 2px;
  height: 28px;
  border-left: 1px solid #808080;
  border-right: 1px solid #ffffff;
  flex-shrink: 0;
  margin: 0 2px;
}

#taskbarApps {
  flex: 1;
  display: flex;
  gap: 3px;
  overflow: hidden;
  align-items: center;
  min-width: 0;
}

/* ====================================================
   GAMIFIED TASKBAR APP TABS — neon game HUD style
   ==================================================== */
.taskbar-btn {
  background: linear-gradient(180deg, #0a0a1f 0%, #050510 100%);
  border: 1px solid #00ff41;
  color: #00ff41;
  font-family: var(--font-main);
  font-size: 10px;
  font-weight: bold;
  padding: 2px 10px;
  height: 28px;
  cursor: pointer;
  letter-spacing: 0.5px;
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex-shrink: 0;
  text-shadow: 0 0 6px rgba(0,255,65,0.8);
  box-shadow: 0 0 6px rgba(0,255,65,0.25), inset 0 0 4px rgba(0,255,65,0.05);
  transition: all 0.12s ease;
  text-transform: uppercase;
}
.taskbar-btn:hover {
  background: linear-gradient(180deg, #0f0f2f 0%, #0a0a1f 100%);
  border-color: #00ff41;
  box-shadow: 0 0 12px rgba(0,255,65,0.5), inset 0 0 8px rgba(0,255,65,0.1);
  color: #fff;
  text-shadow: 0 0 8px rgba(0,255,65,1);
}
.taskbar-btn.active {
  background: linear-gradient(180deg, #003300 0%, #001a00 100%);
  border-color: #00ff41;
  box-shadow: 0 0 16px rgba(0,255,65,0.6), inset 0 0 10px rgba(0,255,65,0.15);
  color: #00ff41;
  text-shadow: 0 0 10px rgba(0,255,65,1);
}
.taskbar-btn:active { transform: scale(0.97); }
/* ==================================================== */

#taskbarClock {
  font-family: var(--font-main);
  font-size: 11px;
  color: #000;
  padding: 3px 8px;
  border-top: 1px solid #808080;
  border-left: 1px solid #808080;
  border-right: 1px solid #ffffff;
  border-bottom: 1px solid #ffffff;
  white-space: nowrap;
  flex-shrink: 0;
}

/* Start Menu */
.start-menu {
  position: absolute;
  bottom: 40px;
  left: 0;
  background: #c0c0c0;
  border-top: 2px solid #ffffff;
  border-left: 2px solid #ffffff;
  border-right: 2px solid #404040;
  border-bottom: 2px solid #404040;
  outline: 1px solid #000;
  min-width: 180px;
  z-index: 10000;
  display: none;
}
.start-menu.visible { display: flex; }

.start-menu-sidebar {
  background: linear-gradient(180deg, #808080, #404040);
  color: #fff;
  font-family: var(--font-retro);
  font-size: 20px;
  letter-spacing: 2px;
  padding: 8px 5px;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  user-select: none;
  white-space: nowrap;
}

#startMenuApps { flex: 1; }

.start-menu-item {
  padding: 6px 12px;
  font-family: var(--font-main);
  font-size: 11px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #000;
  border-bottom: 1px solid #d0d0d0;
  user-select: none;
}
.start-menu-item:hover {
  background: #000080;
  color: #fff;
}
.start-menu-item span { font-size: 16px; }

.start-menu-separator {
  height: 0;
  border-top: 1px solid #808080;
  border-bottom: 1px solid #fff;
  margin: 2px 0;
}

/* Mobile */
@media (max-width: 768px) {
  #desktopIcons {
    gap: 4px;
    padding: 6px;
  }
  .desktop-icon { width: 64px; padding: 3px; }
  .icon-img { width: 36px; height: 36px; }
  .icon-label { font-size: 9px; max-width: 62px; }
  #taskbar { height: 44px; padding: 0 3px; gap: 3px; }
  .home-btn { font-size: 11px; padding: 2px 8px; }
  .taskbar-btn { max-width: 100px; font-size: 9px; padding: 2px 6px; }
}

/* Mobile desktop background */
@media (max-width: 768px) {
  #desktop {
    background-image: url('../assets/mobile-bg.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
  }
}
