/* Desktop shell: stage, wallpaper, icons, windows, panel, menu, popups, notifications, OSD */

#stage { position: fixed; inset: 0; overflow: hidden; background: #000; }

.desktop { position: absolute; inset: 0; outline: none; overflow: hidden; }
.wallpaper {
  position: absolute; inset: 0; background-size: cover; background-position: center;
  transition: background-image 0.4s ease, background 0.4s ease;
}
.nightlight {
  position: absolute; inset: 0; pointer-events: none; z-index: 400;
  background: rgba(255, 140, 40, 0.16); mix-blend-mode: multiply;
  opacity: 0; transition: opacity 0.6s ease;
}
.nightlight.on { opacity: 1; }

/* ---------- Desktop icons ---------- */
.desktop-icons { position: absolute; inset: 0; padding: 8px; z-index: 1; }
.desk-icon {
  position: absolute; width: 92px; padding: 6px 4px 4px;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  border-radius: 6px; user-select: none; cursor: default;
  transition: background 0.08s;
}
.desk-icon .icon-wrap { width: 48px; height: 48px; filter: drop-shadow(0 2px 2px rgba(0,0,0,0.5)); }
.desk-icon .icon-wrap svg { width: 100%; height: 100%; }
.desk-icon .label {
  font-size: 12.5px; color: #fff; text-align: center; line-height: 1.2;
  text-shadow: 0 1px 2px rgba(0,0,0,0.85), 0 0 8px rgba(0,0,0,0.55);
  padding: 1px 4px; border-radius: 4px;
  max-width: 92px; overflow-wrap: break-word;
}
.desk-icon:hover { background: rgba(255,255,255,0.10); }
.desk-icon.selected { background: color-mix(in srgb, var(--accent) 45%, transparent); outline: 1px solid rgba(255,255,255,0.25); }
.desk-icon.selected .label { text-shadow: 0 1px 2px rgba(0,0,0,0.6); }
.desk-icon.dragging { opacity: 0.75; z-index: 50; }
.rubber-band {
  position: absolute; z-index: 40; pointer-events: none;
  border: 1px solid rgba(255,255,255,0.75);
  background: color-mix(in srgb, var(--accent) 22%, transparent);
}

