/* style.css — main stylesheet for Web OS
   Abdullah, 2025
   keeping this organized: tokens → base → desktop → topbar → lockscreen → windows → dock → apps */


/* ---- reset ---- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}


/* ---- css variables (design tokens) ----
   change stuff here and it updates everywhere */
:root {
  --bg:       #e8eaf0;
  --surface:  rgba(255,255,255,0.62);
  --border:   rgba(0,0,0,0.07);
  --text:     #1c1c1e;
  --muted:    #808080;
  --accent:   #3a3a3a;
  --radius:   14px;
  --font:     -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --shadow:   0 16px 50px rgba(0,0,0,0.16), 0 4px 12px rgba(0,0,0,0.09);
  --bar-h:    38px;
}

/* dark mode — just swap the variables, everything else updates automatically */
body.dark-theme {
  --bg:      #111116;
  --surface: rgba(28,28,34,0.72);
  --border:  rgba(255,255,255,0.08);
  --text:    #f0f0f0;
  --muted:   #999;
  --accent:  #e8e8e8;
  --shadow:  0 16px 50px rgba(0,0,0,0.55), 0 4px 12px rgba(0,0,0,0.35);
}


/* ---- base ---- */
html, body {
  height: 100%;
  width: 100%;
  overflow: hidden;
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  background: var(--bg);
  color: var(--text);
  /* smooth theme transitions */
  transition: background 0.3s ease, color 0.3s ease;
}

/* global transition on interactive elements only — not everything */
button, input, .dock-item, .window, .wp-thumb, .cal-day, .focus-tab {
  transition-property: background-color, color, border-color, box-shadow, opacity, transform;
  transition-duration: 0.18s;
  transition-timing-function: cubic-bezier(0.22,1,0.36,1);
}

/* dont animate canvas/video/img */
canvas, video, audio, img { transition: none !important; }


/* ---- desktop background ---- */
#desktop {
  position: fixed;
  inset: 0;
  background: var(--bg);
  /* smooth when switching wallpapers */
  transition: background-color 0.5s ease;
}

#live-wp-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  display: none;
  z-index: 0;
}

#live-wp-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
  display: none;
  z-index: 0;
}


/* ---- topbar ---- */
#topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--bar-h);
  background: var(--surface);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  z-index: 9000;
  user-select: none;
}

#topbar-left {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.2px;
}

#topbar-right {
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums; /* stops the clock digits from jumping */
}


/* ---- lock screen ---- */
#lock-screen {
  position: fixed;
  inset: 0;
  z-index: 8000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.45);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
}

.lock-card {
  background: rgba(255,255,255,0.16);
  backdrop-filter: blur(40px) saturate(180%);
  -webkit-backdrop-filter: blur(40px) saturate(180%);
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 28px;
  padding: 40px 52px 36px;
  text-align: center;
  box-shadow: 0 24px 70px rgba(0,0,0,0.28);
  animation: slideUp 0.45s cubic-bezier(0.22,1,0.36,1);
}

@keyframes slideUp {
  from { opacity:0; transform:translateY(20px) scale(0.96); }
  to   { opacity:1; transform:translateY(0)    scale(1);    }
}

.lock-time {
  font-size: 56px;
  font-weight: 200;
  letter-spacing: -3px;
  color: #fff;
  line-height: 1;
  margin-bottom: 6px;
}

.lock-date {
  font-size: 13px;
  color: rgba(255,255,255,0.7);
  margin-bottom: 28px;
  font-weight: 500;
}

