/* ═══════════════════════════════════════════════════════════════════════════
   Aero Mode — Desktop Layout
   Windows Vista/7 Aero desktop, taskbar, start menu, icons
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Desktop ──────────────────────────────────────────────────────────── */

#desktop {
  width: 100%;
  height: 100%;
  height: 100dvh; /* Dynamic viewport height for mobile browsers */
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #000;
}

#desktop-area {
  flex: 1;
  position: relative;
  overflow: hidden;
}

/* ── Desktop icons ────────────────────────────────────────────────────── */

#icon-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, 88px);
  grid-auto-rows: 88px;
  gap: 4px;
  padding: 12px;
  align-content: start;
  height: 100%;
}

.desktop-icon {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 4px;
  padding: 6px 4px;
  border-radius: 4px;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}

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

.desktop-icon.selected {
  background: rgba(51, 153, 255, 0.35);
  outline: 1px solid rgba(100, 175, 255, 0.7);
  border-radius: 4px;
}

.icon-image-wrap {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.desktop-icon img {
  width: 48px;
  height: 48px;
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.4));
}

.desktop-icon-label {
  font-size: 11px;
  color: #fff;
  text-shadow:
    0 1px 3px rgba(0, 0, 0, 0.9),
    0 0px 6px rgba(0, 0, 0, 0.5);
  text-align: center;
  word-break: break-word;
  line-height: 1.2;
  max-width: 80px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* ── Windows ──────────────────────────────────────────────────────────── */

.window {
  position: absolute;
  display: flex;
  flex-direction: column;
  min-width: 150px;
  min-height: 100px;
}

.window.minimized {
  display: none;
}

.window.maximized {
  left: 0 !important;
  top: 0 !important;
  width: 100% !important;
  height: 100% !important;
  border-radius: 0 !important;
  padding: 0 !important;
}

.window.maximized .title-bar {
  border-radius: 0;
}

.window.maximized .window-body {
  border-radius: 0;
}

.window.maximized .window-resize-grip {
  display: none;
}

/* ═══════════════════════════════════════════════════════════════════════════
   TASKBAR — Glass panel along the bottom
   ═══════════════════════════════════════════════════════════════════════════ */

#taskbar {
  height: 40px;
  display: flex;
  align-items: stretch;
  padding: 0;
  position: relative;
  flex-shrink: 0;
  z-index: 50;

  /* Glass */
  background: linear-gradient(to bottom,
    rgba(50, 90, 140, 0.60) 0%,
    rgba(20, 50, 100, 0.72) 40%,
    rgba(10, 35, 75, 0.80) 100%
  );
  backdrop-filter: blur(30px) saturate(150%);
  -webkit-backdrop-filter: blur(30px) saturate(150%);

  /* Top glass reflection highlight */
  border-top: 1px solid rgba(180, 210, 255, 0.35);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 -1px 4px rgba(0, 0, 0, 0.15);
}

/* ── Start Orb — circular, extends above taskbar ──────────────────────── */

.aero-start-orb {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
  z-index: 2;

  /* Position: centered vertically in taskbar */
  align-self: center;
  margin-left: 4px;
  margin-right: 2px;

  /* Glass orb */
  background:
    radial-gradient(ellipse at 50% 30%,
      rgba(160, 210, 255, 0.5) 0%,
      transparent 60%
    ),
    radial-gradient(ellipse at center,
      rgba(50, 120, 200, 0.95) 0%,
      rgba(30, 85, 160, 0.95) 50%,
      rgba(15, 55, 115, 0.95) 100%
    );
  box-shadow:
    0 0 0 1.5px rgba(0, 0, 0, 0.35),
    0 0 0 3px rgba(60, 130, 210, 0.3),
    0 2px 8px rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);

  transition: box-shadow 0.15s, filter 0.15s;
}

.aero-start-orb img {
  width: 40px;
  height: 40px;
  filter: drop-shadow(0 0 3px rgba(255, 255, 255, 0.4));
}

.aero-start-orb:hover {
  box-shadow:
    0 0 0 1.5px rgba(0, 0, 0, 0.35),
    0 0 8px 4px rgba(80, 160, 240, 0.45),
    0 2px 12px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.35);
  background:
    radial-gradient(ellipse at 50% 30%,
      rgba(180, 220, 255, 0.6) 0%,
      transparent 60%
    ),
    radial-gradient(ellipse at center,
      rgba(65, 140, 220, 0.95) 0%,
      rgba(40, 100, 180, 0.95) 50%,
      rgba(25, 70, 135, 0.95) 100%
    );
}

.aero-start-orb.active {
  filter: brightness(0.8);
  box-shadow:
    0 0 0 1.5px rgba(0, 0, 0, 0.4),
    0 0 4px 2px rgba(40, 100, 180, 0.4),
    inset 0 2px 4px rgba(0, 0, 0, 0.25);
}

