/* BeOS R5 / Haiku (Iconic Yellow Tab) Window Manager Skin */
[data-wm-style="beos"].webos-window,
[data-wm-style="beos"].webos-window.is-active {
  border-radius: 0;
  border: none !important;
  box-shadow: none !important;
  background: transparent !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  overflow: visible;
}

[data-wm-style="beos"] > .window-header {
  background: transparent !important;
  border: none !important;
  border-bottom: none !important;
  box-shadow: none !important;
  height: 22px;
  min-height: 22px;
  padding: 0;
  display: flex;
  align-items: stretch;
  justify-content: flex-start;
  position: relative;
  overflow: visible;
  user-select: none;
  pointer-events: none; /* Transparent area lets clicks pass right through */
}

/* Allow buttons inside .window-traffic-lights to participate directly in tab layout */
[data-wm-style="beos"] > .window-header > .window-traffic-lights {
  display: contents;
}

/* Tab components have pointer-events enabled and overlap window body top edge by 1px */
[data-wm-style="beos"] > .window-header .win-btn.win-close,
[data-wm-style="beos"] > .window-header > .window-title-group,
[data-wm-style="beos"] > .window-header .win-btn.win-maximize {
  pointer-events: auto;
  position: relative;
  z-index: 2;
  margin-bottom: -1px;
  background: #ffc400;
  border-top: 1px solid #333333;
  border-bottom: 1px solid #ffc400;
}

/* Inactive window tab: classic BeOS muted gold */
[data-wm-style="beos"].webos-window:not(.is-active) > .window-header .win-btn.win-close,
[data-wm-style="beos"].webos-window:not(.is-active) > .window-header > .window-title-group,
[data-wm-style="beos"].webos-window:not(.is-active) > .window-header .win-btn.win-maximize {
  background: #d0c490;
  border-bottom-color: #d0c490;
}

/* 1. BeOS Close Box (Left side of the Yellow Tab) */
[data-wm-style="beos"] > .window-header .win-btn.win-close {
  order: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 22px;
  width: auto;
  min-width: 24px;
  margin: 0;
  padding: 0 4px 0 6px;
  border-radius: 0;
  border-left: 1px solid #333333;
  border-right: none;
  box-shadow: inset 1px 1px 0 #ffffff;
  transform: none !important;
  filter: none !important;
  cursor: pointer;
}

[data-wm-style="beos"] > .window-header .win-btn.win-close::before {
  content: '';
  display: block;
  width: 12px;
  height: 12px;
  background: #cbcbcb;
  border: 1px solid #333333;
  box-shadow: inset 1px 1px 0 #ffffff, inset -1px -1px 0 #737373;
  box-sizing: border-box;
}

[data-wm-style="beos"] > .window-header .win-btn.win-close::after {
  content: '';
  position: absolute;
  width: 4px;
  height: 4px;
  background: #737373;
}

[data-wm-style="beos"] > .window-header .win-btn.win-close:active::before {
  background: #333333;
  box-shadow: inset 1px 1px 0 #000000, inset -1px -1px 0 #ffffff;
}

[data-wm-style="beos"] > .window-header .win-btn.win-close:active::after {
  background: #ffffff;
}

/* 2. BeOS Title (Middle of the Yellow Tab) */
[data-wm-style="beos"] > .window-header > .window-title-group {
  order: 2;
  display: flex;
  align-items: center;
  gap: 5px;
  height: 22px;
  margin: 0;
  padding: 0 6px;
  border-left: none;
  border-right: none;
  box-shadow: inset 0 1px 0 #ffffff;
  color: #000000;
  font-family: "DejaVu Sans", "Lucida Sans", "Segoe UI", Arial, sans-serif;
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.2px;
  max-width: none;
  cursor: grab;
}

[data-wm-style="beos"] > .window-header > .window-title-group > .window-title-text {
  color: #000000;
  font-weight: 700;
}

[data-wm-style="beos"].webos-window:not(.is-active) > .window-header > .window-title-group > .window-title-text {
  color: #333333;
}