.enter-btn {
  background: rgba(255,255,255,0.92);
  color: #111;
  border: none;
  padding: 9px 26px;
  border-radius: 50px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font);
  letter-spacing: 0.1px;
}
.enter-btn:hover  { background: #fff; }
.enter-btn:active { transform: scale(0.97); }


/* ---- windows ---- */
.window {
  position: fixed;
  background: var(--surface);
  backdrop-filter: blur(32px) saturate(160%);
  -webkit-backdrop-filter: blur(32px) saturate(160%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: none;
  flex-direction: column;
  overflow: hidden;
  min-width: 240px;
  min-height: 160px;
}

.window.open {
  display: flex;
  animation: winPop 0.26s cubic-bezier(0.22,1,0.36,1);
}

@keyframes winPop {
  from { opacity:0; transform:scale(0.93) translateY(8px); }
  to   { opacity:1; transform:scale(1)    translateY(0);   }
}

.window.maximized {
  border-radius: 0 !important;
  top:    38px   !important;
  left:   0      !important;
  width:  100vw  !important;
  height: calc(100vh - 38px) !important;
}

/* resize handles — thin strips on each edge and corner */
.resize-handle {
  position: absolute;
  z-index: 10;
}
.resize-n  { top:-4px;    left:8px;    right:8px;   height:8px; }
.resize-s  { bottom:-4px; left:8px;    right:8px;   height:8px; }
.resize-e  { right:-4px;  top:8px;     bottom:8px;  width:8px;  }
.resize-w  { left:-4px;   top:8px;     bottom:8px;  width:8px;  }
.resize-nw { top:-4px;    left:-4px;   width:14px;  height:14px; }
.resize-ne { top:-4px;    right:-4px;  width:14px;  height:14px; }
.resize-sw { bottom:-4px; left:-4px;   width:14px;  height:14px; }
.resize-se { bottom:-4px; right:-4px;  width:14px;  height:14px; }


/* ---- titlebar ---- */
.titlebar {
  display: flex;
  align-items: center;
  padding: 9px 10px 7px;
  gap: 6px;
  cursor: grab;
  user-select: none;
  flex-shrink: 0;
}
.titlebar:active { cursor: grabbing; }

/* traffic light buttons */
.tb-close, .tb-min, .tb-max {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  flex-shrink: 0;
}
.tb-close:hover, .tb-min:hover, .tb-max:hover { filter: brightness(0.78); }
.tb-close { background: #ff5f57; }
.tb-min   { background: #febc2e; }
.tb-max   { background: #28c840; }

.win-title {
  flex: 1;
  text-align: center;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
  margin-right: 28px; /* balance against the 3 buttons on the left */
  letter-spacing: 0.1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.win-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: auto;
}


/* ---- dock ---- */
#dock {
  position: fixed;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 7px 12px;
  display: flex;
  align-items: flex-end;
  gap: 5px;
  z-index: 8999;
  box-shadow: 0 6px 24px rgba(0,0,0,0.12);
}

.dock-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  cursor: pointer;
  position: relative;
  transition: transform 0.28s cubic-bezier(0.22,1,0.36,1) !important;
}
.dock-item:hover  { transform: translateY(-10px) scale(1.18); }
.dock-item:active { transform: translateY(-3px) scale(1.06); }

.dock-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px rgba(0,0,0,0.12);
}

.dock-dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--muted);
  opacity: 0;
}
.dock-item.open .dock-dot { opacity: 1; }

/* tooltip on hover */
.dock-item::before {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(20,20,20,0.82);
  color: #fff;
  font-size: 10.5px;
  font-weight: 500;
  padding: 3px 8px;
  border-radius: 6px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s;
}
.dock-item:hover::before { opacity: 1; }


/* ---- notes ---- */
#win-notes { width:400px; height:340px; top:110px; left:180px; }

#notes-textarea {
  flex: 1;
  border: none;
  outline: none;
  resize: none;
  font-family: var(--font);
  font-size: 13px;
  line-height: 1.7;
  color: var(--text);
  background: transparent;
  padding: 10px 14px 14px;
}

#notes-bar {
  padding: 5px 12px;
  font-size: 10.5px;
  color: var(--muted);
  background: rgba(128,128,128,0.06);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}


/* ---- wallpaper thumbnails ---- */
.wp-grid {
  display: grid;
  grid-template-columns: repeat(2,1fr);
  gap: 10px;
  padding: 12px;
  overflow-y: auto;
}

