/* LXDE Desktop Preview
   Defaults from lxde-common: Clearlooks + nuoveXT2 + Openbox Clearlooks
   Panel from lxpanel default profile (height 26, bottom) */

:root {
  --panel-height: 26px;
  --panel-fg: #ffffff;
  --panel-fg-dim: #dddddd;

  /* Clearlooks / GTK2 light chrome */
  --gtk-bg: #edeceb;
  --gtk-bg-light: #f6f5f4;
  --gtk-bg-dark: #d3d1cf;
  --gtk-fg: #1a1a1a;
  --gtk-fg-dim: #555555;
  --gtk-border: #a1a1a1;
  --gtk-border-dark: #585a5d;
  --gtk-selected: #4a90d9;
  --gtk-selected-bg: #618ec4;
  --gtk-selected-fg: #ffffff;
  --gtk-entry: #ffffff;
  --gtk-hover: #dce6f3;
  --gtk-menu-bg: #ffffff;
  --gtk-menu-border: #aaaaaa;
  --gtk-menu-active-top: #97b8e2;
  --gtk-menu-active-bot: #80a7d6;
  --gtk-menu-active-border: #4b6e99;

  /* Openbox Clearlooks active title */
  --ob-active-top: #99bae3;
  --ob-active-mid: #8cb0dc;
  --ob-active-bot: #7aa1d1;
  --ob-active-sep: #4e76a8;
  --ob-active-text: #ffffff;
  --ob-inactive-top: #ebeae9;
  --ob-inactive-bot: #d5d3d1;
  --ob-inactive-text: #70747d;
  --ob-border: #585a5d;
  --ob-btn-border: #49678b;

  --font: "Noto Sans", "DejaVu Sans", "Sans", "Liberation Sans", system-ui, sans-serif;
  --wallpaper: url("assets/wallpapers/lxde_blue.jpg");
  --shadow: 0 4px 16px rgba(0, 0, 0, 0.45);
  --transition-fast: 80ms ease;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  font-family: var(--font);
  font-size: 11px;
  color: var(--gtk-fg);
  background: #001428;
  -webkit-font-smoothing: antialiased;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}

button:focus-visible {
  outline: 1px dotted #000;
  outline-offset: 1px;
}

img {
  display: block;
  user-select: none;
  -webkit-user-drag: none;
}

[hidden] {
  display: none !important;
}

/* ---------- Desktop shell ---------- */

.desktop {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

.wallpaper {
  position: absolute;
  inset: 0;
  background-color: #0055a5;
  background-image: var(--wallpaper);
  background-size: cover;
  background-position: center;
  z-index: 0;
}

/* ---------- Desktop icons ---------- */

.desktop-icons {
  position: absolute;
  top: 12px;
  left: 8px;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 78px;
}

.desk-icon {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 4px 2px;
  border-radius: 2px;
  color: #ffffff;
  text-shadow: 1px 1px 2px #000000, 0 0 3px #000000;
}

.desk-icon img {
  width: 48px;
  height: 48px;
  object-fit: contain;
}

.desk-icon span {
  font-size: 11px;
  text-align: center;
  line-height: 1.15;
  max-width: 74px;
  overflow: hidden;
  word-break: break-word;
  white-space: normal;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.desk-icon:hover,
.desk-icon.selected {
  background: rgba(74, 144, 217, 0.45);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
}

/* ---------- Bottom panel (lxpanel) ---------- */

.panel {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--panel-height);
  z-index: 50;
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  /* Matches lxpanel background.png gradient (1×26 strip) */
  background: linear-gradient(
    to bottom,
    #a3a3a3 0%,
    #6c6c6c 8%,
    #626262 15%,
    #595959 23%,
    #525252 31%,
    #484848 38%,
    #3f3f3f 46%,
    #383838 54%,
    #2c2c2c 62%,
    #252525 70%,
    #2d2d2d 77%,
    #3e3e3e 85%,
    #5a5a5a 92%,
    #8b8b8b 100%
  );
  border-top: 1px solid #b0b0b0;
  color: var(--panel-fg);
  user-select: none;
  box-shadow: 0 -1px 0 #1a1a1a;
}

.panel-left,
.panel-right {
  display: flex;
  align-items: stretch;
  min-width: 0;
}

.panel-left {
  flex: 1;
  gap: 0;
  padding-left: 0;
  overflow: hidden;
}

.panel-right {
  flex-shrink: 0;
  gap: 0;
  padding-right: 2px;
}

.panel-space {
  width: 4px;
  flex-shrink: 0;
}

.panel-menu-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  flex-shrink: 0;
  padding: 0 2px;
}