[data-wm-style="beos"] > .window-header > .window-title-group > .window-icon {
  font-size: 12px;
}

/* 3. BeOS Zoom Gadget (Right side of the Yellow Tab) */
[data-wm-style="beos"] > .window-header .win-btn.win-maximize {
  order: 3;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 22px;
  width: auto;
  min-width: 24px;
  margin: 0;
  padding: 0 6px 0 4px;
  border-radius: 0;
  border-left: none;
  border-right: 1px solid #333333;
  box-shadow: inset 0 1px 0 #ffffff, inset -1px 0 0 #8a6c00;
  transform: none !important;
  filter: none !important;
  cursor: pointer;
}

[data-wm-style="beos"] > .window-header .win-btn.win-maximize::before {
  content: '';
  display: block;
  width: 12px;
  height: 12px;
  background: #cbcbcb;
  border: 1px solid #333333;
  box-shadow: inset 1px 1px 0 #ffffff, inset -1px -1px 0 #737373;
  box-sizing: border-box;
}

[data-wm-style="beos"] > .window-header .win-btn.win-maximize::after {
  content: '';
  position: absolute;
  width: 6px;
  height: 6px;
  border: 1px solid #333333;
  box-sizing: border-box;
}

[data-wm-style="beos"] > .window-header .win-btn.win-maximize:active::before {
  background: #333333;
  box-shadow: inset 1px 1px 0 #000000, inset -1px -1px 0 #ffffff;
}

[data-wm-style="beos"] > .window-header .win-btn.win-maximize:active::after {
  border-color: #ffffff;
}

/* 4. BeOS Window Actions (Floating toolbar in top right if actions present) */
[data-wm-style="beos"] > .window-header > .window-header-actions:not(:empty) {
  order: 4;
  margin-left: auto;
  margin-right: 6px;
  pointer-events: auto;
  background: #d8d8d8;
  border: 1px solid #333333;
  box-shadow: inset 1px 1px 0 #ffffff, inset -1px -1px 0 #737373;
  padding: 0 6px;
  height: 20px;
  display: flex;
  align-items: center;
}

[data-wm-style="beos"] > .window-header > .window-header-actions:empty {
  display: none;
}

/* BeOS minimize is hidden from the tab bar (double clicking tab collapses/shades in BeOS) */
[data-wm-style="beos"] > .window-header .win-btn.win-minimize {
  display: none;
}

/* Clear default button text/color */
[data-wm-style="beos"] > .window-header .win-btn {
  color: transparent !important;
  font-size: 0 !important;
}

/* BeOS Window Body — The Main Window Frame with 3D Border */
[data-wm-style="beos"] > .window-body {
  border: 1px solid #333333;
  box-shadow: inset 1px 1px 0 #ffffff, inset -1px -1px 0 #737373, 2px 2px 0 rgba(0, 0, 0, 0.4), 0 14px 40px rgba(0, 0, 0, 0.5);
  background: var(--window-bg, #ffffff);
  color: var(--text-main, #111111);
  position: relative;
  z-index: 1;
}

[data-wm-style="beos"].webos-window.is-active > .window-body {
  box-shadow: inset 1px 1px 0 #ffffff, inset -1px -1px 0 #737373, 2px 2px 0 rgba(0, 0, 0, 0.5), 0 18px 45px rgba(0, 0, 0, 0.65);
}

[data-theme="dark-glass"][data-wm-style="beos"] > .window-body,
[data-theme="cyberpunk"][data-wm-style="beos"] > .window-body {
  background: #1e1e24;
  color: #e2e8f0;
}

/* BeOS Bottom-Right Resize Gadget */
[data-wm-style="beos"] .win-resize-handle.res-se {
  width: 14px;
  height: 14px;
  bottom: 1px;
  right: 1px;
  background: repeating-linear-gradient(-45deg, #737373 0, #737373 1px, transparent 1px, transparent 3px);
  border-left: 1px solid #737373;
  border-top: 1px solid #737373;
  z-index: 10;
}
