/* ============================================================
   macOS Web — stylesheet
   ============================================================ */

:root {
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --menubar-h: 26px;
  --accent: #007aff;
  --accent-rgb: 0, 122, 255;
  --win-radius: 11px;
  --traffic-red: #ff5f57;
  --traffic-yellow: #febc2e;
  --traffic-green: #28c840;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-font-smoothing: antialiased; }

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  font-family: var(--font);
  background: #000;
  user-select: none;
  -webkit-user-select: none;
  cursor: default;
}

.fullscreen { position: fixed; inset: 0; z-index: 9000; }
.hidden { display: none !important; }

/* ============================================================
   BOOT SCREEN
   ============================================================ */
#boot-screen {
  background: #000;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  color: #fff;
}
.boot-logo { color: #fff; margin-bottom: 60px; }
.boot-progress {
  width: 220px; height: 6px;
  background: rgba(255,255,255,0.18);
  border-radius: 3px; overflow: hidden;
}
.boot-progress-fill {
  width: 0%; height: 100%;
  background: #fff; border-radius: 3px;
  transition: width 0.2s linear;
}

/* ============================================================
   LOGIN SCREEN
   ============================================================ */
#login-screen {
  background-size: cover; background-position: center;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  color: #fff; z-index: 8000;
  animation: fadeIn 0.6s ease;
}
.login-blur { position: absolute; inset: 0; backdrop-filter: blur(0px); }
.login-clock {
  position: absolute; top: 7vh; left: 0; right: 0;
  text-align: center; text-shadow: 0 1px 12px rgba(0,0,0,0.4);
}
.login-day { font-size: 21px; font-weight: 500; opacity: 0.95; }
.login-time { font-size: 84px; font-weight: 600; letter-spacing: -1px; line-height: 1.05; }
.login-user {
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  z-index: 2;
}
.login-avatar svg { filter: drop-shadow(0 4px 14px rgba(0,0,0,0.35)); }
.login-name { font-size: 17px; font-weight: 500; text-shadow: 0 1px 6px rgba(0,0,0,0.4); }
.login-form { position: relative; display: flex; align-items: center; justify-content: center; }
.login-pass {
  width: 200px; height: 30px;
  border-radius: 15px; border: none;
  background: rgba(255,255,255,0.22);
  backdrop-filter: blur(12px);
  color: #fff; padding: 0 30px; font-size: 13px;
  font-family: var(--font); text-align: center;
  outline: none; transition: background 0.2s;
}
.login-pass::placeholder { color: rgba(255,255,255,0.7); }
.login-pass:focus { background: rgba(255,255,255,0.3); }
.login-arrow {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  width: 23px; height: 23px; border-radius: 50%;
  border: none; background: rgba(255,255,255,0.92); color: #3a3a3c;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: background 0.15s, transform 0.1s;
  box-shadow: 0 1px 4px rgba(0,0,0,0.28);
}
.login-arrow:hover { background: #fff; }
.login-arrow:active { transform: translateY(-50%) scale(0.92); }
.login-hint { font-size: 12px; opacity: 0.7; margin-top: 4px; text-shadow: 0 1px 4px rgba(0,0,0,0.4); }
.login-bottombar {
  position: absolute; bottom: 6vh; left: 0; right: 0;
  display: flex; justify-content: center; gap: 16px;
}
.login-bottom-item {
  width: 96px;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  cursor: pointer; opacity: 0.92; transition: transform 0.15s;
}
.login-bottom-item span { font-size: 12px; }
.login-bottom-item:hover { transform: scale(1.06); }
.login-bottom-item svg {
  width: 38px; height: 38px; padding: 10px;
  border-radius: 50%; background: rgba(255,255,255,0.18);
  backdrop-filter: blur(10px);
}

/* ============================================================
   DESKTOP & WALLPAPER
   ============================================================ */
#desktop { position: fixed; inset: 0; z-index: 1; }
#wallpaper {
  position: absolute; inset: 0;
  background-size: cover; background-position: center;
  transition: opacity 0.6s ease;
  z-index: 0;
}

/* ============================================================
   MENU BAR
   ============================================================ */
