/* --- Global Styles & Variables --- */
:root {
  --panel: #e9e4d5;
  --wallpaper: url("../assets/wallpapers/wallpaper1.webp");
  --file-icon-size: 60px;
  --file-icon-size-sm: 40px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
  padding: 0;
  position: relative;
  font-family: "Pixelify Sans", "Poppins", -apple-system, BlinkMacSystemFont,
    "Segoe UI", Roboto, sans-serif;
  color: #000;
  background: #000 var(--wallpaper) center/cover no-repeat fixed;
  overflow: hidden;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

input,
textarea,
button,
select {
  font-family: "VT323", "monospace", -apple-system, BlinkMacSystemFont,
    "Segoe UI", Roboto, sans-serif;
  font-optical-sizing: auto;
}

/* --- Boot Sequence --- */
#boot-screen {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  color: #fff;
  user-select: none;
  transition: opacity 0.42s ease, transform 0.42s ease, visibility 0s 0.42s;
}
#boot-screen.boot-hide {
  opacity: 0;
  transform: scale(0.995);
  visibility: hidden;
  pointer-events: none;
}
.boot-center {
  text-align: center;
  width: 90%;
  max-width: 420px;
  padding: 20px;
}
.boot-apple {
  width: 70px;
  margin-bottom: 5px;
}
.boot-progress-wrap {
  width: 70%;
  height: 8px;
  margin: 12px auto 8px;
  border: 2px solid rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.04);
  box-shadow: inset 0 -2px 0 rgba(255, 255, 255, 0.02);
  overflow: hidden;
}
.boot-progress {
  height: 100%;
  width: 0%;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.98),
    rgba(220, 220, 220, 0.95)
  );
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.3);
  transition: width 160ms linear;
}
.boot-percent {
  margin-top: 6px;
  font-family: "Pixelify Sans", "Poppins", sans-serif;
  font-weight: 700;
  letter-spacing: 0.8px;
}
.boot-caption {
  margin-top: 8px;
  font-size: 12px;
  opacity: 0.85;
}
.boot-enter {
  display: inline-block;
  margin-top: 18px;
  padding: 10px 18px;
  border: 3px solid #000;
  border-radius: 6px;
  background: var(--panel);
  box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.9);
  font-family: "Pixelify Sans", "Poppins", sans-serif;
  font-weight: 800;
  letter-spacing: 1px;
  cursor: pointer;
  transition: transform 120ms ease;
}
.boot-enter:active {
  transform: translate(2px, 2px);
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.9);
}

/* --- General UI --- */
.grain {
  position: fixed;
  inset: 0;
  background-image: repeating-linear-gradient(
    rgba(0, 0, 0, 0.02) 0 1px,
    transparent 1px 4px
  );
  mix-blend-mode: multiply;
  pointer-events: none;
}
.desktop-icon img,
.finder-icon img,
#trash .finder-icon img,
.favourite-item img,
.dock-icon img {
  width: var(--file-icon-size);
  height: var(--file-icon-size);
  object-fit: contain;
  pointer-events: none;
}
.desktop-icon {
  position: absolute;
  width: 105px;
  padding: 8px;
  border-radius: 6px;
  text-align: center;
  user-select: none;
  cursor: grab;
  transition: background-color 0.2s;
}
.desktop-icon.dragging {
  cursor: grabbing;
  z-index: 2000;
}
.desktop-icon span {
  display: block;
  font-size: 15px;
  color: white;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
  word-break: break-word;
  line-height: 1.2;
  padding: 2px 0;
  pointer-events: none;
}
button {
  font-family: inherit;
  padding: 6px 8px;
  border: 1px solid #000;
  background: #eaeaea;
  cursor: pointer;
}

/* --- Top Bar & Menus --- */
.top-bar {
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 8px 14px;
  background: rgba(255, 255, 255, 0.4);
}
.top-bar .left {
  display: flex;
  gap: 12px;
  align-items: center;
}
.top-bar .icon {
  padding: 4px 8px;
  border-radius: 3px;
  font-weight: 600;
  user-select: none;
  cursor: pointer;
}
.top-bar .icon.active {
  background: #000;
  color: #fff;
}
.logo {
  width: 24px;
  margin-top: 5px;
}
.top-bar .right-icons {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-left: auto;
}
.status-icon {
  display: flex;
  align-items: center;
  height: 25px;
}
.status-icon img {
  height: 100%;
  width: auto;
}
.battery {
  position: relative;
  width: 28px;
  height: 18px;
  padding: 2px;
  border: 2px solid #000;
  border-radius: 2px;
  background-color: rgba(255, 255, 255, 0.5);
}
.battery::after {
  content: "";
  position: absolute;
  right: -5px;
  top: 3px;
  width: 3px;
  height: 8px;
  border-radius: 0 2px 2px 0;
  background-color: #000;
}
.battery-level {
  width: 80%;
  height: 100%;
  background-color: #32cd32;
  transition: width 0.5s ease;
}
.top-bar .clock {
  padding: 5px 12px;
  border-radius: 10px;
  font-family: "VT323", monospace, sans-serif;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 0.5px;
  opacity: 0.85;
  cursor: pointer;
  transition: background-color 0.2s;
}
.top-bar .clock:hover {
  background: rgba(255, 255, 255, 0.6);
}
.menu {
  display: none;
  position: absolute;
  top: 46px;
  z-index: 10000;
  min-width: 160px;
  padding: 6px;
  border: 2px solid #000;
  background: rgba(255, 255, 255, 0.8);
}
.menu div {
  padding: 6px 8px;
  cursor: pointer;
}
.menu div:hover {
  background: #000;
  color: #fff;
}