/* ---------- Windows ---------- */
.windows-layer { position: absolute; inset: 0; z-index: 5; pointer-events: none; }
.window {
  position: absolute; pointer-events: auto;
  display: flex; flex-direction: column;
  min-width: 240px; min-height: 150px;
  border-radius: var(--win-radius) var(--win-radius) 5px 5px;
  background: var(--bg);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: opacity 0.14s ease, transform 0.14s ease, box-shadow 0.2s ease, filter 0.2s;
}
.window.focused { box-shadow: var(--shadow-big); }
.window.unfocused { filter: saturate(0.92); }
.window.unfocused .titlebar { background: var(--header-backdrop); }
.window.unfocused .titlebar .title { color: var(--fg-dim); }
.window.unfocused .titlebar .win-btn svg { opacity: 0.45; }
.window.maximized, .window.tiled { border-radius: 0; }
.window.opening { animation: win-open 0.18s cubic-bezier(0.2, 0.9, 0.3, 1); }
.window.closing { opacity: 0; transform: scale(0.94); pointer-events: none; }
.window.minimizing { opacity: 0; pointer-events: none; transition: opacity 0.24s ease, transform 0.24s ease; }
.window.minimized { display: none; }
.window.snapping { transition: left 0.18s ease, top 0.18s ease, width 0.18s ease, height 0.18s ease; }
@keyframes win-open {
  from { opacity: 0; transform: scale(0.92) translateY(12px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.titlebar {
  height: var(--titlebar-h); flex: none;
  display: flex; align-items: center; gap: 6px;
  padding: 0 4px 0 8px;
  background: var(--header);
  border-bottom: 1px solid var(--separator);
  box-shadow: 0 1px 0 rgba(255,255,255,0.5) inset;
  user-select: none;
}
body[data-theme='dark'] .titlebar { box-shadow: 0 1px 0 rgba(255,255,255,0.04) inset; }
.titlebar .app-icon { width: 16px; height: 16px; flex: none; }
.titlebar .app-icon svg { width: 100%; height: 100%; }
.titlebar .title {
  flex: 1; font-size: 12.5px; font-weight: 700; color: var(--fg);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  text-align: center; padding-right: 60px;
}
.titlebar .win-btns { display: flex; align-self: stretch; }
.win-btn {
  width: 26px; display: flex; align-items: center; justify-content: center;
  align-self: stretch;
  transition: background 0.1s;
}
.win-btn svg { width: 16px; height: 16px; opacity: 0.75; }
.win-btn:hover { background: rgba(0,0,0,0.08); }
.win-btn:hover svg { opacity: 1; }
body[data-theme='dark'] .win-btn:hover { background: rgba(255,255,255,0.08); }
.win-btn.close:hover { background: var(--accent); }
.win-btn.close:hover svg { opacity: 1; }
.win-btn:active { background: var(--accent-active); }
.window.dragging, .window.resizing { transition: none; }
.window.dragging { box-shadow: var(--shadow-big); }

.win-body { flex: 1; display: flex; flex-direction: column; overflow: hidden; position: relative; min-height: 0; }

.resize-handle { position: absolute; z-index: 30; }
.rh-n { top: -4px; left: 10px; right: 10px; height: 8px; cursor: ns-resize; }
.rh-s { bottom: -4px; left: 10px; right: 10px; height: 8px; cursor: ns-resize; }
.rh-e { right: -4px; top: 10px; bottom: 10px; width: 8px; cursor: ew-resize; }
.rh-w { left: -4px; top: 10px; bottom: 10px; width: 8px; cursor: ew-resize; }
.rh-ne { top: -4px; right: -4px; width: 14px; height: 14px; cursor: nesw-resize; }
.rh-nw { top: -4px; left: -4px; width: 14px; height: 14px; cursor: nwse-resize; }
.rh-se { bottom: -4px; right: -4px; width: 14px; height: 14px; cursor: nwse-resize; }
.rh-sw { bottom: -4px; left: -4px; width: 14px; height: 14px; cursor: nesw-resize; }

.snap-preview {
  position: absolute; z-index: 20; pointer-events: none;
  background: color-mix(in srgb, var(--accent) 26%, rgba(20,30,24,0.5));
  border: 2px solid rgba(255,255,255,0.55);
  border-radius: 6px;
  opacity: 0; transition: all 0.14s ease;
}
.snap-preview.show { opacity: 1; }

/* ---------- Panel ---------- */
.panel {
  position: absolute; left: 0; right: 0; bottom: 0; height: 40px;
  background: linear-gradient(180deg, var(--panel-bg) 0%, #1f1f23 100%);
  border-top: 1px solid #35353b;
  box-shadow: 0 -1px 6px rgba(0,0,0,0.35);
  display: flex; align-items: stretch;
  z-index: 200; color: var(--panel-fg);
  font-size: 13px;
  user-select: none;
}
.panel.panel-top { top: 0; bottom: auto; border-top: none; border-bottom: 1px solid #131316; box-shadow: 0 1px 6px rgba(0,0,0,0.35); flex-direction: column; }
.panel.autohide { transform: translateY(calc(100% - 1px)); transition: transform 0.25s ease; }
.panel.autohide.reveal { transform: translateY(0); }
.panel.panel-top.autohide { transform: translateY(-100%); }
.panel.panel-top.autohide.reveal { transform: translateY(0); }

.applet {
  display: flex; align-items: center; padding: 0 6px; position: relative;
  border-radius: 4px; margin: 3px 0; align-self: stretch;
  transition: background 0.12s;
}
.applet:hover { background: rgba(255,255,255,0.12); }
.applet.active { background: rgba(255,255,255,0.22); }
.applet .applet-icon { width: 22px; height: 22px; }
.applet .applet-icon svg { width: 100%; height: 100%; }
.applet.vertical { flex-direction: column; padding: 6px 0; margin: 0 3px; }
.applet.vertical .applet-icon { width: 20px; height: 20px; }

#menu-button { padding: 0 9px; }
#menu-button .applet-icon { width: 24px; height: 24px; }
#menu-button:hover .mint-leaf path { fill: #ffffff; }
#menu-button.open .mint-leaf path { fill: var(--accent-light, #6fd88a); }
#menu-button .mint-leaf path { fill: #cfcfcf; transition: fill 0.12s; }
#menu-button:hover .mint-leaf, #menu-button.open .mint-leaf { filter: drop-shadow(0 0 4px rgba(53,168,84,0.35)); }
#menu-button.open { background: rgba(255,255,255,0.18); }

.panel-sep { width: 1px; background: rgba(255,255,255,0.16); margin: 6px 3px; }

#window-list { flex: 1; display: flex; align-items: stretch; gap: 3px; padding: 0 4px; overflow: hidden; }
.task-btn {
  display: flex; align-items: center; gap: 6px;
  min-width: 40px; max-width: 164px;
  padding: 0 9px; margin: 4px 0;
  border-radius: 4px;
  background: rgba(255,255,255,0.07);
  box-shadow: 0 1px 0 rgba(0,0,0,0.25) inset, 0 1px 0 rgba(255,255,255,0.06);
  color: var(--panel-fg);
  overflow: hidden; white-space: nowrap;
  transition: background 0.12s;
}
.task-btn:hover { background: rgba(255,255,255,0.16); }
.task-btn.active { background: rgba(255,255,255,0.26); box-shadow: 0 2px 0 var(--accent) inset, 0 1px 0 rgba(0,0,0,0.25) inset; }
.task-btn.focused { background: rgba(255,255,255,0.32); }
.task-btn .app-icon { width: 16px; height: 16px; flex: none; }
.task-btn .app-icon svg { width: 100%; height: 100%; }
.task-btn .win-title { font-size: 12px; overflow: hidden; text-overflow: ellipsis; }
.task-btn.minimizing-anim { animation: task-pulse 0.35s ease; }
@keyframes task-pulse { 0% { background: color-mix(in srgb, var(--accent) 55%, transparent); } 100% { background: rgba(255,255,255,0.07); } }

.workspace-applet { display: flex; align-items: center; gap: 5px; padding: 0 10px; }
.workspace-applet .ws-tile {
  width: 26px; height: 17px; border-radius: 3px;
  background: rgba(255,255,255,0.13);
  border: 1px solid rgba(255,255,255,0.28);
  transition: all 0.15s;
  display: flex; align-items: center; justify-content: center; gap: 1px; flex-wrap: wrap; padding: 1px 2px;
}
.workspace-applet .ws-tile .mini-win { width: 5px; height: 5px; border-radius: 1px; background: rgba(255,255,255,0.75); }
.workspace-applet .ws-tile.current { background: color-mix(in srgb, var(--accent) 55%, transparent); border-color: color-mix(in srgb, var(--accent) 85%, white); }

.tray { display: flex; align-items: stretch; }
.tray .applet { padding: 0 5px; }
.clock-applet { padding: 0 10px; font-size: 12.5px; gap: 6px; }
.clock-applet .clock-label { white-space: nowrap; }

.show-desk { width: 10px; margin: 4px 3px 4px 0; border-left: 1px dotted rgba(255,255,255,0.35); }
.show-desk:hover { background: rgba(255,255,255,0.12); border-radius: 0 4px 4px 0; }

/* ---------- Popup layer (menus, applet popovers) ---------- */
.menu-layer, .popup-layer { position: absolute; inset: 0; z-index: 500; pointer-events: none; }
.menu-layer > *, .popup-layer > * { pointer-events: auto; }

.gtk-menu {
  position: absolute;
  min-width: 180px;
  background: var(--base);
  border: 1px solid var(--borders);
  border-radius: 6px;
  box-shadow: var(--shadow-big);
  padding: 4px 0;
  font-size: 13px;
  color: var(--text);
  animation: menu-fade 0.12s ease-out;
}
@keyframes menu-fade { from { opacity: 0; transform: translateY(2px); } to { opacity: 1; transform: none; } }
.gtk-menu .menu-item {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 14px 5px 10px; margin: 0 4px; border-radius: 4px;
  white-space: nowrap; user-select: none;
}
.gtk-menu .menu-item:hover:not(.disabled) { background: var(--accent); color: var(--accent-fg); }
.gtk-menu .menu-item:hover:not(.disabled) svg { color: var(--accent-fg); }
.gtk-menu .menu-item.disabled { opacity: 0.45; }
.gtk-menu .menu-item .mi-icon { width: 16px; height: 16px; flex: none; }
.gtk-menu .menu-item .mi-icon svg { width: 100%; height: 100%; }
.gtk-menu .menu-item .mi-label { flex: 1; }
.gtk-menu .menu-item .mi-accel { color: var(--fg-dim); font-size: 12px; padding-left: 18px; }
.gtk-menu .menu-item:hover:not(.disabled) .mi-accel { color: color-mix(in srgb, var(--accent-fg) 80%, transparent); }
.gtk-menu .menu-sep { height: 1px; background: var(--separator); margin: 4px 8px; }

.popover {
  position: absolute;
  background: var(--base);
  border: 1px solid var(--borders);
  border-radius: 8px;
  box-shadow: var(--shadow-big);
  animation: menu-fade 0.14s ease-out;
}

/* calendar popup */
.calendar-pop { width: 300px; padding: 12px 14px 14px; }
.calendar-pop .cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.calendar-pop .cal-title { font-weight: 700; font-size: 13.5px; }
.calendar-pop .cal-nav { display: flex; gap: 2px; }
.calendar-pop .cal-nav button {
  width: 26px; height: 26px; border-radius: 4px; display: flex; align-items: center; justify-content: center;
}
.calendar-pop .cal-nav button:hover { background: var(--button-bg-hover); border: 1px solid var(--button-border); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; text-align: center; }
.cal-grid .dow { font-size: 11px; color: var(--fg-dim); padding: 4px 0; font-weight: 700; }
.cal-grid .day {
  height: 30px; display: flex; align-items: center; justify-content: center;
  border-radius: 50%; font-size: 12.5px; user-select: none;
}
.cal-grid .day.other { color: var(--fg-dim); }
.cal-grid .day:hover:not(.other-month-label) { background: color-mix(in srgb, var(--accent) 22%, transparent); }
.cal-grid .day.today { background: var(--accent); color: var(--accent-fg); font-weight: 700; }
.cal-grid .day.selected-day { outline: 2px solid var(--accent); }

/* ---------- Mint Menu ---------- */
.mint-menu {
  position: absolute;
  left: 6px; bottom: 46px;
  width: 660px; height: 520px;
  background: var(--base);
  border: 1px solid var(--borders);
  border-radius: 9px;
  box-shadow: var(--shadow-big);
  display: flex; flex-direction: column;
  overflow: hidden;
  color: var(--text);
  animation: menu-open 0.16s cubic-bezier(0.2, 0.9, 0.3, 1);
}
@keyframes menu-open { from { opacity: 0; transform: translateY(14px) scale(0.98); } to { opacity: 1; transform: none; } }
.mint-menu.closing { opacity: 0; transform: translateY(8px); transition: all 0.12s ease; }

.mint-menu .menu-top { flex: 1; display: flex; min-height: 0; }
.fav-col {
  width: 62px; flex: none;
  background: var(--header);
  border-right: 1px solid var(--separator);
  display: flex; flex-direction: column; align-items: center;
  padding: 8px 0 6px; gap: 2px;
}
.fav-col .fav-btn {
  width: 46px; height: 46px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.1s;
}
.fav-col .fav-btn:hover { background: color-mix(in srgb, var(--accent) 20%, transparent); }
.fav-col .fav-btn svg { width: 30px; height: 30px; }
.fav-col .fav-spacer { flex: 1; }
.fav-col .all-apps-btn {
  width: 46px; height: 46px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: var(--fg-dim);
}
.fav-col .all-apps-btn:hover { background: color-mix(in srgb, var(--accent) 20%, transparent); }
.fav-col .all-apps-btn svg { width: 24px; height: 24px; }
.fav-col .all-apps-btn.active { background: var(--accent); color: #fff; }

.cat-col {
  width: 168px; flex: none; overflow-y: auto;
  border-right: 1px solid var(--separator);
  padding: 6px 4px;
}
.cat-item {
  display: flex; align-items: center; gap: 9px;
  padding: 6px 10px; margin: 1px 2px; border-radius: 4px;
  font-size: 13px; user-select: none;
  transition: background 0.06s;
}
.cat-item svg { width: 16px; height: 16px; flex: none; opacity: 0.8; }
.cat-item:hover { background: color-mix(in srgb, var(--accent) 16%, var(--base)); }
.cat-item.selected { background: var(--accent); color: var(--accent-fg); font-weight: 700; }
.cat-item.selected svg { opacity: 1; }

.app-col { flex: 1; overflow-y: auto; padding: 6px; }
.app-item {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 10px; margin: 1px 0; border-radius: 4px;
  user-select: none;
}
.app-item .app-ic { width: 28px; height: 28px; flex: none; }
.app-item .app-ic svg { width: 100%; height: 100%; }
.app-item .app-name { font-size: 13px; line-height: 1.25; }
.app-item .app-desc { font-size: 11px; color: var(--fg-dim); line-height: 1.2; }
.app-item:hover { background: var(--accent); color: var(--accent-fg); }
.app-item:hover .app-desc { color: color-mix(in srgb, var(--accent-fg) 75%, transparent); }
.menu-empty { padding: 24px; text-align: center; color: var(--fg-dim); font-size: 14px; }

.menu-bottom {
  flex: none; height: 46px;
  display: flex; align-items: center; gap: 8px;
  padding: 0 10px;
  background: var(--header);
  border-top: 1px solid var(--separator);
}
.menu-bottom .search-box { flex: 1; position: relative; }
.menu-bottom .search-box svg {
  position: absolute; left: 9px; top: 50%; transform: translateY(-50%);
  width: 15px; height: 15px; color: var(--fg-dim); pointer-events: none;
}
.menu-bottom input {
  width: 100%; height: 32px; padding: 0 10px 0 32px;
  border-radius: 5px; border: 1px solid var(--borders);
  background: var(--base); color: var(--text); outline: none; font-size: 13px;
}
.menu-bottom input:focus { border-color: var(--accent); }
.session-btns { display: flex; gap: 4px; }
.session-btn {
  width: 34px; height: 34px; border-radius: 5px;
  display: flex; align-items: center; justify-content: center; color: var(--fg);
}
.session-btn svg { width: 17px; height: 17px; }
.session-btn:hover { background: color-mix(in srgb, var(--accent) 20%, var(--header)); }

/* ---------- Notifications ---------- */
.notifications {
  position: absolute; top: 10px; right: 10px; z-index: 350;
  display: flex; flex-direction: column; gap: 8px; width: 340px;
  pointer-events: none;
}
.notification {
  pointer-events: auto;
  display: flex; gap: 10px; align-items: flex-start;
  background: var(--osd-bg);
  color: var(--osd-fg);
  border-radius: 8px;
  padding: 10px 12px;
  box-shadow: var(--shadow-big);
  border: 1px solid rgba(255,255,255,0.08);
  animation: notif-in 0.28s cubic-bezier(0.2, 0.9, 0.3, 1.05);
  cursor: default;
}
.notification.closing { opacity: 0; transform: translateX(30px); transition: all 0.22s ease; }
@keyframes notif-in { from { opacity: 0; transform: translateX(40px); } to { opacity: 1; transform: none; } }
.notification .n-icon { width: 26px; height: 26px; flex: none; margin-top: 1px; }
.notification .n-icon svg { width: 100%; height: 100%; }
.notification .n-title { font-weight: 700; font-size: 13px; }
.notification .n-body { font-size: 12.5px; opacity: 0.9; line-height: 1.3; margin-top: 1px; }
.notification .n-close { flex: none; opacity: 0.5; padding: 2px; }
.notification .n-close:hover { opacity: 1; }

/* ---------- OSD ---------- */
.osd-layer { position: absolute; inset: 0; z-index: 600; pointer-events: none; }
.osd {
  position: absolute; bottom: 56px; left: 50%; transform: translateX(-50%);
  background: var(--osd-bg); color: var(--osd-fg);
  border-radius: 10px;
  padding: 10px 14px;
  display: flex; align-items: center; gap: 12px;
  box-shadow: var(--shadow-big);
  animation: osd-in 0.15s ease-out;
}
.osd.hiding { opacity: 0; transition: opacity 0.3s ease; }
@keyframes osd-in { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }
.osd svg { width: 26px; height: 26px; }
.osd .osd-bar { width: 140px; height: 7px; border-radius: 4px; background: rgba(255,255,255,0.25); overflow: hidden; }
.osd .osd-bar i { display: block; height: 100%; background: #6db442; border-radius: 4px; transition: width 0.1s; }

/* ---------- Alt-Tab ---------- */
.alttab-layer { position: absolute; inset: 0; z-index: 700; display: none; }
.alttab-layer.show { display: flex; align-items: center; justify-content: center; }
.alttab-box {
  background: var(--osd-bg);
  border-radius: 12px;
  padding: 16px;
  display: flex; flex-wrap: wrap; gap: 10px; max-width: 70%;
  box-shadow: var(--shadow-big);
}
.alttab-item {
  width: 92px; height: 92px; border-radius: 9px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  color: var(--osd-fg); font-size: 11px; padding: 4px;
}
.alttab-item svg { width: 42px; height: 42px; }
.alttab-item span { max-width: 84px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.alttab-item.sel { background: var(--accent); color: #fff; }

/* ---------- Tooltips ---------- */
.tooltip {
  position: fixed; z-index: 9000;
  background: var(--tooltip-bg); color: var(--tooltip-fg);
  font-size: 12px; padding: 4px 9px; border-radius: 4px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.4);
  pointer-events: none; max-width: 280px;
  animation: menu-fade 0.1s ease-out;
}

/* ---------- Dialogs ---------- */
.modal-scrim { position: absolute; inset: 0; z-index: 800; background: rgba(0,0,0,0.25); animation: menu-fade 0.12s; }
.gtk-dialog {
  position: absolute; z-index: 801;
  min-width: 340px; max-width: 440px;
  background: var(--bg);
  border: 1px solid var(--borders);
  border-radius: var(--win-radius);
  box-shadow: var(--shadow-big);
  overflow: hidden;
  animation: win-open 0.15s ease-out;
}
.gtk-dialog .dialog-body { display: flex; gap: 14px; padding: 18px 18px 14px; align-items: flex-start; }
.gtk-dialog .dialog-icon { width: 42px; height: 42px; flex: none; }
.gtk-dialog .dialog-icon svg { width: 100%; height: 100%; }
.gtk-dialog .dialog-text { font-size: 13.5px; line-height: 1.4; }
.gtk-dialog .dialog-text .primary { font-weight: 700; font-size: 14.5px; margin-bottom: 4px; }
.gtk-dialog .dialog-text .secondary { color: var(--fg-dim); margin-top: 6px; }
.gtk-dialog .dialog-buttons {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 10px 14px 14px;
}
.gtk-dialog .dialog-entry { padding: 0 18px 6px; display: flex; gap: 8px; align-items: center; }
.gtk-dialog .dialog-entry input { flex: 1; }

/* workspace switching animation */
.workspace-ghost { position: absolute; inset: 0; z-index: 15; pointer-events: none; opacity: 0; background: rgba(255,255,255,0.05); transition: opacity 0.18s; }
.workspace-ghost.slide-left { animation: ws-l 0.22s ease; }
.workspace-ghost.slide-right { animation: ws-r 0.22s ease; }
@keyframes ws-l { from { opacity: 1; transform: translateX(24px); } to { opacity: 0; transform: none; } }
@keyframes ws-r { from { opacity: 1; transform: translateX(-24px); } to { opacity: 0; transform: none; } }
