/* ==========================================================================
   Desktop Shell — Wallpaper, Icons, Taskbar, Context Menu
   Windows XP nostalgia theme for a web radio station
   ========================================================================== */

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

/* ---------- Base ---------- */
html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  font-size: 12px;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  cursor: default;
}

/* ---------- Utility ---------- */
.hidden {
  display: none !important;
}

/* ==========================================================================
   Desktop / Wallpaper
   ========================================================================== */

#desktop {
  width: 100%;
  height: calc(100% - 36px);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  position: relative;
}

#desktop.wallpaper-bliss {
  background-image: url('../img/bliss.svg');
  background-size: cover;
  background-position: center;
}

#desktop.wallpaper-aurora {
  background-image: url('../img/aurora.svg');
  background-size: cover;
  background-position: center;
}

/* ==========================================================================
   Desktop Icons
   ========================================================================== */

#desktop-icons {
  display: flex;
  flex-direction: column;
  flex-wrap: wrap;
  gap: 8px;
  padding: 16px;
  height: 100%;
  align-content: flex-start;
}

.desktop-icon {
  width: 80px;
  text-align: center;
  padding: 4px;
  border-radius: 3px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

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

.desktop-icon.selected {
  background-color: rgba(51, 102, 204, 0.55);
  border-color: rgba(255, 255, 255, 0.5) dotted;
}

.desktop-icon-img {
  font-size: 36px;
  line-height: 1;
  margin-bottom: 4px;
  pointer-events: none;
  filter: drop-shadow(1px 2px 3px rgba(0, 0, 0, 0.5));
  transition: transform 0.15s ease;
}

.desktop-icon:hover .desktop-icon-img {
  transform: scale(1.1);
}

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

.desktop-icon-label {
  color: #fff;
  font-size: 11px;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
  overflow-wrap: break-word;
  word-break: break-word;
  pointer-events: none;
  line-height: 1.3;
}

/* ==========================================================================
   Context Menu
   ========================================================================== */

.context-menu {
  position: fixed;
  background: #fff;
  border: 1px solid #868686;
  box-shadow: 2px 2px 6px rgba(0, 0, 0, 0.35);
  z-index: 12000;
  padding: 2px 0;
  min-width: 200px;
  font-family: Tahoma, 'Segoe UI', sans-serif;
  font-size: 12px;
}

.context-menu-item {
  padding: 4px 24px;
  cursor: pointer;
  font-size: 12px;
  font-family: Tahoma, 'Segoe UI', sans-serif;
  white-space: nowrap;
  transition: background-color 0.1s ease;
}

.context-menu-item:hover {
  background: #316ac5;
  color: #fff;
}

.context-menu-separator {
  height: 1px;
  background: #c0c0c0;
  margin: 3px 2px;
}

/* ==========================================================================
   Taskbar
   ========================================================================== */

#taskbar {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 36px;
  display: flex;
  flex-direction: row;
  align-items: center;
  z-index: 9500;
  box-shadow: 0 -1px 4px rgba(0, 0, 0, 0.3);

  /* XP-style blue gradient */
  background: linear-gradient(
    to bottom,
    #3168d5 0%,
    #4e8ef5 3%,
    #245cdc 6%,
    #1941a5 10%,
    #245cdc 14%,
    #4e8ef5 20%,
    #3a7af2 50%,
    #1e55c9 80%,
    #1941a5 90%,
    #245cdc 94%,
    #4e8ef5 97%,
    #3168d5 100%
  );
  border-top: 1px solid #0e3dab;
}

/* ---------- Start Button ---------- */

.taskbar-start {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 30px;
  min-width: 100px;
  padding: 0 12px;
  margin-left: 4px;
  border: none;
  border-radius: 0 8px 8px 0;
  cursor: pointer;
  font-family: 'Franklin Gothic Medium', 'Arial Narrow', Arial, sans-serif;
  font-weight: bold;
  font-style: italic;
  font-size: 14px;
  color: #fff;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.6);
  letter-spacing: 0.5px;
  user-select: none;

  /* Green gradient */
  background: linear-gradient(
    to bottom,
    #5cb85c 0%,
    #44a844 10%,
    #3c9e3c 30%,
    #2d8c2d 50%,
    #287028 70%,
    #3c9e3c 90%,
    #5cb85c 100%
  );
  border: 1px solid #1a5c1a;
  border-left: none;
  border-radius: 0 10px 10px 0;
}