.wp-thumb {
  aspect-ratio: 16/10;
  border-radius: 9px;
  cursor: pointer;
  border: 2.5px solid transparent;
  overflow: hidden;
  position: relative;
  transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.wp-thumb:hover { transform:scale(1.03); box-shadow:0 4px 14px rgba(0,0,0,0.18); }
.wp-thumb.active { border-color: var(--accent); }

.wp-thumb span {
  position: absolute;
  bottom: 6px; left: 8px;
  font-size: 10px;
  font-weight: 600;
  color: rgba(255,255,255,0.88);
  text-shadow: 0 1px 4px rgba(0,0,0,0.65);
}


/* ---- calendar ---- */
#win-calendar { width:320px; height:370px; top:105px; left:300px; }

.cal-wrap { padding:10px 12px; display:flex; flex-direction:column; gap:0; }

.cal-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.cal-nav button {
  background: none;
  border: none;
  font-size: 15px;
  color: var(--muted);
  cursor: pointer;
  width: 26px; height: 26px;
  border-radius: 6px;
}
.cal-nav button:hover { background: rgba(128,128,128,0.15); }

.cal-month-label { font-size:13px; font-weight:700; color:var(--text); }

.cal-grid { display:grid; grid-template-columns:repeat(7,1fr); gap:1px; }

.cal-dname {
  text-align: center;
  font-size: 9.5px;
  font-weight: 600;
  color: var(--muted);
  padding: 4px 0;
  text-transform: uppercase;
}

.cal-day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--muted);
  border-radius: 6px;
  cursor: pointer;
}
.cal-day:hover { background: rgba(128,128,128,0.15); }
.cal-day.cur-month { color: var(--text); }
.cal-day.today { background:var(--text); color:var(--bg); font-weight:700; }
.cal-day.has-event { box-shadow: inset 0 -2px 0 var(--accent); }
.cal-day.selected { outline: 2px solid var(--accent); outline-offset: -2px; }

.cal-events-section { margin-top:10px; padding-top:10px; border-top:1px solid var(--border); }
.cal-events-label { font-size:10px; font-weight:700; color:var(--muted); text-transform:uppercase; letter-spacing:0.5px; margin-bottom:6px; }
.cal-event { font-size:11.5px; color:var(--text); padding:5px 8px; background:rgba(128,128,128,0.1); border-radius:6px; margin-bottom:4px; border-left:2px solid var(--accent); }
.cal-empty { font-size:11px; color:var(--muted); font-style:italic; }


/* ---- terminal ---- */
#win-terminal { width:460px; height:320px; top:130px; left:210px; }
#win-terminal .titlebar { background:rgba(26,26,34,0.97); }
#win-terminal .win-title { color:rgba(255,255,255,0.3); }

.term-shell {
  background: rgba(18,18,26,0.98);
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 10px 13px;
  font-family: "SF Mono","Fira Code","Fira Mono",monospace;
  font-size: 12px;
  color: #d4d4d4;
}

.term-output {
  flex: 1;
  overflow-y: auto;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
  margin-bottom: 6px;
}

