/* css/themes.css — Switchable themes via [data-theme="..."] on <html> */
:root,
[data-theme="win95"],
[data-theme="classic"] {
  --face: #c0c0c0;
  --highlight: #ffffff;
  --shadow: #808080;
  --dkshadow: #000000;
  --active-caption: #000080;
  --caption-text: #ffffff;
  --desktop: #808080;
  --window: #ffffff;
}

[data-theme="macos"] {
  --face: #ececec;
  --highlight: #ffffff;
  --shadow: #c8c8c8;
  --dkshadow: #aaaaaa;
  --active-caption: #e8e8e8;
  --caption-text: #333333;
  --desktop: #87ceeb;
  --window: #ffffff;
}

/* macOS window chrome */
[data-theme="macos"] .mdi-window {
  border: none;
  border-radius: 8px 8px 4px 4px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.25), 0 0 0 1px rgba(0,0,0,0.1);
  overflow: visible;
}

[data-theme="macos"] .mdi-titlebar {
  background: linear-gradient(180deg, #e8e8e8 0%, #d6d6d6 50%, #c8c8c8 100%);
  height: 22px;
  padding: 0 8px;
  border-radius: 8px 8px 0 0;
  border-bottom: 1px solid #b0b0b0;
  color: #333;
}

[data-theme="macos"] .mdi-window.focused .mdi-titlebar {
  background: linear-gradient(180deg, #d6d6d6 0%, #c4c4c4 100%);
  color: #000;
}

[data-theme="macos"] .mdi-title {
  font-weight: 600;
  font-size: 12px;
  text-align: center;
  color: #555;
  line-height: 22px;
}

[data-theme="macos"] .mdi-window.focused .mdi-title {
  color: #000;
}

[data-theme="macos"] .mdi-sysbtns {
  order: -1;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 4px 0 0;
}

[data-theme="macos"] .mdi-sysbtns button {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: none;
  box-shadow: none;
  margin: 0;
  padding: 0;
  font-size: 0;
  line-height: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: filter 0.1s;
}

[data-theme="macos"] .mdi-sysbtns button:active {
  padding: 0;
  box-shadow: none;
}

[data-theme="macos"] .mdi-sysbtns button[data-act="close"] {
  background: #fc5753;
  border: 1px solid #e04541;
}
[data-theme="macos"] .mdi-sysbtns button[data-act="close"]:hover {
  background: #fc7a77;
}
[data-theme="macos"] .mdi-sysbtns button[data-act="close"]:active {
  background: #e04541;
}
[data-theme="macos"] .mdi-sysbtns button[data-act="close"]::before {
  content: "";
  position: absolute;
  width: 6px; height: 1px;
  background: transparent;
  border-radius: 1px;
}
[data-theme="macos"] .mdi-sysbtns button[data-act="close"]:hover::before {
  background: #450000;
}

[data-theme="macos"] .mdi-sysbtns button[data-act="min"] {
  background: #fdbc40;
  border: 1px solid #e1a233;
}
[data-theme="macos"] .mdi-sysbtns button[data-act="min"]:hover {
  background: #fdcc66;
}
[data-theme="macos"] .mdi-sysbtns button[data-act="min"]:active {
  background: #e1a233;
}

[data-theme="macos"] .mdi-sysbtns button[data-act="max"] {
  background: #33c748;
  border: 1px solid #2aaa3a;
}
[data-theme="macos"] .mdi-sysbtns button[data-act="max"]:hover {
  background: #5dd46c;
}
[data-theme="macos"] .mdi-sysbtns button[data-act="max"]:active {
  background: #2aaa3a;
}

[data-theme="macos"] .mdi-sysbtns button:hover::after {
  content: attr(title);
  position: absolute;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.7);
  color: #fff;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  white-space: nowrap;
  z-index: 9999;
  pointer-events: none;
}

[data-theme="macos"] .mdi-content {
  border-top: none;
  background: var(--face);
  border-radius: 0 0 4px 4px;
}

[data-theme="macos"] .mdi-resize {
  display: block;
}

[data-theme="macos"] .task-btn {
  background: #e8e8e8;
  border: 1px solid #ccc;
  border-radius: 4px;
  box-shadow: none;
  font-size: 11px;
}
[data-theme="macos"] .task-btn:active,
[data-theme="macos"] .task-btn.active {
  background: #d0d0d0;
  border-color: #aaa;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
}

[data-theme="macos"] .win-btn {
  border-radius: 4px;
  background: linear-gradient(180deg, #f5f5f5 0%, #e0e0e0 100%);
  border: 1px solid #b0b0b0;
  box-shadow: none;
  min-height: 21px;
}
[data-theme="macos"] .win-btn:active {
  background: linear-gradient(180deg, #d0d0d0 0%, #c0c0c0 100%);
  border-color: #909090;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.15);
  padding: 2px 8px;
}

/* macOS speedbar */
[data-theme="macos"] .speedbar-btn {
  border-radius: 4px;
  border: 1px solid transparent;
  background: transparent;
  padding: 2px;
}
[data-theme="macos"] .speedbar-btn:hover {
  background: rgba(0,0,0,0.05);
  border-color: rgba(0,0,0,0.1);
}
[data-theme="macos"] .speedbar-btn:active {
  background: rgba(0,0,0,0.1);
}

/* macOS menubar — Apple style */
[data-theme="macos"] .menubar {
  background: linear-gradient(180deg, #e0e0e0 0%, #d0d0d0 100%);
  border-bottom: 1px solid #b8b8b8;
  padding: 0 6px;
  height: 24px;
  align-items: center;
}
[data-theme="macos"] .menu-top {
  padding: 1px 12px;
  margin: 0;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 500;
  color: #333;
  line-height: 22px;
}
[data-theme="macos"] .menu-top.open,
[data-theme="macos"] .menu-top:hover {
  background: #2b6cb0;
  color: #fff;
}
[data-theme="macos"] .menu-dropdown {
  background: rgba(240,240,240,0.97);
  border: 1px solid rgba(0,0,0,0.15);
  border-radius: 6px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15), 0 0 0 0.5px rgba(0,0,0,0.05);
  padding: 4px;
  top: calc(100% + 4px);
  left: 0;
  min-width: 200px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}
[data-theme="macos"] .menu-dropdown.submenu {
  left: 100%;
  top: -4px;
}
[data-theme="macos"] .menu-item {
  padding: 3px 24px 3px 18px;
  border-radius: 4px;
  font-size: 13px;
  color: #222;
  line-height: 20px;
}
[data-theme="macos"] .menu-item:hover {
  background: #2b6cb0;
  color: #fff;
}
[data-theme="macos"] .menu-item.disabled {
  color: #999;
  text-shadow: none;
}
[data-theme="macos"] .menu-sep {
  margin: 4px 12px;
  border-top: 1px solid #d0d0d0;
}
[data-theme="macos"] .menu-item.checked {
  font-weight: 600;
}
[data-theme="macos"] .menu-item.has-submenu {
  position: relative;
}
[data-theme="macos"] .menu-dropdown.submenu.open {
  display: block;
}

/* macOS title bar buttons icon hover */
[data-theme="macos"] .mdi-sysbtns button {
  position: relative;
}

[data-theme="win11"] {
  --face: #f3f3f3;
  --highlight: #ffffff;
  --shadow: #e0e0e0;
  --dkshadow: #c0c0c0;
  --active-caption: #005fb8;
  --caption-text: #ffffff;
  --desktop: #0078d4;
  --window: #ffffff;
  --hot-track: #e9e9e9;
  --menu-text: #1a1a1a;
  --disabled-text: #a0a0a0;
  --accent: #0078d4;
  --accent-light: #deecf9;
  --accent-hover: #106ebe;
  --mica-bg: #f3f3f3;
  --acrylic-bg: #ffffff;
  --card-bg: #ffffff;
  --divider: rgba(0, 0, 0, 0.06);
  --text-primary: #1a1a1a;
  --text-secondary: #616161;
  --layer-shadow: 0 2px 4px rgba(0,0,0,0.04), 0 8px 16px rgba(0,0,0,0.08);
  --dialog-shadow: 0 8px 16px rgba(0,0,0,0.14), 0 0px 4px rgba(0,0,0,0.12);
}

/* Windows 11 — Mica desktop with bloom */
[data-theme="win11"] #desktop {
  background: linear-gradient(160deg, #001b4f 0%, #003399 30%, #0078d4 50%, #60cdff 70%, #c4e0f9 100%);
}

/* Windows 11 — Mica window chrome */
[data-theme="win11"] .mdi-window {
  z-index: 1;
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 8px;
  box-shadow: var(--layer-shadow);
  overflow: hidden;
  background: var(--mica-bg);
  transition: box-shadow 0.2s ease;
}
[data-theme="win11"] .mdi-window.focused {
  box-shadow: var(--dialog-shadow);
  border-color: rgba(0, 0, 0, 0.08);
}
[data-theme="win11"] .mdi-window.modal {
  border-color: rgba(0, 0, 0, 0.12);
  box-shadow: 0 12px 40px rgba(0,0,0,0.2), 0 0px 4px rgba(0,0,0,0.15);
}

/* Windows 11 — Titlebar */
[data-theme="win11"] .mdi-titlebar {
  background: transparent;
  height: 32px;
  padding: 0;
  border-bottom: 1px solid var(--divider);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  user-select: none;
}
[data-theme="win11"] .mdi-window.focused .mdi-titlebar {
  background: transparent;
}
[data-theme="win11"] .mdi-window:not(.focused) .mdi-titlebar {
  opacity: 0.6;
}

[data-theme="win11"] .mdi-title {
  font-weight: 600;
  font-size: 12px;
  color: var(--text-primary);
  line-height: 32px;
  padding: 0 12px;
  order: 0;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Windows 11 — System buttons (Fluent style) */
[data-theme="win11"] .mdi-sysbtns {
  display: flex;
  align-items: stretch;
  order: 1;
  height: 32px;
  margin-right: 0;
}
[data-theme="win11"] .mdi-sysbtns button {
  width: 46px;
  height: 32px;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  font-size: 10px;
  line-height: 32px;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s ease;
  cursor: default;
  position: relative;
}
[data-theme="win11"] .mdi-sysbtns button:hover {
  background: rgba(0, 0, 0, 0.04);
}
[data-theme="win11"] .mdi-sysbtns button:active {
  background: rgba(0, 0, 0, 0.06);
}
[data-theme="win11"] .mdi-sysbtns button[data-act="close"]:hover {
  background: #c42b1c;
  color: #fff;
}
[data-theme="win11"] .mdi-sysbtns button[data-act="close"]:active {
  background: #b42618;
  color: #fff;
}

/* Windows 11 — Content area */
[data-theme="win11"] .mdi-content {
  border-top: none;
  background: #ffffff;
  border-radius: 0 0 7px 7px;
}

/* Windows 11 — Resize (hidden, Mica uses edge resize) */
[data-theme="win11"] .mdi-resize {
  display: none;
}

/* Windows 11 — Taskbar (Centered, acrylic) */
[data-theme="win11"] #taskstrip {
  background: var(--mica-bg);
  
  border-top: 1px solid var(--divider);
  justify-content: center;
  gap: 2px;
  padding: 4px 12px;
}
[data-theme="win11"] .task-btn {
  background: transparent;
  border: none;
  border-radius: 4px;
  box-shadow: none;
  min-width: 80px;
  max-width: 200px;
  height: 30px;
  margin: 0;
  padding: 0 12px;
  font-size: 12px;
  color: var(--text-primary);
  transition: background 0.12s ease;
  position: relative;
}
[data-theme="win11"] .task-btn:hover {
  background: rgba(0, 0, 0, 0.04);
}
[data-theme="win11"] .task-btn.active {
  background: rgba(0, 0, 0, 0.06);
}
[data-theme="win11"] .task-btn.active::after {
  content: '';
  position: absolute;
  bottom: 2px;
  left: 50%;
  transform: translateX(-50%);
  width: 16px;
  height: 3px;
  border-radius: 2px;
  background: var(--accent);
}
[data-theme="win11"] .task-btn:active {
  background: rgba(0, 0, 0, 0.08);
}

/* Windows 11 — Fluent Button */
[data-theme="win11"] .win-btn {
  border-radius: 4px;
  border: 1px solid rgba(0, 0, 0, 0.06);
  background: var(--card-bg);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  min-height: 32px;
  padding: 4px 20px;
  font-size: 12px;
  color: var(--text-primary);
  transition: background 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
  cursor: default;
  font-weight: 400;
}
[data-theme="win11"] .win-btn:hover {
  background: #f9f9f9;
  border-color: rgba(0, 0, 0, 0.08);
}
[data-theme="win11"] .win-btn:active {
  background: #f3f3f3;
  border-color: rgba(0, 0, 0, 0.06);
  box-shadow: none;
  padding: 4px 20px;
}
[data-theme="win11"] .win-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
[data-theme="win11"] .win-btn.btn-ok {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
[data-theme="win11"] .win-btn.btn-ok:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}
[data-theme="win11"] .win-btn.btn-ok:active {
  background: #004e8c;
}
[data-theme="win11"] .win-btn.btn-cancel {
  background: var(--card-bg);
}

/* Windows 11 — Menubar (Mica + Acrylic dropdown) */
[data-theme="win11"] .menubar {
  background: transparent;
  border-bottom: 1px solid var(--divider);
  padding: 0;
  height: 28px;
  align-items: center;
}
[data-theme="win11"] .menu-top {
  padding: 3px 10px;
  margin: 0 1px;
  border-radius: 4px;
  color: var(--text-primary);
  font-size: 12px;
  line-height: 22px;
  transition: background 0.12s ease;
}
[data-theme="win11"] .menu-top:hover,
[data-theme="win11"] .menu-top.open {
  background: var(--accent-light);
  color: var(--text-primary);
}

/* Win11 — Acrylic dropdown */
[data-theme="win11"] .menu-dropdown {
  background: rgba(252, 252, 252, 0.94);
  
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.14), 0 2px 4px rgba(0, 0, 0, 0.06);
  padding: 4px;
  top: calc(100% + 2px);
  left: 0;
  min-width: 200px;
}
[data-theme="win11"] .menu-dropdown.submenu {
  left: 100%;
  top: -4px;
}

[data-theme="win11"] .menu-item {
  padding: 5px 12px 5px 16px;
  border-radius: 4px;
  font-size: 12px;
  color: var(--text-primary);
  transition: background 0.08s ease;
}
[data-theme="win11"] .menu-item:hover {
  background: var(--accent-light);
  color: var(--text-primary);
}
[data-theme="win11"] .menu-item.disabled {
  color: var(--disabled-text);
  text-shadow: none;
}
[data-theme="win11"] .menu-item.disabled:hover {
  background: transparent;
}
[data-theme="win11"] .menu-sep {
  margin: 4px 8px;
  border-top: 1px solid var(--divider);
}
[data-theme="win11"] .menu-item.checked {
  font-weight: 600;
}
[data-theme="win11"] .menu-item.has-submenu {
  position: relative;
}
[data-theme="win11"] .menu-dropdown.submenu.open {
  display: block;
}

/* Win11 — Speedbar */
[data-theme="win11"] #speedbar {
  background: transparent;
  border-bottom: 1px solid var(--divider);
  padding: 2px 6px;
}
[data-theme="win11"] .speedbar-btn {
  border-radius: 4px;
  border: 1px solid transparent;
  background: transparent;
  padding: 3px 8px;
  transition: background 0.12s ease, border-color 0.12s ease;
}
[data-theme="win11"] .speedbar-btn:hover {
  background: rgba(0, 0, 0, 0.04);
  border-color: rgba(0, 0, 0, 0.06);
}
[data-theme="win11"] .speedbar-btn:active {
  background: rgba(0, 0, 0, 0.06);
}
[data-theme="win11"] .speedbar-sep {
  border-left: 1px solid var(--divider);
  width: 0;
  height: 20px;
  margin: 0 4px;
}

/* Win11 — Statusbar */
[data-theme="win11"] #statusbar {
  background: var(--mica-bg);
  
  border-top: 1px solid var(--divider);
  padding: 0 12px;
  font-size: 11px;
  color: var(--text-secondary);
  height: 24px;
  line-height: 24px;
}

