/* ===== Reset ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Poppins", sans-serif;
  background: url("assets/bg.jpg") no-repeat center center/cover;
  height: 100vh;
  overflow: hidden;
  color: #fff;
  -webkit-font-smoothing: antialiased;
}

/* ===== Topbar ===== */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 26px;
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(20px);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 12px;
  font-size: 13px;
  z-index: 1000;
  color: #fff;
  user-select: none;
}

.apple {
  margin: 2px 0 -14px -12px;
}

.top-left span,
.top-right span {
  margin-left: 12px;
  cursor: default;
  padding: 2px 6px;
  border-radius: 4px;
  transition: background 0.15s ease;
}

.top-left span:hover {
  background: rgba(255, 255, 255, 0.12);
}

.menu-item.active {
  background: rgba(255, 255, 255, 0.18);
}

/* ===== Volume Control ===== */
.volume-control {
  position: relative;
  display: inline-block;
}

.volume-control img {
  cursor: pointer;
  transition: transform 0.2s ease;
}

.volume-control img:hover {
  transform: scale(1.1);
}

.volume-buttons {
  display: none;
  position: absolute;
  top: 32px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(22, 27, 34, 0.95);
  backdrop-filter: blur(12px);
  padding: 6px 12px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: #fff;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
  z-index: 200;
  animation: dropdownFade 0.15s ease;
}

.volume-buttons button {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  transition: transform 0.1s ease, background 0.1s ease;
}

.volume-buttons button img {
  width: 18px;
  height: 18px;
}

.volume-buttons button:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: scale(1.15);
}

/* ===== Icons in Topbar ===== */
.topbar img {
  width: 14px;
  height: 14px;
  margin: 0 6px;
  filter: brightness(0) invert(1);
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.topbar img:hover {
  opacity: 0.7;
}

/* ===== Dropdown Menus ===== */
.dropdown {
  position: absolute;
  top: 26px;
  background: rgba(30, 30, 30, 0.92);
  backdrop-filter: blur(20px);
  border-radius: 8px;
  overflow: hidden;
  display: none;
  flex-direction: column;
  min-width: 170px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
  font-size: 13px;
  z-index: 2000;
  animation: dropdownFade 0.15s ease;
}

@keyframes dropdownFade {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.dropdown-item {
  padding: 6px 14px;
  color: #fff;
  cursor: default;
  white-space: nowrap;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background 0.15s ease;
}

.dropdown-item:hover {
  background: rgba(255, 255, 255, 0.15);
}

.dropdown-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.2);
  margin: 4px 0;
}

.shortcut {
  opacity: 0.6;
  font-size: 12px;
  margin-left: 20px;
}