#menubar {
  position: absolute; top: 0; left: 0; right: 0;
  height: var(--menubar-h);
  background: rgba(255,255,255,0.32);
  backdrop-filter: blur(24px) saturate(1.6);
  -webkit-backdrop-filter: blur(24px) saturate(1.6);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 9px; z-index: 5000;
  font-size: 13px; color: #1d1d1f;
  box-shadow: inset 0 -0.5px 0 rgba(0,0,0,0.1);
}
body.dark #menubar, #menubar.on-dark { color: #fff; background: rgba(30,30,30,0.42); }
.menubar-left, .menubar-right { display: flex; align-items: center; height: 100%; }
.menu-item {
  padding: 0 9px; height: 19px; line-height: 19px;
  border-radius: 5px; cursor: default; white-space: nowrap;
  display: flex; align-items: center;
}
.menu-item:hover, .menu-item.active { background: rgba(var(--accent-rgb), 0.85); color: #fff; }
.menu-appname { font-weight: 600; }
.menu-apple { padding: 0 9px; }
.menu-apple svg { display: block; }
.menu-status {
  padding: 0 7px; height: 20px; display: flex; align-items: center; gap: 4px;
  border-radius: 5px; cursor: default;
}
.menu-status:hover { background: rgba(0,0,0,0.08); }
body.dark .menu-status:hover, #menubar.on-dark .menu-status:hover { background: rgba(255,255,255,0.15); }
.menu-clock { font-variant-numeric: tabular-nums; font-weight: 400; }
.battery-pct { font-size: 12.5px; }

/* Dropdown menus (apple / app menus) */
#menu-dropdown {
  position: absolute; z-index: 6000;
  min-width: 220px; padding: 5px;
  background: rgba(246,246,246,0.78);
  backdrop-filter: blur(34px) saturate(1.6);
  -webkit-backdrop-filter: blur(34px) saturate(1.6);
  border: 0.5px solid rgba(0,0,0,0.12);
  border-radius: 8px;
  box-shadow: 0 14px 44px rgba(0,0,0,0.28);
  font-size: 13px; color: #1d1d1f;
  animation: dropIn 0.12s ease;
}
.dropdown-item {
  padding: 5px 12px; border-radius: 5px;
  display: flex; justify-content: space-between; align-items: center; gap: 24px;
  cursor: default; white-space: nowrap;
}
.dropdown-item:hover:not(.disabled) { background: var(--accent); color: #fff; }
.dropdown-item.disabled { opacity: 0.32; }
.dropdown-item .shortcut { opacity: 0.55; font-size: 12.5px; }
.dropdown-item:hover:not(.disabled) .shortcut { opacity: 0.85; color: #fff; }
.dropdown-sep { height: 0.5px; background: rgba(0,0,0,0.14); margin: 5px 10px; }

/* ============================================================
   DESKTOP ICONS
   ============================================================ */
#desktop-icons {
  position: absolute; top: 38px; right: 18px;
  display: flex; flex-direction: column; gap: 8px; z-index: 2;
}
.desktop-icon {
  width: 84px; padding: 6px 4px;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  border-radius: 7px; cursor: default; text-align: center;
}
.desktop-icon.selected { background: rgba(var(--accent-rgb), 0.32); }
.desktop-icon .di-img { width: 52px; height: 52px; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3)); }
.desktop-icon .di-label {
  font-size: 12px; color: #fff; line-height: 1.2;
  text-shadow: 0 1px 3px rgba(0,0,0,0.8);
  padding: 0 3px; border-radius: 3px;
  word-break: break-word;
}
.desktop-icon.selected .di-label { background: var(--accent); }

/* ============================================================
   WINDOWS
   ============================================================ */