/* Win11 — Editor toolbars */
[data-theme="win11"] .editor-toolbar {
  background: transparent;
  border-bottom: 1px solid var(--divider);
  padding: 4px 6px;
  gap: 4px;
}
[data-theme="win11"] .editor-toolbar .tool-btn {
  border-radius: 4px;
  border: 1px solid transparent;
  background: transparent;
  min-width: unset;
  min-height: unset;
  padding: 4px 12px;
  font-size: 12px;
  transition: background 0.12s ease, border-color 0.12s ease;
  color: var(--text-primary);
}
[data-theme="win11"] .editor-toolbar .tool-btn:hover {
  background: rgba(0, 0, 0, 0.04);
  border-color: rgba(0, 0, 0, 0.06);
}
[data-theme="win11"] .editor-toolbar .tool-btn.active {
  background: var(--accent-light);
  border-color: rgba(0, 120, 212, 0.3);
  color: var(--accent);
}
[data-theme="win11"] .editor-toolbar .tool-btn:active {
  background: rgba(0, 0, 0, 0.06);
}

/* Win11 — Palette */
[data-theme="win11"] .palette-btn {
  border-radius: 4px;
  border: 1px solid transparent;
  background: transparent;
  padding: 4px 10px;
  font-size: 12px;
  transition: background 0.12s ease;
  min-width: unset;
  min-height: unset;
  color: var(--text-primary);
}
[data-theme="win11"] .palette-btn:hover {
  background: rgba(0, 0, 0, 0.04);
}
[data-theme="win11"] .palette-btn.active {
  background: var(--accent-light);
  border-color: rgba(0, 120, 212, 0.3);
  color: var(--accent);
}
[data-theme="win11"] .palette-section-title {
  font-size: 12px;
  font-weight: 600;
  padding: 6px 8px 4px;
  color: var(--text-primary);
}

