/* WebOS — Desktop Styles */

/* ===== Wallpaper (desktop background) ===== */
#desktop-wallpaper {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, #0f0c29 0%, #302b63 50%, #24243e 100%);
  z-index: 0;
}

/* ===== Desktop Icons ===== */
#desktop-icons {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  flex-wrap: wrap;
  align-content: flex-start;
  padding: var(--space-lg);
  gap: var(--space-xs);
}

.desktop-icon {
  width: 80px;
  height: 88px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  transition: background var(--transition-fast);
  padding: var(--space-sm);
}

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

.desktop-icon:active {
  background: rgba(255, 255, 255, 0.14);
}

.desktop-icon-img {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  line-height: 1;
}

.desktop-icon-label {
  font-size: var(--font-size-xs);
  color: #fff;
  text-align: center;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
  line-height: 1.2;
  word-break: break-word;
  max-width: 100%;
}

/* ===== Taskbar ===== */
#taskbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--taskbar-height);
  background: var(--color-taskbar-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  display: flex;
  align-items: center;
  padding: 0 var(--space-sm);
  z-index: 10000;
  border-top: 1px solid var(--color-border);
}

/* Start button */
#start-button {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--color-accent);
  font-size: 22px;
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  transition: background var(--transition-fast);
  flex-shrink: 0;
}

#start-button:hover {
  background: rgba(255, 255, 255, 0.08);
}

#start-button.active {
  background: rgba(233, 69, 96, 0.15);
}

/* Taskbar open apps area */
#taskbar-apps {
  flex: 1;
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 0 var(--space-sm);
  overflow-x: auto;
}

/* System tray (right side) */
#system-tray {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: 0 var(--space-sm);
  flex-shrink: 0;
}

#clock {
  font-size: var(--font-size-sm);
  color: var(--color-text);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* ===== Start Menu ===== */
#start-menu {
  position: fixed;
  display: none;
  bottom: calc(var(--taskbar-height) + var(--space-sm));
  left: var(--space-sm);
  width: 320px;
  max-height: calc(100vh - var(--taskbar-height) - var(--space-lg));
  background: var(--color-start-menu-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-md);
  box-shadow: 0 8px 32px var(--color-shadow);
  z-index: 10001;
  overflow: hidden;
  transition: opacity var(--transition-normal);
}

#start-menu.visible {
  display: flex;
  flex-direction: column;
}

#start-menu-header {
  padding: var(--space-lg) var(--space-lg) var(--space-md);
  font-size: var(--font-size-xl);
  font-weight: 700;
  color: var(--color-text);
  border-bottom: 1px solid var(--color-border);
}

#start-menu-apps {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-sm);
}

.start-menu-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.start-menu-item:hover {
  background: rgba(255, 255, 255, 0.08);
}

.start-menu-item-icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  border-radius: var(--border-radius-sm);
  flex-shrink: 0;
}

.start-menu-item-text {
  font-size: var(--font-size-sm);
  color: var(--color-text);
}

/* Light theme overrides */
[data-theme="light"] #desktop-wallpaper {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

[data-theme="light"] .desktop-icon:hover {
  background: rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .desktop-icon:active {
  background: rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .desktop-icon-label {
  color: #222;
  text-shadow: 0 1px 3px rgba(255, 255, 255, 0.5);
}

[data-theme="light"] #start-button {
  color: var(--lt-color-accent);
}

[data-theme="light"] #start-menu {
  background: var(--lt-color-start-menu-bg);
}

[data-theme="light"] .start-menu-item:hover {
  background: rgba(0, 0, 0, 0.05);
}

/* ======================================== */
/* ===== Responsive Layout (768px+) ======= */
/* ======================================== */

@media (max-width: 1024px) {
  /* Smaller desktop icons */
  .desktop-icon {
    width: 72px;
    height: 80px;
  }

  .desktop-icon-img {
    width: 40px;
    height: 40px;
    font-size: 28px;
  }

  .desktop-icon-label {
    font-size: 0.65rem;
  }

  /* Wider start menu */
  #start-menu {
    width: 280px;
  }

  /* Taskbar: hide label, show icon only */
  .taskbar-app-item-label {
    display: none;
  }

  .taskbar-app-item {
    padding: var(--space-xs);
    justify-content: center;
  }

  .taskbar-app-item-icon {
    font-size: 18px;
  }
}

@media (max-width: 768px) {
  /* Smaller taskbar */
  :root {
    --taskbar-height: 42px;
  }

  /* Smaller desktop icons */
  .desktop-icon {
    width: 64px;
    height: 72px;
    padding: var(--space-xs);
  }

  .desktop-icon-img {
    width: 36px;
    height: 36px;
    font-size: 24px;
  }

  .desktop-icon-label {
    font-size: 0.6rem;
  }

  #desktop-icons {
    padding: var(--space-md);
    gap: 2px;
  }

  /* Start menu: full width on mobile */
  #start-menu {
    width: calc(100vw - var(--space-sm) * 2);
    left: var(--space-sm);
    right: var(--space-sm);
    max-height: 60vh;
  }

  #start-menu-header {
    padding: var(--space-md);
    font-size: var(--font-size-lg);
  }

  /* Start button: larger touch target */
  #start-button {
    width: 48px;
    height: 42px;
    font-size: 24px;
  }

  /* Smaller window minimums for tablets */
  .window {
    min-width: 280px !important;
    min-height: 180px !important;
  }

  /* Clock: show time only */
  #clock {
    font-size: 0.7rem;
  }
}