.taskbar-start:hover {
  background: linear-gradient(
    to bottom,
    #73d073 0%,
    #5cc85c 10%,
    #52be52 30%,
    #44ae44 50%,
    #389838 70%,
    #52be52 90%,
    #73d073 100%
  );
}

.taskbar-start:active {
  background: linear-gradient(
    to bottom,
    #2d8c2d 0%,
    #389838 50%,
    #2d8c2d 100%
  );
}

/* ---------- Tabs Container ---------- */

.taskbar-tabs {
  flex: 1;
  display: flex;
  gap: 2px;
  overflow-x: auto;
  padding: 0 4px;
  height: 100%;
  align-items: center;
}

.taskbar-tabs::-webkit-scrollbar {
  display: none;
}

/* ---------- Individual Tab ---------- */

.taskbar-tab {
  display: flex;
  align-items: center;
  height: 26px;
  max-width: 150px;
  min-width: 60px;
  padding: 0 8px;
  border: none;
  border-radius: 3px;
  cursor: pointer;
  font-size: 11px;
  font-family: Tahoma, 'Segoe UI', sans-serif;
  color: #fff;
  text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.4);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background 0.15s ease, box-shadow 0.15s ease;

  /* Blue gradient matching taskbar */
  background: linear-gradient(
    to bottom,
    #3a7af2 0%,
    #2d6ae0 30%,
    #245cdc 60%,
    #1e55c9 100%
  );
  border: 1px solid #1941a5;
  border-bottom: none;
}

.taskbar-tab:hover {
  background: linear-gradient(
    to bottom,
    #5e9ef8 0%,
    #4e8ef5 30%,
    #3a7af2 60%,
    #3068e0 100%
  );
}

.taskbar-tab:active {
  background: linear-gradient(
    to bottom,
    #1941a5 0%,
    #1e55c9 50%,
    #1941a5 100%
  );
}

.taskbar-tab.active {
  background: linear-gradient(
    to bottom,
    #5e9ef8 0%,
    #4e8ef5 30%,
    #3a7af2 60%,
    #3068e0 100%
  );
  border-color: #6baaf7;
  box-shadow: 0 0 6px rgba(107, 170, 247, 0.4);
}

.taskbar-tab.minimized {
  background: linear-gradient(
    to bottom,
    #7bade0 0%,
    #6998d4 30%,
    #5a88c8 60%,
    #4e7ab8 100%
  );
  border-color: #3c6ca0;
}

.taskbar-tab.minimized:hover {
  background: linear-gradient(
    to bottom,
    #94c0ee 0%,
    #82b0e0 30%,
    #72a0d4 60%,
    #6692c8 100%
  );
}

/* ---------- System Tray ---------- */

.taskbar-tray {
  display: flex;
  align-items: center;
  padding: 0 8px;
  height: 100%;
  border-left: 1px solid rgba(255, 255, 255, 0.2);
}

#taskbar-clock {
  color: #fff;
  font-size: 11px;
  font-family: Tahoma, 'Segoe UI', sans-serif;
  text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.5);
  white-space: nowrap;
}

/* ==========================================================================
   Now Playing Desktop Widget
   ========================================================================== */

.now-playing-widget {
  position: fixed;
  bottom: 48px;
  right: 12px;
  z-index: 9400;
  width: 260px;
  background: linear-gradient(180deg, #2a2a2a 0%, #1e1e1e 50%, #1a1a1a 100%);
  border: 1px solid #444;
  border-radius: 6px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5), 0 0 1px rgba(0, 255, 0, 0.2);
  font-family: 'Courier New', monospace;
  overflow: hidden;
  animation: np-widget-in 0.3s ease-out;
  user-select: none;
}

.now-playing-widget.hiding {
  animation: np-widget-out 0.25s ease-in forwards;
}

.now-playing-widget.playing {
  border-color: #00cc00;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5), 0 0 8px rgba(0, 204, 0, 0.25);
}