/* --- Windows --- */
.window {
  position: absolute;
  display: none;
  overflow: hidden;
  width: 360px;
  min-width: 250px;
  min-height: 150px;
  border: 3px solid #000;
  background: var(--panel);
  box-shadow: 8px 8px 0 rgba(0, 0, 0, 0.5);
}
.window .title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 8px;
  background: #333333;
  color: #fff;
  cursor: move;
}
.window .content {
  height: calc(100% - 45px);
  background: #fff;
  padding: 10px;
  overflow: auto;
}
.title .controls {
  display: flex;
  gap: 6px;
}
.ctrl {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border: 2px solid #000;
  border-radius: 50%;
  font-family: "VT323", monospace, sans-serif;
  font-size: 16px;
  font-weight: bold;
  line-height: 1;
  user-select: none;
  cursor: pointer;
}
.ctrl-close {
  background-color: #ff5f57;
  color: #000;
}
.ctrl-min {
  background-color: #32cd32;
  color: #000;
}

/* --- Dock --- */
.dock {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5000;
  display: flex;
  gap: 5px;
  align-items: flex-end;
  padding: 10px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.4);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}
.dock-icon {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 84px;
  height: 84px;
  cursor: pointer;
  transition: transform 140ms ease-out;
}
.dock-icon::before {
  content: "";
  position: absolute;
  z-index: 1;
  width: 72px;
  height: 72px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.6);
  transition: all 180ms cubic-bezier(0.2, 0.8, 0.2, 1.2);
}
.dock-icon img,
.dock-icon svg {
  position: relative;
  z-index: 2;
  transform-origin: center bottom;
  pointer-events: none;
  transition: all 180ms cubic-bezier(0.2, 0.8, 0.2, 1.2);
}
.dock-icon .label {
  position: absolute;
  bottom: 100%;
  z-index: 3;
  margin-bottom: 12px;
  padding: 4px 8px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.8);
  color: white;
  font-size: 11px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: all 140ms;
}
.dock-icon:hover {
  transform: translateY(-12px);
}
.dock-icon:hover::before {
  background: #000;
  transform: scale(1.1);
  box-shadow: 0 12px 0 rgba(0, 0, 0, 0.5);
}
.dock-icon:hover img,
.dock-icon:hover svg {
  transform: scale(1.4) translateY(-1px);
}
.dock-icon:hover .label {
  opacity: 1;
  transform: translateY(0);
  margin-bottom: 16px;
}
.dock-icon.active::before {
  background: #000;
  transform: scale(1.05);
}
.dock-icon.active img,
.dock-icon.active svg {
  transform: scale(1.05);
}

/* --- Default Window Positions --- */
#finder {
  left: 100px;
  top: 80px;
  width: 600px;
  height: 400px;
}
#music {
  left: 250px;
  top: 150px;
  width: 400px;
  height: 440px;
}
#calculator {
  left: 60px;
  top: 180px;
}
#terminal {
  left: 10px;
  top: 150px;
  width: 600px;
  height: 450px;
}
#mail {
  left: 150px;
  top: 120px;
  width: 550px;
  height: 450px;
}
#coffee {
  left: 200px;
  top: 200px;
  width: 380px;
}
#settings {
  left: 300px;
  top: 320px;
}
#trash {
  left: 240px;
  top: 140px;
  width: 400px;
  height: 300px;
}
#internet {
  left: 150px;
  top: 150px;
  width: 480px;
}
#projects {
  left: 100px;
  top: 100px;
  width: 700px;
  height: 450px;
}
#readme.window {
  width: 450px;
  left: 150px;
  top: 100px;
}
#clockApp {
  width: 320px;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}
#welcome-window {
  width: 500px;
  left: 30%;
  top: 30%;
  transform: translate(-50%, -50%);
}