.panel-menu-btn:hover,
.panel-menu-btn[aria-expanded="true"] {
  background: rgba(255, 255, 255, 0.12);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.25);
}

.menu-logo {
  width: 28px;
  height: 20px;
  object-fit: contain;
}

.panel-launchers {
  display: flex;
  align-items: stretch;
  flex-shrink: 0;
}

.panel-launch {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  padding: 2px;
}

.panel-launch:hover {
  background: rgba(255, 255, 255, 0.12);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.2);
}

.panel-launch img {
  width: 20px;
  height: 20px;
  object-fit: contain;
}

.panel-wincmd {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  flex-shrink: 0;
}

.panel-wincmd:hover {
  background: rgba(255, 255, 255, 0.12);
}

.panel-wincmd img {
  width: 16px;
  height: 16px;
  object-fit: contain;
}

/* Pager */
.panel-pager {
  display: flex;
  align-items: stretch;
  gap: 1px;
  flex-shrink: 0;
  padding: 2px 1px;
}

.pager-desk {
  min-width: 18px;
  padding: 0 4px;
  font-size: 10px;
  color: #ddd;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid #222;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
  line-height: 1;
}

.pager-desk:hover {
  background: rgba(255, 255, 255, 0.12);
}

.pager-desk.active {
  background: linear-gradient(to bottom, #9ec0e8, #6a96cc);
  color: #fff;
  border-color: #3a5a88;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.35);
}

/* Taskbar */
.taskbar {
  display: flex;
  align-items: stretch;
  gap: 1px;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  padding: 2px 2px 2px 0;
}

.task-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  max-width: 150px;
  min-width: 60px;
  padding: 0 6px;
  flex: 0 1 auto;
  color: #f0f0f0;
  font-size: 11px;
  background: linear-gradient(to bottom, #6a6a6a 0%, #4a4a4a 50%, #3a3a3a 51%, #505050 100%);
  border: 1px solid #2a2a2a;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
  overflow: hidden;
  white-space: nowrap;
}

.task-btn img {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  object-fit: contain;
}

.task-btn span {
  overflow: hidden;
  text-overflow: ellipsis;
}

.task-btn:hover {
  background: linear-gradient(to bottom, #7a7a7a 0%, #555 50%, #454545 51%, #5a5a5a 100%);
}

.task-btn.active {
  background: linear-gradient(to bottom, #8cb0dc 0%, #6a96cc 50%, #5a86bc 51%, #709cd0 100%);
  border-color: #3a5a88;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.task-btn.minimized {
  opacity: 0.75;
  font-style: italic;
}

/* CPU applet */
.panel-cpu {
  display: flex;
  align-items: center;
  padding: 0 3px;
  flex-shrink: 0;
}

#cpu-canvas {
  display: block;
  background: #000;
  border: 1px solid #222;
  image-rendering: pixelated;
}

.panel-applet {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  flex-shrink: 0;
}

.panel-applet:hover {
  background: rgba(255, 255, 255, 0.1);
}

.panel-applet img {
  width: 16px;
  height: 16px;
  object-fit: contain;
}

.panel-tray {
  display: flex;
  align-items: stretch;
}

.panel-clock {
  display: flex;
  align-items: center;
  padding: 0 8px;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  color: #fff;
  text-shadow: 0 1px 1px #000;
  flex-shrink: 0;
  white-space: nowrap;
}

.panel-clock:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* ---------- Application menu (cascading) ---------- */

.app-menu {
  position: absolute;
  left: 0;
  bottom: var(--panel-height);
  z-index: 60;
  display: flex;
  align-items: flex-end;
  pointer-events: none;
}

.app-menu > * {
  pointer-events: auto;
}

.menu-panel {
  min-width: 180px;
  max-width: 260px;
  background: var(--gtk-menu-bg);
  border: 1px solid var(--gtk-menu-border);
  box-shadow: 1px 1px 3px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.4) inset;
  padding: 2px 0;
  color: var(--gtk-fg);
}

.menu-panel.submenu {
  position: absolute;
  left: 100%;
  bottom: 0;
  margin-left: -2px;
  z-index: 1;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 3px 10px 3px 6px;
  text-align: left;
  font-size: 11px;
  color: var(--gtk-fg);
  white-space: nowrap;
}

.menu-item:hover,
.menu-item.open {
  background: linear-gradient(
    to bottom,
    var(--gtk-menu-active-top) 0%,
    var(--gtk-menu-active-bot) 100%
  );
  color: #fff;
  box-shadow: inset 0 0 0 1px var(--gtk-menu-active-border);
}

.menu-ico {
  width: 16px;
  height: 16px;
  object-fit: contain;
  flex-shrink: 0;
}

.menu-item span:not(.menu-arrow) {
  flex: 1;
}

.menu-arrow {
  margin-left: 12px;
  font-size: 9px;
  opacity: 0.85;
}

.menu-sep {
  height: 1px;
  margin: 3px 4px;
  background: var(--gtk-menu-border);
  box-shadow: 0 1px 0 #fff;
}

/* ---------- Openbox Clearlooks window chrome ---------- */

.ob-window {
  position: absolute;
  z-index: 20;
  display: flex;
  flex-direction: column;
  background: var(--gtk-bg);
  border: 1px solid var(--ob-border);
  box-shadow: var(--shadow);
  color: var(--gtk-fg);
  overflow: hidden;
}

.ob-titlebar {
  display: flex;
  align-items: center;
  height: 22px;
  padding: 0 2px 0 6px;
  flex-shrink: 0;
  background: linear-gradient(
    to bottom,
    var(--ob-active-top) 0%,
    var(--ob-active-mid) 45%,
    var(--ob-active-bot) 100%
  );
  border-bottom: 1px solid var(--ob-active-sep);
  cursor: default;
  user-select: none;
}

.ob-title {
  flex: 1;
  font-size: 11px;
  font-weight: 600;
  color: var(--ob-active-text);
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.35);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ob-buttons {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.ob-btn {
  width: 18px;
  height: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  color: #f4f5f6;
  background: linear-gradient(to bottom, #b0caeb 0%, #92b4df 40%, #86abd9 100%);
  border: 1px solid var(--ob-btn-border);
  border-radius: 2px;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.3);
}

.ob-btn:hover {
  background: linear-gradient(to bottom, #b5d3ef, #9cbae7);
  color: #fff;
}

.ob-btn:active {
  background: #7aa1d2;
}

/* ---------- GTK buttons ---------- */

.gtk-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 72px;
  padding: 4px 12px;
  font-size: 11px;
  color: var(--gtk-fg);
  background: linear-gradient(to bottom, #f8f7f6 0%, #e8e6e4 50%, #ddd9d5 51%, #ebe8e5 100%);
  border: 1px solid #8e8a85;
  border-radius: 3px;
  box-shadow: inset 0 1px 0 #fff;
}

.gtk-btn:hover {
  background: linear-gradient(to bottom, #fff 0%, #f0eeec 50%, #e5e1dd 51%, #f4f2f0 100%);
}

.gtk-btn:active {
  background: #d5d1cd;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.15);
}

.gtk-btn-default {
  border-color: #4a78a8;
  box-shadow: inset 0 0 0 1px #a8c5e9, inset 0 1px 0 #fff;
}

.gtk-btn img {
  width: 16px;
  height: 16px;
}

/* ---------- Dialogs ---------- */

.dialog-backdrop {
  position: absolute;
  inset: 0;
  z-index: 70;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.25);
}

.run-window {
  width: 380px;
  position: relative;
}

.run-body {
  padding: 12px 14px 10px;
  background: var(--gtk-bg);
}

.run-prompt {
  margin: 0 0 10px;
  font-size: 11px;
}

.run-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}

.run-icon {
  width: 32px;
  height: 32px;
  object-fit: contain;
  flex-shrink: 0;
}

.run-input {
  flex: 1;
  height: 24px;
  padding: 2px 6px;
  font: inherit;
  font-size: 12px;
  color: var(--gtk-fg);
  background: var(--gtk-entry);
  border: 1px solid #8e8a85;
  border-radius: 2px;
  box-shadow: inset 1px 1px 2px rgba(0, 0, 0, 0.08);
}

.run-input:focus {
  outline: none;
  border-color: var(--gtk-selected);
}

.run-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.logout-window {
  width: 380px;
  position: relative;
}

.logout-body {
  padding: 10px 14px 12px;
  text-align: center;
  background: var(--gtk-bg);
}

.logout-banner {
  width: 100%;
  max-width: 352px;
  height: auto;
  margin: 0 auto 10px;
  display: block;
}

.logout-msg {
  margin: 0 0 14px;
  font-size: 12px;
}

.logout-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.logout-action {
  flex-direction: column;
  min-width: 80px;
  padding: 8px 10px;
}

.logout-action img {
  width: 24px;
  height: 24px;
}

/* ---------- PCManFM ---------- */

.pcm-window {
  top: 48px;
  left: 80px;
  width: 720px;
  height: 480px;
  z-index: 25;
}

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

.pcm-window.minimized {
  display: none !important;
}

.pcm-menubar {
  display: flex;
  align-items: stretch;
  height: 22px;
  background: var(--gtk-bg);
  border-bottom: 1px solid var(--gtk-border);
  flex-shrink: 0;
  padding: 0 2px;
}

.pcm-menubar-item {
  padding: 2px 8px;
  font-size: 11px;
  color: var(--gtk-fg);
}

.pcm-menubar-item:hover {
  background: var(--gtk-selected-bg);
  color: #fff;
}

.pcm-toolbar {
  display: flex;
  align-items: center;
  gap: 2px;
  height: 30px;
  padding: 2px 4px;
  background: linear-gradient(to bottom, #f4f3f2, #e4e2e0);
  border-bottom: 1px solid var(--gtk-border);
  flex-shrink: 0;
}

.pcm-tb-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 24px;
  border-radius: 2px;
}

.pcm-tb-btn:hover {
  background: var(--gtk-hover);
  box-shadow: inset 0 0 0 1px #8aa8cc;
}

.pcm-tb-btn:disabled {
  opacity: 0.4;
  pointer-events: none;
}

.pcm-tb-btn img {
  width: 18px;
  height: 18px;
  object-fit: contain;
}

.pcm-tb-sep {
  width: 1px;
  height: 18px;
  margin: 0 3px;
  background: var(--gtk-border);
  box-shadow: 1px 0 0 #fff;
}

.pcm-path-wrap {
  flex: 1;
  min-width: 0;
  margin-left: 4px;
}

.pcm-path {
  width: 100%;
  height: 22px;
  padding: 1px 6px;
  font: inherit;
  font-size: 11px;
  color: var(--gtk-fg);
  background: var(--gtk-entry);
  border: 1px solid #8e8a85;
  border-radius: 2px;
  box-shadow: inset 1px 1px 1px rgba(0, 0, 0, 0.06);
}

.pcm-body {
  display: flex;
  flex: 1;
  min-height: 0;
  background: #fff;
}

.pcm-sidebar {
  width: 160px;
  flex-shrink: 0;
  overflow-y: auto;
  background: #f0efed;
  border-right: 1px solid var(--gtk-border);
  padding: 4px 0;
}

.pcm-side-item {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 3px 8px;
  text-align: left;
  font-size: 11px;
  color: var(--gtk-fg);
}

.pcm-side-item img {
  width: 16px;
  height: 16px;
  object-fit: contain;
  flex-shrink: 0;
}

.pcm-side-item:hover {
  background: var(--gtk-hover);
}

.pcm-side-item.active {
  background: var(--gtk-selected-bg);
  color: #fff;
}

.pcm-side-heading {
  padding: 6px 8px 2px;
  font-size: 10px;
  font-weight: 700;
  color: var(--gtk-fg-dim);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.pcm-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: #fff;
}

.pcm-content {
  flex: 1;
  overflow: auto;
  padding: 8px;
}

.pcm-content.view-icons {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 4px 8px;
}

.pcm-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 88px;
  padding: 6px 4px;
  border-radius: 2px;
  border: 1px solid transparent;
  color: var(--gtk-fg);
  text-align: center;
}

.pcm-item img {
  width: 48px;
  height: 48px;
  object-fit: contain;
  margin-bottom: 4px;
}

.pcm-item span {
  font-size: 11px;
  line-height: 1.2;
  max-width: 80px;
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.pcm-item:hover {
  background: var(--gtk-hover);
  border-color: #a8c0dc;
}

.pcm-item.selected {
  background: var(--gtk-selected-bg);
  border-color: #3a6a9e;
  color: #fff;
}

.pcm-statusbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 20px;
  padding: 0 8px;
  font-size: 11px;
  color: var(--gtk-fg);
  background: var(--gtk-bg);
  border-top: 1px solid var(--gtk-border);
  flex-shrink: 0;
}

.pcm-status-free {
  color: var(--gtk-fg-dim);
}

/* ---------- LXTerminal ---------- */

.term-window {
  top: 100px;
  left: 200px;
  width: 560px;
  height: 340px;
  z-index: 24;
}

.term-window.maximized {
  top: 0 !important;
  left: 0 !important;
  width: 100vw !important;
  height: calc(100vh - var(--panel-height)) !important;
}

.term-window.minimized {
  display: none !important;
}

.term-body {
  flex: 1;
  min-height: 0;
  background: #000000;
  overflow: auto;
}

.term-output {
  margin: 0;
  padding: 6px 8px;
  font-family: "DejaVu Sans Mono", "Noto Sans Mono", "Liberation Mono", monospace;
  font-size: 12px;
  line-height: 1.35;
  color: #00ff00;
  white-space: pre-wrap;
  word-break: break-all;
}

.term-cursor {
  animation: blink 1s step-end infinite;
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

/* ---------- Volume popup ---------- */

.volume-popup {
  position: absolute;
  bottom: calc(var(--panel-height) + 4px);
  right: 80px;
  z-index: 55;
  padding: 8px 10px;
  background: var(--gtk-menu-bg);
  border: 1px solid var(--gtk-menu-border);
  box-shadow: var(--shadow);
  min-width: 180px;
}

.volume-popup-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.volume-popup-row img {
  width: 20px;
  height: 20px;
}

#volume-slider {
  flex: 1;
  accent-color: var(--gtk-selected-bg);
}

#volume-label {
  min-width: 24px;
  text-align: right;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

/* ---------- Toast ---------- */

.toast {
  position: absolute;
  bottom: calc(var(--panel-height) + 16px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 80;
  padding: 6px 14px;
  background: rgba(30, 30, 30, 0.9);
  color: #fff;
  border-radius: 3px;
  font-size: 12px;
  box-shadow: var(--shadow);
  pointer-events: none;
}

/* ---------- Dragging ---------- */

.ob-window.dragging {
  opacity: 0.95;
  user-select: none;
}