#windows-layer { position: absolute; inset: 0; z-index: 10; pointer-events: none; }
.window {
  position: absolute; pointer-events: auto;
  display: flex; flex-direction: column;
  background: #fff;
  border-radius: var(--win-radius);
  box-shadow: 0 28px 70px rgba(0,0,0,0.42), 0 0 0 0.5px rgba(0,0,0,0.18);
  overflow: hidden;
  min-width: 260px; min-height: 170px;
  transition: opacity 0.18s, transform 0.18s;
}
.window.minimizing { transform: scale(0.2); opacity: 0; transform-origin: bottom center; }
.window.opening { animation: winOpen 0.18s ease; }
.window.closing { animation: winClose 0.14s ease forwards; }
.window.inactive { box-shadow: 0 18px 50px rgba(0,0,0,0.28), 0 0 0 0.5px rgba(0,0,0,0.12); }
body.dark .window { background: #1e1e1e; color: #eee; }

.titlebar {
  height: 38px; flex-shrink: 0;
  display: flex; align-items: center;
  padding: 0 14px; gap: 8px;
  background: rgba(246,246,246,0.85);
  backdrop-filter: blur(18px);
  border-bottom: 0.5px solid rgba(0,0,0,0.12);
  position: relative; cursor: default;
}
body.dark .titlebar { background: rgba(46,46,46,0.9); border-bottom-color: rgba(255,255,255,0.08); }
.traffic { display: flex; gap: 8px; align-items: center; }
.traffic button {
  width: 12px; height: 12px; border-radius: 50%; border: none;
  cursor: pointer; padding: 0; position: relative;
  display: flex; align-items: center; justify-content: center;
}
.traffic .tl-close { background: var(--traffic-red); }
.traffic .tl-min { background: var(--traffic-yellow); }
.traffic .tl-max { background: var(--traffic-green); }
.window.inactive .traffic button { background: #c8c8c8; }
.traffic button svg { opacity: 0; width: 7px; height: 7px; }
.titlebar:hover .traffic button svg { opacity: 0.65; }
.win-title {
  position: absolute; left: 0; right: 0; text-align: center;
  font-size: 13px; font-weight: 600; color: #3a3a3c;
  pointer-events: none; padding: 0 110px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
body.dark .win-title { color: #ddd; }
.window.inactive .win-title { color: #aaa; }
.titlebar-tools { margin-left: auto; display: flex; gap: 6px; z-index: 2; }

.window-body { flex: 1; overflow: auto; position: relative; background: #fff; }
body.dark .window-body { background: #1e1e1e; }

.resize-handle { position: absolute; z-index: 5; }
.rh-r { top: 6px; right: 0; bottom: 6px; width: 6px; cursor: ew-resize; }
.rh-b { left: 6px; right: 6px; bottom: 0; height: 6px; cursor: ns-resize; }
.rh-l { top: 6px; left: 0; bottom: 6px; width: 6px; cursor: ew-resize; }
.rh-t { left: 6px; right: 6px; top: 0; height: 6px; cursor: ns-resize; }
.rh-br { right: 0; bottom: 0; width: 14px; height: 14px; cursor: nwse-resize; }
.rh-bl { left: 0; bottom: 0; width: 14px; height: 14px; cursor: nesw-resize; }
.rh-tr { right: 0; top: 0; width: 14px; height: 14px; cursor: nesw-resize; }
.rh-tl { left: 0; top: 0; width: 14px; height: 14px; cursor: nwse-resize; }

/* ============================================================
   DOCK
   ============================================================ */
#dock-container {
  position: absolute; bottom: 4px; left: 0; right: 0;
  display: flex; justify-content: center;
  z-index: 4000; pointer-events: none;
}
#dock {
  display: flex; align-items: flex-end; gap: 6px;
  padding: 6px 8px;
  height: 64px;
  background: rgba(255,255,255,0.28);
  backdrop-filter: blur(28px) saturate(1.7);
  -webkit-backdrop-filter: blur(28px) saturate(1.7);
  border: 0.5px solid rgba(255,255,255,0.35);
  border-radius: 20px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.32);
  pointer-events: auto;
}
body.dark #dock { background: rgba(40,40,40,0.42); border-color: rgba(255,255,255,0.12); }
.dock-item {
  position: relative; width: 50px; height: 50px;
  display: flex; align-items: flex-end; justify-content: center;
  transition: transform 0.12s ease, margin 0.12s ease;
  transform-origin: bottom center;
  cursor: pointer;
}
.dock-item img, .dock-item svg.app-icon {
  width: 50px; height: 50px; display: block;
  filter: drop-shadow(0 3px 6px rgba(0,0,0,0.28));
  pointer-events: none;
}
.dock-item .dock-label {
  position: absolute; bottom: 64px; left: 50%; transform: translateX(-50%);
  background: rgba(60,60,60,0.92); color: #fff;
  padding: 4px 11px; border-radius: 7px; font-size: 12.5px;
  white-space: nowrap; opacity: 0; pointer-events: none;
  transition: opacity 0.12s; box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
.dock-item .dock-label::after {
  content: ""; position: absolute; top: 100%; left: 50%; transform: translateX(-50%);
  border: 5px solid transparent; border-top-color: rgba(60,60,60,0.92);
}
.dock-item:hover .dock-label { opacity: 1; }
.dock-indicator {
  position: absolute; bottom: -4px; left: 50%; transform: translateX(-50%);
  width: 4px; height: 4px; border-radius: 50%;
  background: rgba(0,0,0,0.55); opacity: 0;
}
body.dark .dock-indicator { background: rgba(255,255,255,0.7); }
.dock-item.running .dock-indicator { opacity: 1; }
.dock-sep { width: 0.5px; height: 44px; background: rgba(0,0,0,0.2); margin: 0 3px; align-self: center; }
body.dark .dock-sep { background: rgba(255,255,255,0.2); }
@keyframes dockBounce {
  0%,100% { transform: translateY(0); }
  50% { transform: translateY(-32px); }
}
.dock-item.bouncing { animation: dockBounce 0.55s ease 2; }

/* ============================================================
   APP ICONS (generic rounded tile look)
   ============================================================ */
.app-tile {
  width: 100%; height: 100%; border-radius: 23%;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px;
}

/* ============================================================
   OVERLAYS — Spotlight
   ============================================================ */
.overlay {
  position: absolute; inset: 0; z-index: 7000;
  display: flex; align-items: flex-start; justify-content: center;
}
#spotlight { padding-top: 18vh; background: rgba(0,0,0,0.04); animation: fadeIn 0.12s; }
.spotlight-box {
  width: 640px; max-width: 90vw;
  background: rgba(245,245,245,0.7);
  backdrop-filter: blur(40px) saturate(1.8);
  -webkit-backdrop-filter: blur(40px) saturate(1.8);
  border: 0.5px solid rgba(255,255,255,0.4);
  border-radius: 14px; overflow: hidden;
  box-shadow: 0 30px 80px rgba(0,0,0,0.4);
}
.spotlight-input-row { display: flex; align-items: center; padding: 14px 20px; gap: 14px; }
.spotlight-icon { color: #666; flex-shrink: 0; }
#spotlight-input {
  flex: 1; border: none; background: transparent; outline: none;
  font-size: 26px; font-weight: 300; color: #1d1d1f; font-family: var(--font);
}
.spotlight-results { max-height: 50vh; overflow-y: auto; }
.spotlight-results:not(:empty) { border-top: 0.5px solid rgba(0,0,0,0.12); padding: 6px; }
.spot-result {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 12px; border-radius: 7px; cursor: default;
}
.spot-result.sel { background: var(--accent); color: #fff; }
.spot-result .sr-icon { width: 30px; height: 30px; flex-shrink: 0; }
.spot-result .sr-title { font-size: 14px; font-weight: 500; }
.spot-result .sr-sub { font-size: 11.5px; opacity: 0.6; }
.spot-result.sel .sr-sub { opacity: 0.85; }

/* Launchpad */
#launchpad {
  flex-direction: column; align-items: center;
  background: rgba(0,0,0,0.15);
  backdrop-filter: blur(45px) saturate(1.4);
  -webkit-backdrop-filter: blur(45px) saturate(1.4);
  padding-top: 60px; animation: fadeIn 0.2s;
}
.launchpad-search-wrap { margin-bottom: 40px; }
#launchpad-search {
  width: 280px; height: 32px; border-radius: 8px; border: none;
  background: rgba(255,255,255,0.2); color: #fff; text-align: center;
  font-size: 14px; outline: none; font-family: var(--font);
  backdrop-filter: blur(10px);
}
#launchpad-search::placeholder { color: rgba(255,255,255,0.7); }
.launchpad-grid {
  display: grid; grid-template-columns: repeat(7, 1fr);
  gap: 30px 48px; max-width: 900px; width: 90%;
  justify-items: center;
}
.lp-item {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  cursor: pointer; width: 110px;
  animation: lpPop 0.3s ease backwards;
}
.lp-item:hover .lp-icon { transform: scale(1.08); }
.lp-icon { width: 74px; height: 74px; transition: transform 0.15s; filter: drop-shadow(0 4px 10px rgba(0,0,0,0.35)); }
.lp-label { font-size: 13px; color: #fff; text-shadow: 0 1px 4px rgba(0,0,0,0.6); text-align: center; }

/* Control Center */
#controlcenter {
  position: absolute; top: 30px; right: 8px; z-index: 6500;
  width: 320px; padding: 14px;
  background: rgba(244,244,244,0.62);
  backdrop-filter: blur(40px) saturate(1.8);
  -webkit-backdrop-filter: blur(40px) saturate(1.8);
  border: 0.5px solid rgba(255,255,255,0.4);
  border-radius: 18px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.32);
  display: grid; grid-template-columns: 1fr 1fr; gap: 11px;
  animation: dropIn 0.15s ease;
  color: #1d1d1f;
}
.cc-tile {
  background: rgba(255,255,255,0.5);
  border-radius: 14px; padding: 12px 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.cc-tile.cc-wide { grid-column: span 2; }
.cc-row { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.cc-toggle-icon {
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: #ccc; color: #fff; cursor: pointer; transition: background 0.2s; flex-shrink: 0;
}
.cc-toggle-icon.on { background: var(--accent); }
.cc-label { font-size: 12.5px; font-weight: 500; line-height: 1.1; }
.cc-sub { font-size: 11px; opacity: 0.6; }
.cc-slider-label { font-size: 12px; font-weight: 600; margin-bottom: 8px; display: flex; align-items: center; gap: 6px; }
.cc-slider { width: 100%; accent-color: var(--accent); }

/* Context menu */
#context-menu {
  position: absolute; z-index: 6800; min-width: 200px; padding: 5px;
  background: rgba(246,246,246,0.82);
  backdrop-filter: blur(34px) saturate(1.6);
  -webkit-backdrop-filter: blur(34px) saturate(1.6);
  border: 0.5px solid rgba(0,0,0,0.12); border-radius: 8px;
  box-shadow: 0 14px 44px rgba(0,0,0,0.28);
  font-size: 13px; color: #1d1d1f; animation: dropIn 0.1s ease;
}

/* Notifications */
#notification-layer {
  position: absolute; top: 34px; right: 10px; z-index: 6900;
  display: flex; flex-direction: column; gap: 10px; pointer-events: none;
}
.notification {
  width: 330px; padding: 12px 14px;
  background: rgba(250,250,250,0.78);
  backdrop-filter: blur(34px) saturate(1.7);
  -webkit-backdrop-filter: blur(34px) saturate(1.7);
  border: 0.5px solid rgba(255,255,255,0.4);
  border-radius: 16px; box-shadow: 0 14px 40px rgba(0,0,0,0.26);
  display: flex; gap: 12px; align-items: flex-start;
  animation: notifIn 0.4s cubic-bezier(0.2,1.1,0.3,1); pointer-events: auto;
  color: #1d1d1f;
}
.notification.out { animation: notifOut 0.3s ease forwards; }
.notif-icon { width: 38px; height: 38px; border-radius: 9px; flex-shrink: 0; }
.notif-body { flex: 1; min-width: 0; }
.notif-title { font-size: 13px; font-weight: 600; }
.notif-msg { font-size: 12.5px; opacity: 0.85; line-height: 1.3; }
.notif-time { position: absolute; top: 12px; right: 14px; font-size: 11px; opacity: 0.5; }

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes dropIn { from { opacity: 0; transform: translateY(-6px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes winOpen { from { opacity: 0; transform: scale(0.92); } to { opacity: 1; transform: scale(1); } }
@keyframes winClose { to { opacity: 0; transform: scale(0.92); } }
@keyframes lpPop { from { opacity: 0; transform: scale(0.8); } to { opacity: 1; transform: scale(1); } }
@keyframes notifIn { from { opacity: 0; transform: translateX(360px); } to { opacity: 1; transform: none; } }
@keyframes notifOut { to { opacity: 0; transform: translateX(360px); } }
@keyframes spin { to { transform: rotate(360deg); } }

/* Custom scrollbars */
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.28); border-radius: 6px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,0.45); background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }
body.dark ::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.28); background-clip: content-box; }
