/*
    ██╗    ██╗██╗ ██████╗██╗  ██╗███████╗██████╗
    ██║    ██║██║██╔════╝██║ ██╔╝██╔════╝██╔══██╗
    ██║ █╗ ██║██║██║     █████╔╝ █████╗  ██║  ██║
    ██║███╗██║██║██║     ██╔═██╗ ██╔══╝  ██║  ██║
    ╚███╔███╔╝██║╚██████╗██║  ██╗███████╗██████╔╝
     ╚══╝╚══╝ ╚═╝ ╚═════╝╚═╝  ╚═╝╚══════╝╚═════╝
        W I C K E D   D E V E L O P M E N T
    ------------------------------------------------
    Project  : mv-cad — Mountain Valley RP CAD/MDT
    File     : public/css/os.css
    Author   : Wicked Development
    GitHub   : https://github.com/wickedlovesunturned
    ------------------------------------------------
    Windows 11 shell, played straight: sign-in
    screen, desktop, centered taskbar with tray,
    Mica window chrome with real caption buttons.
    The MDT function-key toolbar lives inside the
    app window, like the in-car terminals.
*/

:root {
  --tb-h: 48px;
  --win-border: #454545;
  --caption-hover: rgba(255, 255, 255, .09);
  --close-hover: #C42B1C;
  --taskbar-bg: rgba(28, 28, 28, .86);
  --selection: rgba(255, 255, 255, .09);
}

/* ---------- Wallpaper (Win11-style dark bloom, pure CSS) ---------- */
body.os {
  height: 100vh;
  overflow: hidden;
  background: #06090F;
  font-family: var(--font-body);
}
body.os::before {
  content: "";
  position: fixed; inset: 0;
  background: url("/img/wallpaper.jpg") center / cover no-repeat #06090F;
  pointer-events: none;
  z-index: -2;
}

/* ============================================================
   SIGN-IN SCREEN
   ============================================================ */
body.os-lock .lock-screen {
  position: fixed; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 14px;
  text-align: center;
  backdrop-filter: blur(34px) brightness(.72);
}
.lock-avatar {
  width: 96px; height: 96px;
  border-radius: 50%;
  background: #7A7A7A;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  margin-bottom: 2px;
}
.lock-avatar svg { width: 96px; height: 96px; margin-bottom: -14px; }
.lock-name {
  font: 300 28px/1.2 var(--font-display);
  color: #fff;
  text-shadow: 0 1px 8px rgba(0, 0, 0, .4);
}
.lock-sub { color: rgba(255, 255, 255, .78); font-size: 12.5px; margin: 0; text-shadow: 0 1px 6px rgba(0,0,0,.5); }
.lock-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: 400 14px var(--font-body);
  color: #fff;
  background: rgba(255, 255, 255, .16);
  border: 1px solid rgba(255, 255, 255, .35);
  border-radius: 4px;
  min-width: 268px;
  padding: 9px 18px;
  cursor: pointer; text-decoration: none;
  backdrop-filter: blur(8px);
}
.lock-btn:hover { background: rgba(255, 255, 255, .24); text-decoration: none; }
.lock-btn svg { width: 18px; height: 18px; }
.lock-error {
  max-width: 400px;
  background: rgba(0, 0, 0, .45);
  border: 1px solid rgba(255, 67, 67, .6);
  border-radius: 4px;
  color: #FFC9C9;
  font-size: 12.5px;
  padding: 9px 14px;
}
/* bottom-right tray icons, like the real sign-in screen */
.lock-tray {
  position: fixed; right: 28px; bottom: 22px;
  display: flex; gap: 6px;
}
.lock-tray span {
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; border-radius: 4px;
}
.lock-tray span:hover { background: rgba(255, 255, 255, .12); }
.lock-tray svg { width: 18px; height: 18px; }
.lock-clock { display: none; } /* the sign-in screen has no clock; time lives on the taskbar */
.lock-brand {
  position: fixed; left: 28px; bottom: 30px;
  color: rgba(255, 255, 255, .5);
  font: 400 12px var(--font-body);
}

/* ============================================================
   DESKTOP
   ============================================================ */
.desktop {
  position: fixed; inset: 0 0 var(--tb-h) 0;
  padding: 8px;
  overflow: hidden;
}
.desktop-icons {
  display: grid;
  grid-auto-flow: column;
  grid-template-rows: repeat(auto-fill, 96px);
  grid-auto-columns: 84px;
  gap: 2px;
  height: 100%;
  justify-content: start;
  align-content: start;
}
.dicon {
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  gap: 5px;
  padding: 8px 2px 4px;
  border: 1px solid transparent;
  border-radius: 2px;
  text-decoration: none;
  cursor: default;
}
.dicon:hover { background: var(--selection); border-color: rgba(255, 255, 255, .14); text-decoration: none; }
.dicon:focus-visible { background: rgba(76, 194, 255, .22); border-color: rgba(76, 194, 255, .5); outline: none; }
/* App icons are self-contained SVGs (gradient body drawn in the icon itself);
   containers only size them. */
.dicon .tile {
  width: 46px; height: 46px;
  display: flex; align-items: center; justify-content: center;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, .5));
}
.dicon .tile svg { width: 46px; height: 46px; }
.dicon .label {
  font: 400 11.5px/1.25 var(--font-body);
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .9), 0 0 6px rgba(0, 0, 0, .6);
  text-align: center;
  max-width: 80px;
  overflow-wrap: break-word;
}

/* ============================================================
   TASKBAR (Win11: centered icons, tray right)
   ============================================================ */
