* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
}

html, body {
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* Loading Screen */
#loading-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: #cbbae2;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  transition: opacity 0.6s ease-out, visibility 0.6s;
}

#loading-screen.fade-out {
  opacity: 0;
  visibility: hidden;
}

.loading-title {
  font-family: "Georgia", "Times New Roman", serif;
  font-size: 3rem;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: 0.5px;
}

/* Desktop Shell */
#desktop {
  position: relative;
  width: 100vw;
  height: 100vh;
  background: url('wallpaper.jpg') no-repeat center center fixed;
  background-size: cover;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Top Bar */
.top-bar {
  height: 30px;
  width: 100%;
  background: rgba(205, 198, 212, 0.75);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  z-index: 1000;
}

.top-bar-center {
  font-family: "Georgia", "Times New Roman", serif;
  font-size: 1.1rem;
  font-weight: bold;
  color: #ffffff;
  letter-spacing: 0.5px;
}

.top-bar-right {
  justify-self: end;
  font-size: 0.85rem;
  color: #333333;
  font-weight: 500;
}

/* Desktop Workspace Canvas */
.desktop-canvas {
  width: 100%;
  height: calc(100vh - 30px); /* Fill remaining space below 30px top-bar */
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  overflow: hidden;
}
/* Window Shell */
.window {
  position: absolute;
  /* Reset positional offsets completely for centered default state */
  top: auto;
  left: auto;
  transform: none; 
  width: 420px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 10px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(255, 255, 255, 0.4) inset;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.window-header {
  height: 32px;
  background: rgba(230, 225, 235, 0.6);
  display: flex;
  align-items: center;
  padding: 0 10px;
  position: relative;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.window-controls {
  display: flex;
  gap: 8px;
  z-index: 2;
}

.control {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
}

.control.close { background-color: #ff5f56; }
.control.minimize { background-color: #ffbd2e; }
.control.maximize { background-color: #27c93f; }

.window-title {
  position: absolute;
  width: 100%;
  left: 0;
  text-align: center;
  font-size: 0.85rem;
  font-weight: 600;
  color: #4a4a4a;
  pointer-events: none;
}

.window-body {
  padding: 24px;
  color: #2c2c2e;
}

.window-body h1 {
  font-size: 1.4rem;
  margin-bottom: 12px;
  font-weight: 600;
}

.window-body p {
  font-size: 0.95rem;
  line-height: 1.4;
  color: #555555;
  margin-bottom: 8px;
}

/* Dock */
.dock {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  height: 64px;
  background: rgba(180, 170, 190, 0.45);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 18px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
  z-index: 1000;
}

.dock-item {
  width: 48px;
  height: 48px;
  background: rgba(110, 110, 115, 0.65);
  border-radius: 11px;
  transition: transform 0.2s ease, background 0.2s ease;
  cursor: pointer;
}

.dock-item:hover {
  transform: translateY(-4px) scale(1.05);
  background: rgba(90, 90, 95, 0.8);
}
.window-header {
  cursor: grab;
  touch-action: none; /* Prevents default browser panning/scrolling */
}

.window-header:active {
  cursor: grabbing;
}

/*maximised state constraints*/
.window.maximized {
  top: 0 !important; 
  left: 0 !important;
  width: 100% !important; 
  height: 100% !important; 
  border-radius: 0;
  transform: none !important;
}

/* Minimized State */
.window.minimized {
  display: none; /* Phase 2 simplified minimize state */
}

.dock-item {
  /* Existing parameters... */
  overflow: hidden; 
  display: flex;
  justify-content: center;
  align-items: center;
}

.app-icon {
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none; /* Prevents ghost-dragging of the image */
}

/* App Sandbox Styling */
.window-iframe {
  width: 100%;
  height: 100%;
  border: none;
  background: transparent;
  display: block;
}

.window-body.sandboxed {
  padding: 0;
  height: calc(100% - 32px); /* Subtract header height */
  overflow: hidden;
}