/* ===== Desktop Icons ===== */
.desktop {
  padding: 60px 20px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.icon {
  text-align: center;
  width: 80px;
  cursor: pointer;
  user-select: none;
  transition: transform 0.2s ease;
}

.icon:hover {
  transform: scale(1.12);
}

.icon img {
  width: 64px;
  height: 64px;
  border-radius: 14px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(12px);
}

.icon p {
  margin-top: 6px;
  font-size: 13px;
  font-weight: 500;
  color: #f1f1f1;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9);
}

/* ===== Dock ===== */
.dock {
  position: fixed;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(25px);
  border-radius: 26px;
  padding: 12px 18px;
  display: flex;
  gap: 16px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
  z-index: 999;
  transition: all 0.3s ease;
}

.dock img {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  transition: transform 0.25s ease, filter 0.25s ease;
  cursor: pointer;
}

.dock img:hover {
  transform: scale(1.3) translateY(-10px);
  filter: brightness(1.1);
}

/* Active app indicator */
.dock img.active::after {
  content: "";
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  width: 6px;
  height: 6px;
  background: white;
  border-radius: 50%;
  box-shadow: 0 0 6px rgba(255, 255, 255, 0.8);
}

/* ===== Recycle Bin ===== */
.recycle-bin {
  position: relative;
  width: 40px;
  height: 40px;
  cursor: pointer;
}

.recycle-bin img {
  width: 100%;
  height: 100%;
  display: block;
}

.bin-lid {
  position: absolute;
  top: -5px;
  right: 0;
  width: 12px;
  height: 5px;
  background: #fff;
  border-top-left-radius: 50%;
  border-top-right-radius: 50%;
}

/* ===== Windows ===== */
.window {
  position: absolute;
  top: 80px;
  left: 80px;
  width: 600px;
  height: 400px;
  color: #111;
  background: rgba(255, 255, 255, 0.98);
  border-radius: 14px;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.45);
  display: none;
  flex-direction: column;
  overflow: hidden;
  animation: fadeIn 0.2s ease;
  transition: all 0.25s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Titlebar */
.titlebar {
  height: 28px;
  background: linear-gradient(to bottom, #f4f4f4, #e0e0e0);
  display: flex;
  align-items: center;
  padding: 0 10px;
  font-size: 13px;
  font-weight: 500;
  cursor: grab;
  border-bottom: 1px solid #d1d1d1;
}

.titlebar .buttons {
  display: flex;
  gap: 6px;
  margin-right: 10px;
}

.titlebar .btn {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.1);
  cursor: pointer;
  transition: transform 0.2s ease;
}

.titlebar .btn:hover {
  transform: scale(1.15);
}

.btn.close {
  background: #ff5f57;
}

.btn.min {
  background: #febc2e;
}

.btn.max {
  background: #28c840;
}

.content {
  flex: 1;
  padding: 16px;
  overflow: auto;
}

.content iframe {
  width: 100%;
  height: 100%;
  border: none;
}

.terminal {
  font-family: monospace;
  background: #111;
  color: #0f0;
  padding: 12px;
  border-radius: 0 0 14px 14px;
}

/* ===== Window States ===== */
.window.minimized {
  transform: scale(0.2) translateY(200%);
  opacity: 0;
  pointer-events: none;
}

.window.maximized {
  top: 0 !important;
  left: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  border-radius: 0 !important;
}

.item.selected {
  outline: 2px solid #007aff;
  /* macOS blue highlight */
  border-radius: 6px;
}

/* ================= Responsive ================= */

/* Tablets (<= 1024px) */
@media (max-width: 1024px) {
  .desktop {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px;
    padding: 80px 10px;
  }

  .icon {
    width: 70px;
  }

  .icon img {
    width: 56px;
    height: 56px;
  }

  .dock {
    padding: 8px 14px;
    gap: 12px;
  }

  .dock img {
    width: 44px;
    height: 44px;
  }

  .window {
    width: 80vw;
    height: 60vh;
    left: 50%;
    top: 70px;
    transform: translateX(-50%);
  }
}

/* Mobile (<= 768px) */
@media (max-width: 768px) {
  body {
    overflow: auto;
  }

  .topbar {
    font-size: 11px;
    padding: 0 6px;
  }

  .desktop {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: 14px;
    padding: 60px 6px;
  }

  .icon {
    width: 60px;
  }

  .icon img {
    width: 48px;
    height: 48px;
  }

  .icon p {
    font-size: 11px;
  }

  .dock {
    padding: 6px 10px;
    gap: 10px;
    border-radius: 18px;
    overflow-x: auto;
    max-width: 90%;
  }

  .dock img {
    width: 40px;
    height: 40px;
  }

  .window {
    width: 95vw;
    height: 75vh;
    left: 50%;
    top: 60px;
    transform: translateX(-50%);
  }

  .titlebar {
    height: 24px;
    font-size: 11px;
    padding: 0 6px;
  }

  .content {
    padding: 10px;
  }
}

/* Small phones (<= 480px) */
@media (max-width: 480px) {
  .icon {
    width: 50px;
  }

  .icon img {
    width: 40px;
    height: 40px;
  }

  .icon p {
    font-size: 10px;
  }

  .dock {
    padding: 4px 8px;
    gap: 8px;
  }

  .dock img {
    width: 36px;
    height: 36px;
  }

  .window {
    width: 100vw;
    height: 80vh;
    top: 50px;
    border-radius: 0;
  }

  .titlebar {
    font-size: 10px;
  }
}