/* ============================================================
   sabreOS desktop extras — color schemes, selection, Recycle Bin,
   Display Properties, Run, Close Program, Blue Screen, screen saver,
   Quick Launch, visitor counter, Start menu tweaks
   ============================================================ */

/* ---- Color scheme (Display Properties > Appearance) ---- */
:root { --sabre-title-a: #3a2eaa; --sabre-title-b: #3ca0ff; --sabre-sel: #3a2eaa; }
.app-window.active .window-header { background: linear-gradient(90deg, var(--sabre-title-a), var(--sabre-title-b)); }
.ex-dialog-title { background: linear-gradient(90deg, var(--sabre-title-a), var(--sabre-title-b)); }
.ex-item.sel .ex-label, .ex-tree-row.cur span { background: var(--sabre-sel); }
.ex-item.sel .ex-ico, .ex-item.sel .ex-drow img { background: var(--sabre-sel); }
.ex-item.sel .ex-thumb { border-color: var(--sabre-sel); }
.ex-menu-item:hover:not(.disabled), .ex-menu-item:focus:not(.disabled) { background: var(--sabre-sel); }
.np-text::selection, .ex-addr-input::selection { background: var(--sabre-sel); }

/* ---- Maximized windows ---- */
.app-window.maximized .resize-handle { display: none; }
.app-window.maximized .window-header { cursor: default; }
.app-window.maximized .btn-max { background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAkAAAAJCAYAAADgkQYQAAAAOUlEQVR42pWNsQ0AIAzDHMRhPb2fhQ0GBBRPkSLZYmEOND45maxbBhDgUk6AM3M7ImLuXpBQz71MA/1TCgt8zhouAAAAAElFTkSuQmCC"); background-position: center; }

/* ---- Desktop icons: selection + hidden ---- */
.desktop-icon[hidden] { display: none !important; }
.desktop-icon:focus { outline: none; }
.desktop-icons .desktop-icon.selected,
.desktop-folders .desktop-icon.selected { color: #fff; }
.desktop-icon.selected img { filter: drop-shadow(0 1px 3px rgba(0,0,0,0.8)) brightness(0.7) sepia(1) hue-rotate(205deg) saturate(3); }
.desktop-icons .desktop-icon.selected { text-shadow: none; }
.desktop-icon.selected:focus-visible { outline: 1px dotted #fff; outline-offset: -2px; }
.desktop-icon.drop-target img { filter: drop-shadow(0 0 6px #fff) brightness(1.15); }
.desktop-icons .desktop-icon.selected,
.desktop-folders .desktop-icon.selected { background: transparent; }
.desktop-icon.selected { --sel-label: var(--sabre-sel); }

/* ---- Light wallpapers (White, Cream, Lemon...): dark icon labels ---- */
html.light-desk .desktop-icons .desktop-icon,
html.light-desk .desktop-folders .desktop-folder,
html.light-desk .desktop-folders .desktop-folder:link,
html.light-desk .desktop-folders .desktop-folder:visited { color: #000 !important; text-shadow: none !important; }
html.light-desk .desktop-icons .desktop-icon img,
html.light-desk .desktop-folders .desktop-folder img { filter: drop-shadow(1px 1px 1px rgba(0,0,0,0.3)); }
html.light-desk .desktop-icon.selected { color: var(--sabre-sel) !important; }
html.light-desk .desktop-icon.selected img { filter: brightness(0.7) sepia(1) hue-rotate(205deg) saturate(3); }

/* ---- sabre logo: white on dark wallpapers, black on light ones ---- */
#desktop-logo { filter: none; transition: filter .2s; }   /* white on dark wallpapers, no shadow */
html.light-desk #desktop-logo { filter: brightness(0); }
#m-topbar .m-logo { filter: brightness(0); }   /* the phone top bar is light gray */

/* ---- Warning icon for dialogs ---- */
.ex-msg-ico.warn { background: #ffd24a; color: #000; border-color: #7a5a00; font-family: Georgia, serif; font-size: 20px; }

/* ---- Recycle Bin ---- */
.rb .ex-body { flex: 1; min-height: 0; }
.rb .ex-view { flex: 1; }

/* ---- Display Properties ---- */
.dp { display: flex; flex-direction: column; flex: 1; min-height: 0; padding: 8px 8px 6px; }
.dp-tabs { display: flex; gap: 0; padding-left: 2px; position: relative; z-index: 1; }
.dp-tabs button {
  border: none; background: #c0c0c0; padding: 3px 10px 4px; margin-right: -1px; font: inherit;
  box-shadow: inset 1px 1px #fff, inset -1px 0 #404040, inset -2px 0 #808080;
  border-radius: 3px 3px 0 0; position: relative; top: 2px;
}
.dp-tabs button.on { top: 0; padding-bottom: 6px; background: #c0c0c0; z-index: 2; }
.dp-panel {
  flex: 1; min-height: 0; overflow: auto; padding: 12px 12px 10px;
  box-shadow: inset 1px 1px #fff, inset -1px -1px #404040, inset -2px -2px #808080;
  background: #c0c0c0;
}
.dp-monitor { width: 184px; margin: 0 auto 12px; display: flex; flex-direction: column; align-items: center; }
.dp-screen {
  position: relative; width: 184px; height: 128px; background: #008080 center / cover no-repeat;
  border: 10px solid #c0c0c0; border-radius: 4px;
  box-shadow: 0 0 0 1px #404040, inset 0 0 0 1px #404040, 2px 2px 0 #808080;
}
.dp-mini { position: absolute; left: 22px; top: 20px; width: 118px; background: #c0c0c0; box-shadow: inset 1px 1px #fff, inset -1px -1px #404040; padding: 2px; }
.dp-mini[hidden] { display: none; }
.dp-mini-title { height: 12px; font-size: 9px; line-height: 12px; color: #fff; padding-left: 3px; font-weight: bold; }
.dp-mini-body { height: 40px; background: #fff; margin-top: 2px; box-shadow: inset 1px 1px #808080; }
.dp-ss-name { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #9fb4ff; font-size: 11px; letter-spacing: 1px; }
.dp-ss-name[hidden] { display: none; }
.dp-neck { width: 36px; height: 8px; background: #c0c0c0; box-shadow: inset 1px 0 #fff, inset -1px 0 #404040; }
.dp-base { width: 110px; height: 8px; background: #c0c0c0; box-shadow: inset 1px 1px #fff, inset -1px -1px #404040; }
.dp-page[hidden] { display: none; }
.dp-label { display: block; margin: 0 0 4px; }
.dp-list { width: 100%; height: auto !important; min-height: 110px; padding: 2px; }
.dp-row { display: flex; align-items: center; gap: 6px; margin-top: 8px; }
.dp-row .ex-field { flex: 0 1 auto; }
.dp-wait { width: 56px; }
.dp-saver, .dp-scheme { min-width: 170px; }
.dp-list optgroup { font-weight: bold; font-style: normal; color: #000; }
.dp-list option { font-weight: normal; padding-left: 6px; }
.dp-row { flex-wrap: wrap; gap: 6px 14px; }
.dp-mode-row, .dp-color-row { display: flex; align-items: center; gap: 6px; }
.dp-color-row[hidden] { display: none; }
.dp-color { width: 44px; height: 22px; padding: 1px; border: none; background: #fff; box-shadow: inset 1px 1px #808080, inset -1px -1px #fff; cursor: pointer; }
.dp-mode:disabled { color: #808080; }
.dp-note { font-size: 11px; color: #333; margin: 8px 0 0; line-height: 1.4; }
.dp-btns { display: flex; justify-content: flex-end; gap: 6px; padding-top: 8px; }
.dp-btns .ex-btn:disabled { color: #808080; text-shadow: 1px 1px #fff; }

/* ---- Run ---- */
.run { display: flex; flex-direction: column; flex: 1; padding: 10px 12px 8px; gap: 10px; }
.run-top { display: flex; gap: 12px; align-items: flex-start; }
.run-top img { width: 32px; height: 32px; image-rendering: pixelated; flex: 0 0 32px; }
.run-top p { margin: 0; line-height: 1.4; }
.run-row { display: flex; align-items: center; gap: 8px; }
.run-input { flex: 1; min-width: 0; }
.run-btns { display: flex; justify-content: flex-end; gap: 6px; margin-top: auto; }

/* ---- Close Program ---- */
.tm { display: flex; flex-direction: column; flex: 1; padding: 10px; gap: 8px; }
.tm-list { width: 100%; height: auto !important; min-height: 120px; }
.tm-warn { margin: 0; line-height: 1.4; font-size: 11px; }
.tm-btns { display: flex; justify-content: center; gap: 6px; margin-top: auto; }

/* ---- Blue Screen ---- */
.bsod {
  position: fixed; inset: 0; z-index: 2147483600; background: #0000aa; color: #fff;
  display: flex; align-items: center; justify-content: center; padding: 20px;
  font: 16px/1.5 "w95f", "Courier New", monospace; letter-spacing: 1px; cursor: none;
}
.bsod-box { max-width: 640px; }
.bsod-title { text-align: center; margin-bottom: 18px; }
.bsod-title span { background: #aaaaaa; color: #0000aa; padding: 0 8px; }
.bsod p { margin: 0 0 16px; }
.bsod-cont { text-align: center; }
.bsod-cursor { animation: bsod-blink 1s steps(2) infinite; }
@keyframes bsod-blink { 50% { opacity: 0; } }

/* ---- Screen saver ---- */
.ss-overlay { position: fixed; inset: 0; z-index: 2147483500; width: 100vw; height: 100vh; background: #000; cursor: none; }

/* ---- Quick Launch ---- */
#quick-launch { display: flex; align-items: center; gap: 1px; padding: 0 2px; }
#quick-launch button {
  width: 24px; height: 24px; padding: 0; border: none; background: transparent;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
}
#quick-launch button:hover { box-shadow: inset 1px 1px #fff, inset -1px -1px #808080; }
#quick-launch button:active { box-shadow: inset 1px 1px #808080, inset -1px -1px #fff; }
#quick-launch img { width: 16px; height: 16px; image-rendering: pixelated; }
#taskbar-tray img { cursor: pointer; }

/* ---- Visitor counter (desktop note) ---- */
.hit-counter { display: block; text-align: center; margin-bottom: 6px; font-size: 11px; color: #555; letter-spacing: 1px; }
.hit-counter[hidden] { display: none; }
.hit-digits { display: inline-flex; gap: 1px; margin-top: 3px; padding: 2px; background: #000; box-shadow: inset 1px 1px #808080, inset -1px -1px #fff; }
.hit-digits span {
  display: inline-block; width: 11px; height: 16px; line-height: 16px; text-align: center;
  background: linear-gradient(#222, #000 50%, #222 50%, #111); color: #7dff6a;
  font: bold 13px "Courier New", monospace; text-shadow: 0 0 4px rgba(125,255,106,0.7);
}

/* ---- Start menu: submenu glyphs + hidden items ---- */
#start-menu li[hidden] { display: none !important; }
#start-menu .sm-sub .sm-ico { width: 16px; height: 16px; }
#start-menu .sm-sub .sm-link { grid-template-columns: 20px 1fr 14px; padding: 4px 6px; }
#start-menu .sm-docs { max-height: 70vh; overflow-y: auto; }

@media (max-width: 700px) {
  #quick-launch { display: none; }
  #start-menu .has-sub > .sm-sub { padding-left: 14px; }
}
@media (prefers-reduced-motion: reduce) { .bsod-cursor { animation: none; } }

/* ============================================================
   cloud.js — your edits + community folders
   ============================================================ */
.desktop-folders .desktop-file .df-label { display: block; overflow-wrap: anywhere; max-height: 3.8em; overflow: hidden; }
.desktop-folders .desktop-file.df-thumb img {
  object-fit: cover; image-rendering: auto; background: #fff;
  border: 1px solid #000; box-shadow: 1px 1px 0 rgba(0,0,0,0.35); box-sizing: border-box;
}
html.desk-dropping body::after {
  content: "Drop to put these files on the desktop";
  position: fixed; left: 50%; bottom: 44px; transform: translateX(-50%); z-index: 99990;
  background: #ffffe1; color: #000; border: 1px solid #000; padding: 4px 10px; font-size: 13px;
  font-family: "w95f", Tahoma, Arial, sans-serif; pointer-events: none;
}
.ex-view.ex-dropping { outline: 2px dashed #3a2eaa; outline-offset: -4px; background-color: #eef; }

.cl-form { display: flex; flex-direction: column; gap: 8px; min-width: 280px; max-width: 360px; }
.cl-form p { margin: 0; line-height: 1.4; }
.cl-form label { display: flex; flex-direction: column; gap: 3px; }
.cl-form .ex-field { width: 100%; box-sizing: border-box; }
.cl-form .cl-note { font-size: 12px; color: #444; }
.cl-hp { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; overflow: hidden; }
.cl-logon { display: flex; gap: 12px; align-items: flex-start; }
.cl-logon-ico { width: 32px; height: 32px; image-rendering: pixelated; flex: none; margin-top: 2px; }

.cl-copy { min-width: 300px; max-width: 360px; }
.cl-copy p { margin: 8px 0; overflow-wrap: anywhere; }
.cl-copy-anim { height: 26px; position: relative; overflow: hidden; }
.cl-copy-anim span {
  position: absolute; top: 4px; left: 0; width: 18px; height: 16px; background: #fff; border: 1px solid #000;
  animation: cl-fly 1.2s steps(12) infinite;
}
@keyframes cl-fly { from { left: 0; } to { left: calc(100% - 18px); } }
@media (prefers-reduced-motion: reduce) { .cl-copy-anim span { animation: none; left: 45%; } }
.cl-bar { height: 16px; border: 1px solid; border-color: #808080 #fff #fff #808080; background: #fff; padding: 1px; }
.cl-bar i { display: block; height: 100%; width: 0; background: repeating-linear-gradient(90deg, #3a2eaa 0 8px, transparent 8px 10px); transition: width .2s; }

#tray-admin { cursor: pointer; }