/* Win11 — Editor status */
[data-theme="win11"] .editor-status {
  background: transparent;
  border-top: 1px solid var(--divider);
  padding: 3px 10px;
  font-size: 12px;
  color: var(--text-secondary);
}

/* Win11 — Project tree */
[data-theme="win11"] .project-tree {
  background: var(--card-bg);
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 4px;
}
[data-theme="win11"] .project-node:hover {
  background: rgba(0, 0, 0, 0.03);
}
[data-theme="win11"] .project-node.selected {
  background: var(--accent-light);
}

/* Win11 — Dialog canvas */
[data-theme="win11"] .dialog-canvas {
  background: var(--card-bg);
}
[data-theme="win11"] .dialog-canvas.bwcc-canvas {
  background: var(--card-bg);
}

/* Win11 — Fluent inputs */
[data-theme="win11"] .style-row input[type="text"],
[data-theme="win11"] .style-row input[type="number"],
[data-theme="win11"] .style-row select {
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 12px;
  background: var(--card-bg);
  color: var(--text-primary);
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
[data-theme="win11"] .style-row input[type="text"]:hover,
[data-theme="win11"] .style-row input[type="number"]:hover,
[data-theme="win11"] .style-row select:hover {
  border-color: rgba(0, 0, 0, 0.24);
}
[data-theme="win11"] .style-row input[type="text"]:focus,
[data-theme="win11"] .style-row input[type="number"]:focus,
[data-theme="win11"] .style-row select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
  outline: none;
}
[data-theme="win11"] .style-row label {
  font-size: 12px;
  color: var(--text-primary);
}