/* ── Taskbar window buttons ───────────────────────────────────────────── */

#taskbar-window-area {
  flex: 1;
  display: flex;
  align-items: stretch;
  gap: 2px;
  padding: 3px 4px;
  overflow: hidden;
}

.taskbar-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.9);
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
  max-width: 200px;
  overflow: hidden;
  white-space: nowrap;
  transition: background 0.1s, border-color 0.1s, box-shadow 0.1s;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

.taskbar-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.2);
}

.taskbar-btn.active {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.25);
  box-shadow:
    inset 0 0 8px rgba(120, 185, 255, 0.25),
    0 0 4px rgba(80, 150, 230, 0.2);
}

.taskbar-btn img {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.taskbar-btn span {
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Taskbar tray (clock area) ────────────────────────────────────────── */

#taskbar-tray {
  display: flex;
  align-items: center;
  padding: 0 12px;
  flex-shrink: 0;
  border-left: 1px solid rgba(255, 255, 255, 0.08);
}

#taskbar-clock {
  color: rgba(255, 255, 255, 0.9);
  font-size: 12px;
  white-space: nowrap;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

/* ═══════════════════════════════════════════════════════════════════════════
   START MENU — Glass panel, single column
   ═══════════════════════════════════════════════════════════════════════════ */

#start-menu {
  display: none;
  position: fixed;
  bottom: 40px;
  left: 0;
  width: 280px;
  max-height: calc(100vh - 60px);
  z-index: 100;
  overflow: hidden;
  flex-direction: column;

  /* Glass */
  background: rgba(0, 0, 0, 0.43);
  backdrop-filter: blur(30px) saturate(180%);
  -webkit-backdrop-filter: blur(30px) saturate(180%);
  border: 1px solid rgba(180, 210, 255, 0.3);
  border-bottom: none;
  border-radius: 8px 8px 0 0;
  box-shadow:
    0 -4px 30px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

#start-menu.open {
  display: flex;
}

.start-menu-user {
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.start-menu-user img {
  width: 48px;
  height: 48px;
  border-radius: 4px;
  object-fit: cover;
  border: 2px solid rgba(255, 255, 255, 0.25);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

#start-menu-items {
  flex: 1;
  overflow-y: auto;
  padding: 4px 0;
}

.start-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: calc(100% - 8px);
  padding: 6px 12px;
  border: none;
  background: none;
  box-shadow: none;
  outline: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.92);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  border-radius: 3px;
  margin: 1px 4px;
  transition: background 0.08s, border-color 0.08s;
}

.start-menu-item span {
  flex: 1;
  text-align: right;
}

.start-menu-item:hover {
  background: rgba(255, 255, 255, 0.10);
  border: 1px solid rgba(255, 255, 255, 0.18);
}

.start-menu-item img {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

.start-menu-divider {
  height: 1px;
  margin: 4px 10px;
  background: rgba(255, 255, 255, 0.1);
}

/* ── Responsive: Tablet (max-width: 768px) ────────────────────────────── */

@media (max-width: 768px) {
  #icon-grid {
    grid-template-columns: repeat(auto-fill, 72px);
    grid-auto-rows: 78px;
    gap: 2px;
    padding: 8px;
  }

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

  .icon-image-wrap {
    width: 40px;
    height: 40px;
  }

  .desktop-icon-label {
    font-size: 10px;
  }

  #taskbar {
    height: 44px;
  }

  .aero-start-orb {
    width: 38px;
    height: 38px;
  }

  .taskbar-btn {
    padding: 0 8px;
  }

  .start-menu-item {
    padding: 10px 14px;
  }

  #start-menu {
    width: 80vw;
    max-width: 280px;
    bottom: 44px;
  }

  .context-menu-item {
    padding: 8px 24px 8px 12px;
  }

  .window-resize-grip {
    width: 24px;
    height: 24px;
  }

  .folder-view {
    grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  }

  .folder-item img {
    width: 40px;
    height: 40px;
  }

  ::-webkit-scrollbar {
    width: 12px;
  }
}

/* ── Responsive: Phone (max-width: 480px) ─────────────────────────────── */

@media (max-width: 480px) {
  #icon-grid {
    grid-template-columns: repeat(auto-fill, 64px);
    grid-auto-rows: 72px;
    gap: 2px;
  }

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

  .icon-image-wrap {
    width: 36px;
    height: 36px;
  }

  .desktop-icon-label {
    font-size: 10px;
  }

  #start-menu {
    width: 100vw;
    max-width: none;
    border-radius: 0;
  }

  .taskbar-btn span {
    display: none;
  }

  .taskbar-btn {
    max-width: 44px;
    padding: 0 6px;
    justify-content: center;
  }

  .aero-start-orb {
    width: 34px;
    height: 34px;
  }
}
