@import url('style.css');

:root {
  --os-bg: #000;
  --window-bg: rgba(255,255,255,0.85);
  --window-border: rgba(0,0,0,0.1);
  --titlebar-bg: rgba(255,255,255,0.4);
  --dock-bg: rgba(255,255,255,0.3);
  --dock-border: rgba(255,255,255,0.4);
}
.dark {
  --window-bg: rgba(10,15,25,0.85);
  --window-border: rgba(255,255,255,0.15);
  --titlebar-bg: rgba(255,255,255,0.05);
  --dock-bg: rgba(0,0,0,0.5);
  --dock-border: rgba(255,255,255,0.15);
}

body.os-mode {
  margin: 0;
  padding: 0;
  overflow: hidden;
  height: 100vh;
  width: 100vw;
  user-select: none;
  font-family: "Inter", sans-serif;
  color: var(--text);
  background: var(--os-bg);
}

/* Background Canvas */
#os-bg-canvas {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: -1;
}

/* Apple Menu Bar */
.top-menubar {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 28px;
  background: rgba(30, 30, 30, 0.4);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 16px;
  z-index: 1000;
  font-size: 13px;
  font-weight: 500;
  color: #fff;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  box-shadow: 0 1px 5px rgba(0,0,0,0.2);
}
.menubar-left, .menubar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}
.menubar-item {
  cursor: pointer;
  padding: 0 6px;
  border-radius: 4px;
  position: relative;
}
.menubar-item.bold { font-weight: 700; }
.menubar-item:hover { background: rgba(255,255,255,0.15); }
.apple-logo { font-size: 15px; margin-right: 4px; display: flex; align-items: center; }
.apple-logo svg { width: 14px; height: 14px; fill: white; }
.menubar-icon { width: 14px; height: 14px; opacity: 0.9; }

/* Menubar Dropdowns */
.mac-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 4px;
  background: rgba(40, 40, 40, 0.6);
  backdrop-filter: blur(40px);
  -webkit-backdrop-filter: blur(40px);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 6px;
  min-width: 220px;
  padding: 5px 0;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  display: none;
  flex-direction: column;
  z-index: 1001;
}
.mac-dropdown.show { display: flex; }
.mac-dropdown-item {
  padding: 4px 12px;
  color: #fff;
  font-size: 13px;
  font-weight: 400;
  cursor: default;
  display: flex;
  justify-content: space-between;
}
.mac-dropdown-item span.shortcut {
  opacity: 0.5;
  font-size: 12px;
}
.mac-dropdown-item:hover {
  background: #007aff;
  color: #fff;
}
.mac-dropdown-divider {
  height: 1px;
  background: rgba(255,255,255,0.1);
  margin: 4px 0;
}

/* Desktop Icons */
.desktop-area {
  position: absolute;
  top: 38px; left: 0; right: 0; bottom: 80px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  align-items: flex-start;
  z-index: 10;
}

.desktop-icon {
  width: 80px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  border-radius: 8px;
  padding: 10px;
  transition: background 0.2s;
}
.desktop-icon:hover { background: rgba(255,255,255,0.1); }
.desktop-icon.selected { background: rgba(255,255,255,0.2); }

.desktop-icon .icon-img {
  width: 52px; height: 52px;
  background: linear-gradient(135deg, rgba(var(--accent),0.9), rgba(var(--accent-alt),0.9));
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  box-shadow: 0 4px 14px rgba(0,0,0,0.3);
}
.desktop-icon span {
  font-size: 13px;
  font-weight: 600;
  text-shadow: 0 1px 3px rgba(0,0,0,0.8);
  color: #fff;
  text-align: center;
}

/* Window */
.os-window {
  position: absolute;
  top: 50px; left: 50px;
  width: 700px; height: 450px;
  min-width: 320px; min-height: 250px;
  background: var(--window-bg);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  border: 1px solid var(--window-border);
  border-radius: 14px;
  box-shadow: 0 25px 60px rgba(0,0,0,0.4), 0 0 0 1px rgba(255,255,255,0.05) inset;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 20;
  display: none;
  opacity: 0;
  transform: scale(0.95);
  transition: opacity 0.2s, transform 0.2s;
}
.os-window.open { display: flex; }
.os-window.show { opacity: 1; transform: scale(1); }
.os-window.maximized {
  top: 0 !important; left: 0 !important;
  width: 100vw !important; height: calc(100vh - 70px) !important;
  border-radius: 0;
  transform: scale(1) !important;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.os-window.minimized {
  opacity: 0;
  transform: translateY(100px) scale(0.5);
  pointer-events: none;
}

/* Title bar */
.title-bar {
  height: 48px;
  background: var(--titlebar-bg);
  border-bottom: 1px solid var(--window-border);
  display: flex;
  align-items: center;
  padding: 0 16px;
  cursor: grab;
  flex-shrink: 0;
  position: relative;
}
.title-bar:active { cursor: grabbing; }

.window-controls {
  display: flex; gap: 8px;
  position: absolute; left: 14px;
}
.win-btn {
  width: 12px; height: 12px;
  border-radius: 50%;
  border: 1px solid rgba(0,0,0,0.1);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  padding: 0;
  box-sizing: border-box;
}
.win-btn i { width: 8px; height: 8px; opacity: 0; transition: opacity 0.2s; color: rgba(0,0,0,0.7); }
.os-window:hover .window-controls .win-btn i { opacity: 1; }

.btn-close { background: #ff5f56; }
.btn-close:hover { background: #ff3b30; }
.btn-min { background: #ffbd2e; }
.btn-min:hover { background: #d99c1b; }
.btn-max { background: #27c93f; }
.btn-max:hover { background: #1faa32; }

.window-title {
  flex: 1;
  text-align: center;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  pointer-events: none;
}

/* Window Content Area */
.window-content {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  user-select: text;
}
.window-content::-webkit-scrollbar { width: 8px; }
.window-content::-webkit-scrollbar-track { background: transparent; }
.window-content::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* Mac-style Dock */
.dock-container {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  height: 68px;
  background: rgba(255,255,255,0.15);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 24px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 100;
  box-shadow: 0 10px 40px rgba(0,0,0,0.4), inset 0 1px 1px rgba(255,255,255,0.3);
}

.dock-item {
  width: 52px; height: 52px;
  background: linear-gradient(135deg, rgba(var(--accent),0.9), rgba(var(--accent-alt),0.9));
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), margin 0.2s;
  position: relative;
  box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}
.dock-item:hover {
  transform: scale(1.4) translateY(-14px);
  margin: 0 14px;
  z-index: 101;
}
.dock-item::after {
  content: "";
  position: absolute;
  bottom: -10px;
  width: 4px; height: 4px;
  background: rgba(255,255,255,0.8);
  border-radius: 50%;
  opacity: 0;
  transition: opacity 0.2s;
}
.dock-item.active::after {
  opacity: 1;
}
.dock-tooltip {
  position: absolute;
  top: -36px;
  background: var(--bg-2);
  color: var(--text);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  pointer-events: none;
  opacity: 0;
  transform: translateY(5px);
  transition: all 0.2s;
  box-shadow: var(--shadow-1);
  white-space: nowrap;
}
.dock-item:hover .dock-tooltip {
  opacity: 1;
  transform: translateY(0);
}