@keyframes np-widget-in {
  0% { opacity: 0; transform: translateY(20px) scale(0.95); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes np-widget-out {
  0% { opacity: 1; transform: translateY(0) scale(1); }
  100% { opacity: 0; transform: translateY(20px) scale(0.95); }
}

.np-widget-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 8px;
  background: linear-gradient(180deg, #3a3a3a 0%, #252525 100%);
  border-bottom: 1px solid #333;
  cursor: move;
}

.np-widget-title {
  color: #00ff00;
  font-size: 10px;
  text-shadow: 0 0 6px #00ff00;
  letter-spacing: 0.5px;
}

.np-widget-close {
  width: 16px;
  height: 16px;
  background: linear-gradient(180deg, #555 0%, #333 100%);
  border: 1px solid #666;
  border-radius: 2px;
  color: #00ff00;
  font-size: 9px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: background 0.15s ease, color 0.15s ease;
}

.np-widget-close:hover {
  background: linear-gradient(180deg, #e05a5a 0%, #a93226 100%);
  color: #fff;
}

.np-widget-body {
  padding: 8px;
}

.np-widget-track {
  color: #00cc00;
  font-size: 11px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  text-shadow: 0 0 4px #00cc00;
  margin-bottom: 4px;
  min-height: 14px;
}

.np-widget-time {
  color: #008800;
  font-size: 10px;
  text-shadow: 0 0 4px #006600;
  margin-bottom: 8px;
}

.np-widget-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.np-widget-btn {
  width: 28px;
  height: 22px;
  background: linear-gradient(180deg, #444 0%, #2a2a2a 100%);
  border: 1px solid #555;
  border-radius: 2px;
  color: #00ff00;
  font-size: 11px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Courier New', monospace;
  line-height: 1;
  transition: background 0.15s ease, border-color 0.15s ease, text-shadow 0.15s ease, transform 0.1s ease;
}

.np-widget-btn:hover {
  background: linear-gradient(180deg, #555 0%, #3a3a3a 100%);
  border-color: #00cc00;
  text-shadow: 0 0 6px #00ff00;
  transform: translateY(-1px);
}

.np-widget-btn:active {
  background: linear-gradient(180deg, #2a2a2a 0%, #1a1a1a 100%);
  transform: translateY(0);
}

.np-widget-seek {
  margin-top: 6px;
}

.np-widget-seek input[type="range"] {
  width: 100%;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: linear-gradient(to right, #00cc00 var(--seek-pct, 0%), #222 var(--seek-pct, 0%));
  border-radius: 2px;
  outline: none;
  cursor: pointer;
  border: 1px solid #333;
}

.np-widget-seek input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: #00ff00;
  cursor: pointer;
  box-shadow: 0 0 3px #00ff00;
}

.np-widget-seek input[type="range"]::-moz-range-thumb {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: #00ff00;
  cursor: pointer;
  border: none;
  box-shadow: 0 0 3px #00ff00;
}

.np-widget-seek input[type="range"]::-moz-range-track {
  background: transparent;
  border: none;
}

.np-widget-seek input[type="range"]::-moz-range-progress {
  background: #00cc00;
  border-radius: 2px;
  height: 4px;
}

.np-widget-empty {
  color: #555;
  font-size: 10px;
  text-align: center;
  padding: 8px 0;
}

/* ==========================================================================
   Loading Spinner (trending)
   ========================================================================== */

.xp-spinner {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  gap: 8px;
  color: #555;
  font-family: 'Courier New', monospace;
  font-size: 11px;
}

.xp-spinner::before {
  content: '';
  width: 16px;
  height: 16px;
  border: 2px solid #333;
  border-top-color: #00cc00;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ==========================================================================
   Focus-Visible Accessibility (keyboard navigation)
   ========================================================================== */

.taskbar-start:focus-visible,
.taskbar-tab:focus-visible,
.window-btn:focus-visible,
.xp-dialog-btn:focus-visible,
.winamp-btn:focus-visible,
.winamp-playlist-btn:focus-visible,
.np-widget-btn:focus-visible,
.np-widget-close:focus-visible,
.winamp-header-close:focus-visible,
.context-menu-item:focus-visible {
  outline: 2px dotted #fff;
  outline-offset: -2px;
}

.xp-dialog-input:focus-visible {
  outline: 2px solid #0054e3;
  outline-offset: 1px;
}

/* ==========================================================================
   Scrollbar Styling (XP theme)
   ========================================================================== */

.window-body::-webkit-scrollbar {
  width: 16px;
}

.window-body::-webkit-scrollbar-track {
  background: #f1e8d8;
  border-left: 1px solid #c8bca8;
}

.window-body::-webkit-scrollbar-thumb {
  background: linear-gradient(to right, #d6c8b4, #ece0d0, #d6c8b4);
  border: 1px solid #a89880;
  border-radius: 0;
}

.window-body::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(to right, #c4b8a4, #e0d4c4, #c4b8a4);
}

.window-body::-webkit-scrollbar-button {
  background: #ece0d0;
  border: 1px solid #a89880;
  height: 16px;
}