/* Win11 — Context menu (Fluent Acrylic) */
[data-theme="win11"] .context-menu {
  background: #fcfcfc !important;
  border: 1px solid rgba(0, 0, 0, 0.08) !important;
  border-top-color: rgba(0, 0, 0, 0.08) !important;
  border-left-color: rgba(0, 0, 0, 0.08) !important;
  border-radius: 8px !important;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.14), 0 2px 4px rgba(0, 0, 0, 0.06) !important;
  padding: 4px !important;
  font-size: 12px !important;
}
[data-theme="win11"] .context-menu-item {
  padding: 5px 12px 5px 16px !important;
  border-radius: 4px !important;
  color: var(--text-primary) !important;
  transition: background 0.08s ease !important;
}
[data-theme="win11"] .context-menu-item:hover:not(.disabled) {
  background: var(--accent-light) !important;
  color: var(--text-primary) !important;
}
[data-theme="win11"] .context-menu-item.disabled {
  color: var(--disabled-text) !important;
}
[data-theme="win11"] .context-menu-sep {
  margin: 4px 8px !important;
  background: var(--divider) !important;
}

/* Win11 — MDI window resize handles */
[data-theme="win11"] .mdi-resize {
  display: none;
}

/* Win11 — Checkbox / Radio Fluent style */
[data-theme="win11"] input[type="checkbox"] {
  accent-color: var(--accent);
}
[data-theme="win11"] input[type="radio"] {
  accent-color: var(--accent);
}