.t-cmd  { color: #73c991; }
.t-err  { color: #f48771; }
.t-info { color: #9cdcfe; }

.term-input-row { display:flex; align-items:center; gap:6px; flex-shrink:0; }
.term-prompt { color:#73c991; font-weight:600; white-space:nowrap; }

.term-field {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: #d4d4d4;
  font-family: inherit;
  font-size: 12px;
  caret-color: #73c991;
}


/* ---- focus timer ---- */
#win-focus { width:320px; height:400px; top:100px; left:260px; }

.focus-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px 16px;
  gap: 16px;
  text-align: center;
}

.focus-mode-tabs {
  display: flex;
  gap: 4px;
  background: rgba(128,128,128,0.14);
  border-radius: 8px;
  padding: 3px;
}

.focus-tab {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  background: none;
  color: var(--muted);
  font-family: var(--font);
}
.focus-tab.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}

.focus-ring-wrap { position:relative; width:150px; height:150px; }
.focus-ring-svg { width:150px; height:150px; transform:rotate(-90deg); }
.focus-ring-bg { fill:none; stroke:rgba(128,128,128,0.15); stroke-width:7; }
.focus-ring-progress {
  fill: none;
  stroke: var(--accent);
  stroke-width: 7;
  stroke-linecap: round;
  stroke-dasharray: 408;
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 1s linear, stroke 0.3s;
}

.focus-time-display {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.focus-clock { font-size:34px; font-weight:200; letter-spacing:-2px; color:var(--text); font-variant-numeric:tabular-nums; line-height:1; }
.focus-label { font-size:10px; color:var(--muted); margin-top:3px; font-weight:600; letter-spacing:0.5px; text-transform:uppercase; }

.focus-controls { display:flex; gap:8px; align-items:center; }

.focus-btn {
  border: none;
  border-radius: 50px;
  padding: 8px 20px;
  font-size: 12.5px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
}
.focus-btn:hover  { opacity: 0.80; }
.focus-btn:active { transform: scale(0.97); }
.focus-btn-main  { background:var(--text); color:var(--bg); min-width:80px; }
.focus-btn-reset { background:rgba(128,128,128,0.15); color:var(--text); }

.focus-sessions { font-size:11px; color:var(--muted); }
.focus-sessions span { font-weight:700; color:var(--text); }

.session-dots { display:flex; gap:5px; }
.sdot { width:7px; height:7px; border-radius:50%; background:rgba(128,128,128,0.2); }
.sdot.done { background:var(--accent); }


/* ---- palette app ---- */
#win-palette { width:950px; height:650px; top:80px; left:120px; }


/* ---- music player ---- */
#win-music { width:280px; height:350px; top:120px; left:400px; }


/* ---- pixel art ---- */
#win-pixel { width:340px; height:420px; top:140px; left:320px; }
.pixel-cell { border-right:1px solid rgba(128,128,128,0.2); border-bottom:1px solid rgba(128,128,128,0.2); }
.pixel-cell:hover { opacity:0.8; }


/* ---- folder apps inside games/tools/media windows ---- */
.folder-app {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 76px;
  cursor: pointer;
  padding: 10px;
  border-radius: var(--radius);
}
.folder-app:hover { background:rgba(128,128,128,0.1); transform:scale(1.06); }

.folder-icon {
  width: 54px;
  height: 54px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  box-shadow: var(--shadow);
  margin-bottom: 10px;
}

.folder-name { font-size:12px; color:var(--text); font-weight:500; text-align:center; line-height:1.2; }


/* ---- toast notification ---- */
#toast {
  position: fixed;
  top: 48px;
  right: 14px;
  background: var(--surface);
  backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 13px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
  box-shadow: var(--shadow);
  z-index: 99999;
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 0.18s, transform 0.18s !important;
  pointer-events: none;
}
#toast.show { opacity:1; transform:translateY(0); }

/* ---- boot screen ---- */
#boot-screen {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: #0a0a0f;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.6s ease;
}

#boot-screen.fade-out {
  opacity: 0;
  pointer-events: none;
}

.boot-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  animation: bootFadeIn 0.5s ease forwards;
}

@keyframes bootFadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.boot-logo {
  animation: bootLogoAnim 2s cubic-bezier(0.22, 1, 0.36, 1) infinite;
  transform-style: preserve-3d;
}

@keyframes bootLogoAnim {
  0%   { transform: rotateY(0deg) scale(0.9); filter: drop-shadow(0 0 10px rgba(255,255,255,0.2)); opacity: 0.7; }
  50%  { transform: rotateY(180deg) scale(1.1); filter: drop-shadow(0 0 30px rgba(255,255,255,0.6)); opacity: 1; }
  100% { transform: rotateY(360deg) scale(0.9); filter: drop-shadow(0 0 10px rgba(255,255,255,0.2)); opacity: 0.7; }
}

.boot-name {
  font-size: 18px;
  font-weight: 600;
  color: rgba(255,255,255,0.85);
  letter-spacing: 2px;
  text-transform: uppercase;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
}

.boot-bar-wrap {
  width: 180px;
  height: 3px;
  background: rgba(255,255,255,0.1);
  border-radius: 3px;
  overflow: hidden;
}

.boot-bar {
  height: 100%;
  width: 0%;
  background: rgba(255,255,255,0.9);
  border-radius: 3px;
  box-shadow: 0 0 10px rgba(255,255,255,0.6);
  transition: width 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.boot-hint {
  font-size: 11px;
  color: rgba(255,255,255,0.3);
  letter-spacing: 0.5px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  min-height: 16px;
}


/* ---- wallpaper background layer ----
   sits behind everything, keeps backdrop-filter on windows
   from blurring the wallpaper */
#wp-bg-layer {
  position: absolute;
  inset: 0;
  z-index: 0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}


/* ---- gallery app ---- */
.gallery-thumb {
  aspect-ratio: 1;
  background-size: cover;
  background-position: center;
  border-radius: 6px;
  cursor: pointer;
  transition: transform 0.15s, opacity 0.15s;
}
.gallery-thumb:hover {
  transform: scale(1.04);
  opacity: 0.88;
}