.taskbar {
  position: fixed; left: 0; right: 0; bottom: 0;
  height: var(--tb-h);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  background: var(--taskbar-bg);
  backdrop-filter: blur(24px) saturate(1.2);
  border-top: 1px solid rgba(255, 255, 255, .06);
  z-index: 500;
  font-family: var(--font-body);
}
.tb-center { grid-column: 2; display: flex; align-items: center; gap: 2px; }
.tb-btn {
  position: relative;
  width: 44px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 5px;
  text-decoration: none;
  color: #fff;
}
.tb-btn:hover { background: rgba(255, 255, 255, .09); text-decoration: none; }
.tb-btn .mini {
  width: 26px; height: 26px;
  display: flex; align-items: center; justify-content: center;
}
.tb-btn .mini svg { width: 26px; height: 26px; }
.tb-btn.running::after {
  content: "";
  position: absolute; bottom: 2px; left: 50%;
  transform: translateX(-50%);
  width: 16px; height: 3px;
  border-radius: 2px;
  background: var(--accent);
}
.tb-btn.tb-start-btn svg { width: 22px; height: 22px; }
.tb-btn[title]:hover { /* native tooltip is fine */ }

.tb-tray {
  grid-column: 3;
  justify-self: end;
  display: flex; align-items: center; gap: 2px;
  height: 100%;
  padding-right: 4px;
}
.tray-item {
  display: flex; align-items: center; gap: 6px;
  height: 40px;
  padding: 0 8px;
  border-radius: 5px;
  color: #fff;
  font-size: 12px;
  align-self: center;
}
.tray-item:hover { background: rgba(255, 255, 255, .09); }
.tray-item svg { width: 15px; height: 15px; }
.tb-clock {
  text-align: right;
  font: 400 12px/1.35 var(--font-body);
  color: #fff;
  padding: 0 10px;
  align-self: center;
}
.tb-user-mini { font-size: 12px; color: #fff; display: flex; align-items: center; gap: 6px; }
.tb-user-mini .mono { font-family: var(--font-mono); color: var(--text-mono); }
.tb-power { background: none; border: none; cursor: pointer; padding: 0; }
.tb-power .tray-item { color: #fff; }
.show-desktop { width: 6px; height: 100%; border-left: 1px solid rgba(255,255,255,.12); margin-left: 4px; }

/* ============================================================
   APP WINDOW (Win11 Mica)
   ============================================================ */
.window-layer {
  position: fixed; inset: 0 0 var(--tb-h) 0;
  padding: 26px 40px 18px;
  display: flex;
}
.window {
  flex: 1;
  display: flex; flex-direction: column;
  min-height: 0; min-width: 0;
  background: var(--bg);
  border: 1px solid var(--win-border);
  border-radius: var(--radius);
  box-shadow: 0 24px 60px rgba(0, 0, 0, .55), 0 4px 14px rgba(0, 0, 0, .4);
  overflow: hidden;
}
.window-layer.maximized { padding: 0; }
.window-layer.maximized .window { border-radius: 0; border: none; }

/* Titlebar blends into the window (Mica) — no separate band */
.titlebar {
  display: flex; align-items: center; gap: 8px;
  height: 34px; flex: none;
  background: var(--bg);
  padding: 0 0 0 12px;
  user-select: none;
  font-family: var(--font-body);
}
.titlebar .mini {
  width: 16px; height: 16px;
  display: flex; align-items: center; justify-content: center;
  flex: none;
}
.titlebar .mini svg { width: 16px; height: 16px; }
.titlebar .tb-title {
  font: 400 12px var(--font-body);
  color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.titlebar .tb-title .dim2 { color: var(--text-dim); }
.titlebar .tb-spacer { flex: 1; }
.wbtn {
  width: 46px; height: 34px;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 10px;
  cursor: default;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: "Segoe UI Symbol", var(--font-body);
}
.wbtn:hover { background: var(--caption-hover); }
.wbtn.close:hover { background: var(--close-hover); color: #fff; }

/* ---------- Function-key toolbar (the MDT part) ---------- */
.fkeys {
  display: flex; align-items: stretch; gap: 4px;
  flex: none;
  background: var(--surface);
  border-top: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline);
  padding: 6px 8px;
  overflow-x: auto;
}
.fkey {
  position: relative;
  min-width: 88px;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  color: var(--text);
  font: 600 12px var(--font-body);
  padding: 11px 26px 8px 14px;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  white-space: nowrap;
}
.fkey:hover { background: #383838; text-decoration: none; }
.fkey .fk {
  position: absolute; top: 3px; right: 6px;
  font: 400 9px var(--font-mono);
  color: var(--text-dim);
}
.fkey.active {
  background: #1F3A4D;
  border-color: var(--accent);
  color: #fff;
  box-shadow: inset 0 -2px 0 var(--accent);
}
.fkey.tone-danger { background: #452227; border-color: #6E3038; }
.fkey.tone-danger:hover { background: #542A31; }
.fkey.tone-danger.active { border-color: var(--st-panic); box-shadow: inset 0 -2px 0 var(--st-panic); background: #5C2129; }
.fkey.tone-go { background: #21402A; border-color: #35603F; }

.fkeys .fkeys-right {
  margin-left: auto;
  display: flex; align-items: center; gap: 8px;
  padding-left: 10px;
}

/* Window content host */
.window-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 18px 22px;
  background: var(--bg);
}
.window-body.nopad { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.window-body .content-head h1 { font-size: 20px; }

[x-cloak] { display: none !important; }

@media (max-width: 900px) {
  .window-layer { padding: 0; }
  .window { border-radius: 0; border: none; }
  .desktop { padding: 4px; }
  .tb-user-mini span:not(.mono) { display: none; }
  .fkey { min-width: 64px; padding: 9px 20px 7px 10px; }
}
