/**
 * Le Carré TV - Desktop System Styles
 *
 * Styles for:
 * - Desktop background
 * - Taskbar
 * - Start menu
 * - Windows
 * - App-specific styles
 */

/* ============ CSS Variables ============ */
:root {
  /* UI Scale - affects all scalable UI (1 = 100%, 1.5 = 150%, etc.) */
  --ui-scale: 1;

  /* Derived sizes (scaled) */
  --taskbar-height: calc(60px * var(--ui-scale));
  --window-titlebar-height: calc(48px * var(--ui-scale));
  --window-btn-size: calc(32px * var(--ui-scale));

  /* Base sizes */
  --taskbar-bg: rgba(0, 0, 0, 0.85);
  --start-menu-bg: rgba(20, 20, 30, 0.95);
  --window-bg: rgba(30, 30, 45, 0.98);
  --window-titlebar-bg: rgba(40, 40, 60, 0.98);
  --accent-color: #4ade80;
  --accent-hover: #22c55e;
  --text-color: #ffffff;
  --text-muted: rgba(255, 255, 255, 0.6);
  --border-color: rgba(255, 255, 255, 0.1);
  --cursor-size: 24px;
  --cursor-color: #ffffff;

  /* Window resize zones (set dynamically by WindowManager.setResizeZoneSizes) */
  --resize-outer: 16px;
  --resize-inner: 14px;
  --resize-edge-size: 30px;  /* outer + inner */
  --resize-corner-size: 30px;
  --cursor-computed-size: 24px;
  --cursor-outline-color: rgba(0, 0, 0, 0.5);

  /* Scaled font sizes */
  --font-xs: calc(0.75rem * var(--ui-scale));
  --font-sm: calc(0.875rem * var(--ui-scale));
  --font-base: calc(1rem * var(--ui-scale));
  --font-lg: calc(1.125rem * var(--ui-scale));
  --font-xl: calc(1.25rem * var(--ui-scale));
  --font-2xl: calc(1.5rem * var(--ui-scale));

  /* Scaled spacing */
  --space-xs: calc(0.25rem * var(--ui-scale));
  --space-sm: calc(0.5rem * var(--ui-scale));
  --space-md: calc(0.75rem * var(--ui-scale));
  --space-lg: calc(1rem * var(--ui-scale));
  --space-xl: calc(1.5rem * var(--ui-scale));
}

/* ============ Desktop ============ */
#desktop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: var(--taskbar-height);
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
  overflow: hidden;
}

#windowContainer {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  overflow: hidden;
}

/* ============ Taskbar ============ */
#taskbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--taskbar-height);
  background: var(--taskbar-bg);
  display: flex;
  align-items: center;
  /* No left padding - start button fills the corner */
  padding: 0 var(--space-sm) 0 0;
  z-index: 1000;
  border-top: 1px solid var(--border-color);
  /* backdrop-filter removed for performance */
}

/* Start Button - Fills entire bottom-left corner (Fitts's Law) */
#taskbarStartBtn {
  position: relative;
  /* Fill full taskbar height */
  width: calc(58px * var(--ui-scale));
  height: 100%;
  background: linear-gradient(135deg, var(--accent-color), var(--accent-hover));
  border: none;
  /* Only round the right corners - left edge is flush with screen */
  border-radius: 0 calc(8px * var(--ui-scale)) calc(8px * var(--ui-scale)) 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-2xl);
  color: #000;
  margin-right: var(--space-lg);
  transition: transform 0.15s, box-shadow 0.15s;
}

/* Corner hitzone no longer needed - button itself fills the corner */
#taskbarStartBtn .corner-hitzone {
  display: none;
}

/* Icon wrapper inside start button */
#taskbarStartBtn .btn-icon {
  display: flex;
  align-items: center;
  justify-content: center;
}

#taskbarStartBtn.hover {
  /* No scale transform - button fills corner, scaling would create gaps */
  background: linear-gradient(135deg, var(--accent-hover), var(--accent-color));
  box-shadow: 0 0 20px rgba(74, 222, 128, 0.4);
}

#taskbarStartBtn:active {
  /* Subtle darken instead of scale */
  filter: brightness(0.9);
}

#taskbarStartBtn svg {
  width: calc(24px * var(--ui-scale, 1));
  height: calc(24px * var(--ui-scale, 1));
  fill: currentColor;
}

/* App List */
#taskbarAppList {
  flex: 1;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  overflow-x: auto;
  padding: 0 var(--space-sm);
}

.taskbar-app-btn {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-lg);
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid transparent;
  border-radius: calc(6px * var(--ui-scale));
  color: var(--text-color);
  cursor: pointer;
  font-size: var(--font-lg);
  white-space: nowrap;
  transition: all 0.15s;
}

.taskbar-app-btn.hover {
  background: rgba(255, 255, 255, 0.2);
}

.taskbar-app-btn.active {
  border-color: var(--accent-color);
  background: rgba(74, 222, 128, 0.15);
}

.taskbar-app-btn.minimized {
  opacity: 0.5;
}

.taskbar-app-icon {
  font-size: var(--font-xl);
  display: flex;
  align-items: center;
  justify-content: center;
}

.taskbar-app-icon svg {
  width: calc(20px * var(--ui-scale, 1));
  height: calc(20px * var(--ui-scale, 1));
  fill: currentColor;
}

.taskbar-app-title {
  max-width: calc(150px * var(--ui-scale));
  overflow: hidden;
  text-overflow: ellipsis;
}

/* System Tray */
#taskbarSystemTray {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  padding: 0 var(--space-lg);
  margin-left: auto;
}

#taskbarKeyboard {
  padding: var(--space-sm) var(--space-lg);
  background: rgba(255, 255, 255, 0.1);
  border-radius: calc(6px * var(--ui-scale));
  cursor: pointer;
  font-size: var(--font-lg);
  font-weight: bold;
  color: var(--accent-color);
  transition: background 0.15s;
}

#taskbarKeyboard.hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Key Lock Toggle Button */
.key-lock-btn {
  position: relative;
  width: calc(36px * var(--ui-scale, 1));
  height: calc(36px * var(--ui-scale, 1));
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: calc(4px * var(--ui-scale, 1));
  transition: background 0.2s;
  padding: 0;
}

.key-lock-btn.hover {
  background: rgba(255, 255, 255, 0.15);
}

.key-lock-btn svg {
  width: calc(20px * var(--ui-scale, 1));
  height: calc(20px * var(--ui-scale, 1));
  fill: currentColor;
  transition: opacity 0.2s;
}

/* Locked state - show locked icon, hide unlocked */
.key-lock-btn.locked {
  color: var(--text-muted, #888);
}

.key-lock-btn.locked .lock-icon-locked {
  display: block;
}

.key-lock-btn.locked .lock-icon-unlocked {
  display: none;
}

/* Unlocked state - show unlocked icon, hide locked */
.key-lock-btn.unlocked {
  color: #4ecdc4;
}

.key-lock-btn.unlocked .lock-icon-locked {
  display: none;
}

.key-lock-btn.unlocked .lock-icon-unlocked {
  display: block;
}

#taskbarClock {
  font-size: var(--font-xl);
  font-weight: 300;
  color: var(--text-color);
  min-width: calc(60px * var(--ui-scale));
  text-align: right;
}

/* ============ Start Menu ============ */
#startMenu {
  position: fixed;
  bottom: calc(var(--taskbar-height) + 10px);
  left: calc(10px * var(--ui-scale));
  width: calc(500px * var(--ui-scale));
  max-height: calc(700px * var(--ui-scale));
  background: var(--start-menu-bg);
  border: 1px solid var(--border-color);
  border-radius: calc(12px * var(--ui-scale));
  padding: var(--space-lg);
  z-index: 1001;
  display: none;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  /* backdrop-filter removed for performance */
}

#startMenu.visible {
  display: block;
}

.start-menu-header {
  font-size: var(--font-2xl);
  font-weight: bold;
  margin-bottom: var(--space-lg);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--border-color);
  color: var(--accent-color);
}

#startMenuAppList {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-md);
  max-height: calc(600px * var(--ui-scale));
  overflow-y: auto;
}

.start-menu-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-lg);
  background: rgba(255, 255, 255, 0.05);
  border-radius: calc(8px * var(--ui-scale));
  cursor: pointer;
  transition: background 0.15s;
  min-height: calc(90px * var(--ui-scale));
}

.start-menu-item.hover {
  background: rgba(255, 255, 255, 0.15);
}

.start-menu-icon {
  font-size: calc(2.2rem * var(--ui-scale));
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: calc(48px * var(--ui-scale, 1));
  min-height: calc(48px * var(--ui-scale, 1));
}

.start-menu-icon svg {
  width: calc(32px * var(--ui-scale, 1));
  height: calc(32px * var(--ui-scale, 1));
  fill: currentColor;
}

.start-menu-title {
  font-size: var(--font-lg);
  text-align: center;
}

.start-menu-empty {
  padding: var(--space-xl);
  text-align: center;
  color: var(--text-muted);
  font-size: var(--font-lg);
}

#startMenuFooter {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  margin-top: var(--space-lg);
  padding: var(--space-lg);
  border-top: 1px solid var(--border-color);
  background: rgba(15, 15, 20, 0.95);
  border-radius: 0 0 calc(12px * var(--ui-scale)) calc(12px * var(--ui-scale));
  margin-left: calc(var(--space-lg) * -1);
  margin-right: calc(var(--space-lg) * -1);
  margin-bottom: calc(var(--space-lg) * -1);
}

#startMenuUser {
  font-size: var(--font-sm);
  color: var(--text-color);
  background: rgba(255, 255, 255, 0.1);
  padding: var(--space-sm) var(--space-md);
  border-radius: calc(20px * var(--ui-scale));
  border: 1px solid rgba(255, 255, 255, 0.15);
  white-space: nowrap;
  flex-shrink: 0;
}

#startMenuLogout {
  padding: var(--space-sm) var(--space-lg);
  background: rgba(255, 100, 100, 0.2);
  border: 1px solid rgba(255, 100, 100, 0.4);
  border-radius: calc(6px * var(--ui-scale));
  color: #ff8888;
  font-size: var(--font-base);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

#startMenuLogout.hover {
  background: rgba(255, 100, 100, 0.35);
  border-color: rgba(255, 100, 100, 0.6);
}

#startMenuSettings,
#startMenuPower {
  padding: var(--space-sm);
  width: calc(40px * var(--ui-scale));
  height: calc(40px * var(--ui-scale));
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: calc(6px * var(--ui-scale));
  color: #ffffff;
  font-size: calc(1.25rem * var(--ui-scale));
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

#startMenuSettings.hover,
#startMenuPower.hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.3);
}

#startMenuSettings svg,
#startMenuPower svg {
  width: calc(20px * var(--ui-scale));
  height: calc(20px * var(--ui-scale));
  display: block;
}

/* ============ Windows ============ */
.tv-window {
  position: absolute;
  background: var(--window-bg);
  border: 1px solid var(--border-color);
  border-radius: calc(12px * var(--ui-scale));
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
  display: flex;
  flex-direction: column;
  min-width: calc(300px * var(--ui-scale));
  min-height: calc(200px * var(--ui-scale));
  overflow: visible;
  font-size: var(--font-base);
}

/* Global select dropdown option styling for dark theme */
.tv-window select option {
  background: rgb(30, 30, 45);
  color: #ffffff;
}

.tv-window.focused {
  box-shadow: 0 15px 50px rgba(0, 0, 0, 0.5), 0 0 0 2px var(--accent-color);
}

.tv-window.minimized {
  display: none;
}

.tv-window.maximized {
  border-radius: 0;
}

.tv-window.dragging,
.tv-window.resizing {
  opacity: 0.9;
  user-select: none;
}

/* Window Titlebar */
.tv-window-titlebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) var(--space-lg);
  background: var(--window-titlebar-bg);
  cursor: move;
  user-select: none;
  border-bottom: 1px solid var(--border-color);
  min-height: var(--window-titlebar-height);
  position: relative;
  z-index: 15; /* Above resize handles (10), below buttons (20+) */
}

.tv-window-title {
  font-size: var(--font-lg);
  font-weight: 500;
  color: var(--text-color);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tv-window-controls {
  display: flex;
  gap: var(--space-sm);
  position: relative;
  z-index: 20; /* Above resize handles (z-index: 10) */
}

.tv-window-btn {
  width: var(--window-btn-size);
  height: var(--window-btn-size);
  border: none;
  border-radius: calc(6px * var(--ui-scale));
  cursor: pointer;
  position: relative;
  z-index: 21; /* Highest - above everything */
  font-size: var(--font-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.tv-window-minimize {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-color);
}

.tv-window-minimize.hover {
  background: rgba(255, 255, 255, 0.2);
}

.tv-window-maximize {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-color);
}

.tv-window-maximize.hover {
  background: rgba(255, 255, 255, 0.2);
}

.tv-window-close {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
}

.tv-window-close.hover {
  background: #ef4444;
  color: white;
}

/* Window Header - Splitter */
.tv-window-header-splitter {
  width: 1px;
  height: calc(24px * var(--ui-scale));
  background: var(--border-color);
  margin-left: var(--space-lg);
  margin-right: var(--space-md);
  opacity: 0;
  transition: opacity 0.15s;
}

.tv-window-header-splitter.visible {
  opacity: 1;
}

/* Window Header - Button Zones */
.tv-window-header-buttons-left,
.tv-window-header-buttons-right {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  position: relative;
  z-index: 20; /* Above resize handles and titlebar */
}

.tv-window-header-buttons-left:empty,
.tv-window-header-buttons-right:empty {
  display: none;
}

/* Spacer between left and right buttons */
.tv-window-header-spacer {
  flex: 1;
  min-width: var(--space-md);
}

/* Right button zone needs margin before controls */
.tv-window-header-buttons-right {
  margin-right: var(--space-md);
}

/* Window Header Button */
.tv-window-header-btn {
  width: var(--window-btn-size);
  height: var(--window-btn-size);
  border: none;
  border-radius: calc(6px * var(--ui-scale));
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-color);
  transition: background 0.15s;
}

.tv-window-header-btn.hover {
  background: rgba(255, 255, 255, 0.2);
}

.tv-window-header-btn svg {
  fill: currentColor;
}

/* Window Content */
.tv-window-content {
  flex: 1;
  overflow: auto;
  padding: var(--space-lg);
  font-size: var(--font-base);
}

/* Window Resize Handles */
.tv-window-resize {
  position: absolute;
  z-index: 10;
}

/* Edge handles: extend outer outward, inner inward, leave room for corners */
.tv-resize-n { top: calc(-1 * var(--resize-outer)); left: var(--resize-inner); right: var(--resize-inner); height: var(--resize-edge-size); cursor: n-resize; }
.tv-resize-s { bottom: calc(-1 * var(--resize-outer)); left: var(--resize-inner); right: var(--resize-inner); height: var(--resize-edge-size); cursor: s-resize; }
.tv-resize-e { right: calc(-1 * var(--resize-outer)); top: var(--resize-inner); bottom: var(--resize-inner); width: var(--resize-edge-size); cursor: e-resize; }
.tv-resize-w { left: calc(-1 * var(--resize-outer)); top: var(--resize-inner); bottom: var(--resize-inner); width: var(--resize-edge-size); cursor: w-resize; }
/* Corner handles: square, extend outer in both directions */
.tv-resize-ne { top: calc(-1 * var(--resize-outer)); right: calc(-1 * var(--resize-outer)); width: var(--resize-corner-size); height: var(--resize-corner-size); cursor: ne-resize; }
.tv-resize-nw { top: calc(-1 * var(--resize-outer)); left: calc(-1 * var(--resize-outer)); width: var(--resize-corner-size); height: var(--resize-corner-size); cursor: nw-resize; }
.tv-resize-se { bottom: calc(-1 * var(--resize-outer)); right: calc(-1 * var(--resize-outer)); width: var(--resize-corner-size); height: var(--resize-corner-size); cursor: se-resize; }
.tv-resize-sw { bottom: calc(-1 * var(--resize-outer)); left: calc(-1 * var(--resize-outer)); width: var(--resize-corner-size); height: var(--resize-corner-size); cursor: sw-resize; }

/* DEBUG: Window Zone Visualization
   Priority order (highest to lowest): Buttons > Drag Area > Resize Zones
   Colors: Buttons=Red, Drag Area=Orange, Resize N/S=Green, Resize E/W=Blue, Corners=Yellow/Magenta/Cyan
*/

/* Resize zones (lowest priority - z-index: 10) */
.debug-resize-zones .tv-window-resize {
  background: rgba(128, 128, 128, 0.3);
  border: 1px dashed rgba(128, 128, 128, 0.8);
}
.debug-resize-zones .tv-resize-n { background: rgba(0, 255, 0, 0.3); border-color: rgba(0, 255, 0, 0.8); }
.debug-resize-zones .tv-resize-s { background: rgba(0, 255, 0, 0.3); border-color: rgba(0, 255, 0, 0.8); }
.debug-resize-zones .tv-resize-e { background: rgba(0, 0, 255, 0.3); border-color: rgba(0, 0, 255, 0.8); }
.debug-resize-zones .tv-resize-w { background: rgba(0, 0, 255, 0.3); border-color: rgba(0, 0, 255, 0.8); }
.debug-resize-zones .tv-resize-ne { background: rgba(255, 255, 0, 0.4); border-color: rgba(255, 255, 0, 0.8); }
.debug-resize-zones .tv-resize-nw { background: rgba(255, 0, 255, 0.4); border-color: rgba(255, 0, 255, 0.8); }
.debug-resize-zones .tv-resize-se { background: rgba(0, 255, 255, 0.4); border-color: rgba(0, 255, 255, 0.8); }
.debug-resize-zones .tv-resize-sw { background: rgba(255, 128, 0, 0.4); border-color: rgba(255, 128, 0, 0.8); }

/* Drag area / titlebar (middle priority - shown behind buttons) */
.debug-resize-zones .tv-window-titlebar {
  background: rgba(255, 165, 0, 0.3) !important;
  outline: 2px dashed rgba(255, 165, 0, 0.8);
  outline-offset: -2px;
}

/* Window control buttons (highest priority - always on top) */
.debug-resize-zones .tv-window-btn {
  background: rgba(255, 0, 0, 0.4) !important;
  outline: 2px solid rgba(255, 0, 0, 0.9);
  outline-offset: -2px;
}
.debug-resize-zones .tv-window-controls {
  background: rgba(255, 0, 0, 0.2);
  outline: 1px dashed rgba(255, 0, 0, 0.6);
}

/* Custom header buttons (same priority as window controls) */
.debug-resize-zones .tv-window-header-buttons-left,
.debug-resize-zones .tv-window-header-buttons-right {
  background: rgba(255, 100, 100, 0.2);
  outline: 1px dashed rgba(255, 100, 100, 0.6);
}
.debug-resize-zones .tv-window-header-buttons-left button,
.debug-resize-zones .tv-window-header-buttons-right button {
  background: rgba(255, 0, 0, 0.4) !important;
  outline: 2px solid rgba(255, 0, 0, 0.9);
  outline-offset: -2px;
}

/* ============ Settings App ============ */
.settings-app {
  display: flex;
  height: 100%;
  gap: var(--space-lg);
}

.settings-sidebar {
  width: calc(180px * var(--ui-scale));
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  border-right: 1px solid var(--border-color);
  padding-right: var(--space-lg);
  overflow-y: auto;
}

.settings-nav-item {
  padding: var(--space-md) var(--space-lg);
  border-radius: calc(6px * var(--ui-scale));
  cursor: pointer;
  font-size: var(--font-lg);
  transition: background 0.15s;
}

.settings-nav-item.hover {
  background: rgba(255, 255, 255, 0.1);
}

.settings-nav-item.active {
  background: var(--accent-color);
  color: #000;
  font-weight: 500;
}

.settings-nav-item.disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

.settings-content {
  flex: 1;
  overflow-y: auto;
}

.settings-section {
  display: none;
}

.settings-section.active {
  display: block;
}

.settings-section h2 {
  margin-bottom: var(--space-xl);
  font-size: var(--font-2xl);
  color: var(--accent-color);
}

.settings-group {
  margin-bottom: var(--space-xl);
}

.settings-group label {
  display: block;
  margin-bottom: var(--space-sm);
  font-size: var(--font-lg);
}

.settings-group input[type="color"] {
  width: calc(60px * var(--ui-scale));
  height: calc(40px * var(--ui-scale));
  border: none;
  border-radius: calc(6px * var(--ui-scale));
  cursor: pointer;
}

.settings-group select {
  padding: var(--space-sm) var(--space-lg);
  font-size: var(--font-lg);
  border-radius: calc(6px * var(--ui-scale));
  border: 1px solid var(--border-color);
  background: rgba(30, 30, 45, 0.95);
  color: var(--text-color);
  cursor: pointer;
}

/* Style dropdown options for dark theme */
.settings-group select option {
  background: rgb(30, 30, 45);
  color: #ffffff;
  padding: var(--space-sm);
}

.settings-group input[type="range"] {
  width: 100%;
  max-width: calc(300px * var(--ui-scale));
}

.settings-group input[type="checkbox"] {
  width: calc(20px * var(--ui-scale));
  height: calc(20px * var(--ui-scale));
  margin-right: var(--space-sm);
  cursor: pointer;
}

.settings-btn {
  padding: var(--space-md) var(--space-xl);
  font-size: var(--font-lg);
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: calc(6px * var(--ui-scale));
  color: var(--text-color);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.settings-btn.hover {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.25);
}

.settings-btn.danger {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
}

.settings-btn.danger.hover {
  background: #ef4444;
  color: white;
}

.settings-hint {
  font-size: var(--font-sm);
  color: var(--text-muted);
  margin-top: var(--space-xs);
}

/* ============ Widget Settings ============ */
.widget-settings-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.widget-settings-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-md) var(--space-lg);
  background: rgba(255, 255, 255, 0.05);
  border-radius: calc(8px * var(--ui-scale));
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.widget-settings-item.hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.15);
}

.widget-settings-info {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.widget-settings-icon {
  font-size: var(--font-xl);
  opacity: 0.9;
}

.widget-settings-title {
  font-size: var(--font-lg);
  font-weight: 500;
}

.widget-settings-controls {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
}

.widget-settings-toggle {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  cursor: pointer;
  font-size: var(--font-sm);
}

.widget-settings-toggle input[type="checkbox"] {
  width: calc(18px * var(--ui-scale));
  height: calc(18px * var(--ui-scale));
  cursor: pointer;
}

.widget-settings-toggle input[type="checkbox"]:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.widget-settings-controls select {
  padding: var(--space-xs) var(--space-sm);
  background: rgba(30, 30, 45, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: calc(4px * var(--ui-scale));
  color: var(--text-color);
  font-size: var(--font-sm);
  cursor: pointer;
}

/* Style dropdown options for dark theme */
.widget-settings-controls select option {
  background: rgb(30, 30, 45);
  color: #ffffff;
}

.widget-settings-controls select:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ============ Apps Settings List ============ */
.apps-settings-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.app-settings-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-md) var(--space-lg);
  background: rgba(255, 255, 255, 0.05);
  border-radius: calc(8px * var(--ui-scale));
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: background 0.15s ease, border-color 0.15s ease;
}

.app-settings-item.hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.15);
}

.app-settings-info {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.app-settings-icon {
  font-size: var(--font-xl);
  opacity: 0.9;
}

.app-settings-title {
  font-size: var(--font-lg);
  font-weight: 500;
}

.app-settings-controls {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.app-settings-btn {
  padding: var(--space-xs) var(--space-md);
  font-size: var(--font-sm);
}

.app-settings-icon-btn-launch,
.app-settings-icon-btn-gear {
  display: flex;
  align-items: center;
  justify-content: center;
  width: calc(36px * var(--ui-scale));
  height: calc(36px * var(--ui-scale));
  padding: 0;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: calc(6px * var(--ui-scale));
  color: var(--color-text);
  cursor: pointer;
  transition: all 0.15s ease;
}

.app-settings-icon-btn-launch.hover,
.app-settings-icon-btn-gear.hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: var(--color-primary);
}

.app-settings-icon-btn-launch .material-symbols-outlined,
.app-settings-icon-btn-gear .material-symbols-outlined {
  font-size: calc(18px * var(--ui-scale));
}

/* ============ Remote Access Settings ============ */
.remote-access-passkey-row {
  display: flex;
  gap: var(--space-sm);
  align-items: center;
}

.remote-access-passkey-row input[type="password"],
.remote-access-passkey-row input[type="text"] {
  flex: 1;
  padding: var(--space-sm) var(--space-md);
  background: rgba(30, 30, 45, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: calc(4px * var(--ui-scale));
  color: var(--text-color);
  font-size: var(--font-base);
  font-family: monospace;
}

.remote-access-passkey-row input:focus {
  outline: none;
  border-color: var(--color-primary);
}

/* Auto-save input states */
.remote-access-passkey-row input.saved {
  border-color: #4caf50;
  background: rgba(76, 175, 80, 0.1);
}

.remote-access-passkey-row input.error {
  border-color: #f44336;
  background: rgba(244, 67, 54, 0.1);
}

.remote-access-passkey-row input.saving {
  border-color: #ff9800;
  background: rgba(255, 152, 0, 0.1);
}

.remote-access-status {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  background: rgba(255, 255, 255, 0.05);
  border-radius: calc(4px * var(--ui-scale));
}

.status-indicator {
  width: calc(12px * var(--ui-scale));
  height: calc(12px * var(--ui-scale));
  border-radius: 50%;
  background: #666;
}

.status-indicator.active {
  background: #4ade80;
  box-shadow: 0 0 8px rgba(74, 222, 128, 0.5);
}

.status-indicator.warning {
  background: #fbbf24;
  box-shadow: 0 0 8px rgba(251, 191, 36, 0.5);
}

.status-indicator.disabled {
  background: #6b7280;
}

.status-indicator.error {
  background: #ef4444;
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.5);
}

/* Remote access endpoints and quick start use ui-copyable-block */
.remote-access-endpoints,
#remoteAccessQuickStart {
  margin-top: var(--space-sm);
}

/* Remote Access Tabs */
.remote-access-tabs {
  display: flex;
  gap: 0;
  margin-bottom: calc(20px * var(--ui-scale));
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.remote-access-tab {
  padding: calc(12px * var(--ui-scale)) calc(24px * var(--ui-scale));
  cursor: pointer;
  font-size: var(--font-base);
  color: var(--text-muted);
  transition: all 0.15s;
  border-bottom: calc(3px * var(--ui-scale)) solid transparent;
  font-weight: 500;
  background: transparent;
  border-left: none;
  border-right: none;
  border-top: none;
}

.remote-access-tab.hover {
  color: var(--text-color);
  background: rgba(255, 255, 255, 0.05);
}

.remote-access-tab.active {
  color: var(--accent-color);
  border-bottom-color: var(--accent-color);
  background: rgba(74, 222, 128, 0.05);
}

.remote-access-tab-content {
  display: none;
}

.remote-access-tab-content.active {
  display: block;
}

/* Remote Input Tab Styles */
.remote-input-qr-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: calc(20px * var(--ui-scale));
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: calc(8px * var(--ui-scale));
  min-height: calc(250px * var(--ui-scale));
  margin-top: calc(10px * var(--ui-scale));
}

.remote-input-qr-container canvas,
.remote-input-qr-container img {
  max-width: 100%;
  height: auto;
  border-radius: calc(4px * var(--ui-scale));
  background: white;
  padding: calc(10px * var(--ui-scale));
}

.remote-input-device-list {
  padding: calc(12px * var(--ui-scale));
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: calc(6px * var(--ui-scale));
  min-height: calc(60px * var(--ui-scale));
}

.remote-input-device-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: calc(10px * var(--ui-scale));
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: calc(4px * var(--ui-scale));
  margin-bottom: calc(8px * var(--ui-scale));
}

.remote-input-device-item:last-child {
  margin-bottom: 0;
}

.remote-input-device-info {
  display: flex;
  flex-direction: column;
  gap: calc(4px * var(--ui-scale));
}

.remote-input-device-name {
  font-weight: 500;
  color: var(--text-color);
}

.remote-input-device-meta {
  font-size: var(--font-sm);
  color: var(--text-muted);
}

/* ============================================================
   REMOTE INPUT SYSTEM (System Tray Icon + Overlay)
   ============================================================ */

/* Remote Input Icon in Taskbar */
.remote-input-icon {
  position: relative;
  width: calc(40px * var(--ui-scale, 1));
  height: calc(36px * var(--ui-scale, 1));
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: calc(4px * var(--ui-scale, 1));
  cursor: pointer;
  transition: background 0.2s;
  padding: 0;
  margin: 0 calc(2px * var(--ui-scale, 1));
}

.remote-input-icon.hover {
  background: rgba(255, 255, 255, 0.15);
}

.remote-input-icon-svg {
  width: calc(20px * var(--ui-scale, 1));
  height: calc(20px * var(--ui-scale, 1));
  opacity: 0.5;
  display: flex;
  color: var(--text-color, #ffffff);
}

.remote-input-icon-svg svg {
  width: 100%;
  height: 100%;
  fill: currentColor;
}

.remote-input-icon.enabled .remote-input-icon-svg {
  opacity: 1;
  color: var(--accent-color);
}

.remote-input-indicator {
  position: absolute;
  top: calc(4px * var(--ui-scale, 1));
  right: calc(4px * var(--ui-scale, 1));
  min-width: calc(16px * var(--ui-scale, 1));
  height: calc(16px * var(--ui-scale, 1));
  background: var(--accent-color);
  color: #000;
  border-radius: calc(8px * var(--ui-scale, 1));
  font-size: calc(10px * var(--ui-scale, 1));
  font-weight: bold;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0 calc(4px * var(--ui-scale, 1));
  box-shadow: 0 0 calc(4px * var(--ui-scale, 1)) rgba(0, 0, 0, 0.3);
}

.remote-input-indicator.visible {
  display: flex;
}

/* Remote Input Overlay */
.remote-input-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(calc(4px * var(--ui-scale, 1)));
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  animation: fadeIn 0.2s ease-out;
}

.remote-input-overlay.visible {
  display: flex;
}

.remote-input-panel {
  width: calc(500px * var(--ui-scale, 1));
  max-width: 90%;
  max-height: 90%;
  background: var(--bg-secondary);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: calc(12px * var(--ui-scale, 1));
  box-shadow: 0 calc(10px * var(--ui-scale, 1)) calc(30px * var(--ui-scale, 1)) rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.remote-input-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(16px * var(--ui-scale, 1)) calc(20px * var(--ui-scale, 1));
  background: rgba(0, 0, 0, 0.2);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.remote-input-panel-title {
  display: flex;
  align-items: center;
  gap: calc(10px * var(--ui-scale, 1));
  font-size: var(--font-lg);
  font-weight: 600;
  color: var(--text-color);
}

.remote-input-panel-title svg {
  width: calc(24px * var(--ui-scale, 1));
  height: calc(24px * var(--ui-scale, 1));
  fill: var(--accent-color);
}

.remote-input-close-btn {
  width: calc(32px * var(--ui-scale, 1));
  height: calc(32px * var(--ui-scale, 1));
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: calc(28px * var(--ui-scale, 1));
  cursor: pointer;
  border-radius: calc(4px * var(--ui-scale, 1));
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.remote-input-close-btn.hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-color);
}

.remote-input-panel-body {
  padding: calc(20px * var(--ui-scale, 1));
  overflow-y: auto;
  flex: 1;
}

.remote-input-qr-section,
.remote-input-devices-section {
  margin-bottom: calc(20px * var(--ui-scale, 1));
}

.remote-input-qr-section h3,
.remote-input-devices-section h3 {
  margin: 0 0 calc(12px * var(--ui-scale, 1)) 0;
  font-size: var(--font-base);
  font-weight: 600;
  color: var(--text-color);
}

.remote-input-qr-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: calc(20px * var(--ui-scale, 1));
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: calc(8px * var(--ui-scale, 1));
  min-height: calc(250px * var(--ui-scale, 1));
  margin-top: calc(10px * var(--ui-scale, 1));
}

.remote-input-qr-display canvas,
.remote-input-qr-display img {
  max-width: 100%;
  height: auto;
  border-radius: calc(4px * var(--ui-scale, 1));
}

.remote-input-url-section {
  margin-top: calc(16px * var(--ui-scale, 1));
}

.remote-input-url-section label {
  display: block;
  margin-bottom: calc(8px * var(--ui-scale, 1));
  font-size: var(--font-sm);
  color: var(--text-muted);
}

.remote-input-url-display {
  display: flex;
  align-items: center;
  gap: calc(8px * var(--ui-scale, 1));
  padding: calc(10px * var(--ui-scale, 1));
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: calc(6px * var(--ui-scale, 1));
}

.remote-input-url-display span {
  flex: 1;
  font-family: monospace;
  font-size: var(--font-sm);
  color: var(--accent-color);
  word-break: break-all;
}

/* Settings toggle (used in apps section) */
.settings-toggle {
  position: relative;
  display: inline-block;
  width: calc(44px * var(--ui-scale));
  height: calc(24px * var(--ui-scale));
  flex-shrink: 0;
}

.settings-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.settings-toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.2);
  border-radius: calc(24px * var(--ui-scale));
  transition: 0.2s;
}

.settings-toggle-slider:before {
  position: absolute;
  content: "";
  height: calc(18px * var(--ui-scale));
  width: calc(18px * var(--ui-scale));
  left: calc(3px * var(--ui-scale));
  bottom: calc(3px * var(--ui-scale));
  background-color: white;
  border-radius: 50%;
  transition: 0.2s;
}

.settings-toggle input:checked + .settings-toggle-slider {
  background-color: var(--color-primary);
}

.settings-toggle input:checked + .settings-toggle-slider:before {
  transform: translateX(calc(20px * var(--ui-scale)));
}

.settings-subsection {
  margin-bottom: var(--space-xl);
}

.settings-subsection h4 {
  font-size: var(--font-lg);
  font-weight: 500;
  margin: 0 0 var(--space-md) 0;
  color: var(--color-text-muted);
}

.settings-row {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md);
  background: rgba(255, 255, 255, 0.05);
  border-radius: calc(6px * var(--ui-scale));
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.settings-label {
  font-size: var(--font-base);
  color: var(--text-color);
  line-height: 1.5;
}

/* ============ UI Toggle Component ============ */
.ui-toggle {
  position: relative;
  display: inline-block;
  width: calc(44px * var(--ui-scale));
  height: calc(24px * var(--ui-scale));
  flex-shrink: 0;
}

.ui-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.ui-toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.2);
  border-radius: calc(24px * var(--ui-scale));
  transition: 0.2s;
}

.ui-toggle-slider:before {
  position: absolute;
  content: "";
  height: calc(18px * var(--ui-scale));
  width: calc(18px * var(--ui-scale));
  left: calc(3px * var(--ui-scale));
  bottom: calc(3px * var(--ui-scale));
  background-color: white;
  border-radius: 50%;
  transition: 0.2s;
}

.ui-toggle input:checked + .ui-toggle-slider {
  background-color: var(--color-primary);
}

.ui-toggle input:checked + .ui-toggle-slider:before {
  transform: translateX(calc(20px * var(--ui-scale)));
}

.ui-toggle input:disabled + .ui-toggle-slider {
  opacity: 0.5;
  cursor: not-allowed;
}

.ui-toggle-label {
  margin-left: var(--space-sm);
  font-size: var(--font-base);
  color: var(--text-color);
  line-height: 1.5;
}

/* ============ Window Zone Settings ============ */
.window-zone-preview {
  margin-top: var(--space-md);
}

.window-zone-values {
  display: flex;
  gap: var(--space-xl);
  padding: var(--space-md);
  background: rgba(0, 0, 0, 0.2);
  border-radius: calc(4px * var(--ui-scale));
  font-family: monospace;
  font-size: var(--font-sm);
}

.window-zone-values strong {
  color: var(--accent-color);
}

/* ============ Visual Keyboard ============ */
.visual-keyboard {
  display: flex;
  flex-direction: column;
  gap: calc(4px * var(--ui-scale));
  padding: calc(12px * var(--ui-scale));
  background: rgba(0, 0, 0, 0.3);
  border-radius: calc(8px * var(--ui-scale));
  margin-top: var(--space-sm);
}

.vk-row {
  display: flex;
  gap: calc(4px * var(--ui-scale));
  justify-content: center;
}

.vk-key {
  min-width: calc(36px * var(--ui-scale));
  height: calc(36px * var(--ui-scale));
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.1);
  border: calc(1px * var(--ui-scale)) solid rgba(255, 255, 255, 0.2);
  border-radius: calc(4px * var(--ui-scale));
  font-size: calc(11px * var(--ui-scale));
  font-weight: 600;
  color: var(--text-muted);
  transition: all 0.1s ease;
  user-select: none;
}

.vk-key.active {
  background: linear-gradient(to bottom, #4ade80, #22c55e);
  border-color: #22c55e;
  color: black;
  transform: scale(0.95);
  box-shadow: 0 0 calc(10px * var(--ui-scale)) rgba(74, 222, 128, 0.5);
}

.vk-key.vk-med {
  min-width: calc(50px * var(--ui-scale));
}

.vk-key.vk-wide {
  min-width: calc(70px * var(--ui-scale));
}

.vk-key.vk-extra-wide {
  min-width: calc(90px * var(--ui-scale));
}

.vk-key.vk-space {
  min-width: calc(200px * var(--ui-scale));
}

/* ============ Custom Dropdown ============ */
.ui-dropdown {
  position: relative;
  display: inline-block;
  min-width: calc(150px * var(--ui-scale));
}

.ui-dropdown-trigger {
  display: flex;
  align-items: center;
  gap: calc(8px * var(--ui-scale));
  padding: calc(8px * var(--ui-scale)) calc(12px * var(--ui-scale));
  background: rgba(255, 255, 255, 0.1);
  border: calc(1px * var(--ui-scale)) solid rgba(255, 255, 255, 0.2);
  border-radius: calc(6px * var(--ui-scale));
  cursor: pointer;
  transition: all 0.15s;
  font-size: var(--font-base);
  color: var(--text-color);
}

.ui-dropdown-trigger.hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.3);
}

.ui-dropdown-trigger:focus {
  outline: none;
  border-color: var(--accent-color);
  box-shadow: 0 0 0 calc(2px * var(--ui-scale)) rgba(74, 222, 128, 0.3);
}

.ui-dropdown-trigger.placeholder .ui-dropdown-label {
  color: var(--text-muted);
}

.ui-dropdown-label {
  flex: 1;
}

.ui-dropdown-arrow {
  font-size: calc(10px * var(--ui-scale));
  opacity: 0.6;
  transition: transform 0.15s;
}

.ui-dropdown.open .ui-dropdown-arrow {
  transform: rotate(180deg);
}

.ui-dropdown-icon {
  font-size: calc(16px * var(--ui-scale));
}

.ui-dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: calc(4px * var(--ui-scale));
  background: rgba(30, 30, 40, 0.98);
  border: calc(1px * var(--ui-scale)) solid rgba(255, 255, 255, 0.15);
  border-radius: calc(6px * var(--ui-scale));
  box-shadow: 0 calc(8px * var(--ui-scale)) calc(24px * var(--ui-scale)) rgba(0, 0, 0, 0.4);
  z-index: 1000;
  max-height: calc(250px * var(--ui-scale));
  overflow-y: auto;
  opacity: 0;
  visibility: hidden;
  transform: translateY(calc(-8px * var(--ui-scale)));
  transition: all 0.15s;
}

.ui-dropdown.open .ui-dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.ui-dropdown-item {
  display: flex;
  align-items: center;
  gap: calc(8px * var(--ui-scale));
  padding: calc(8px * var(--ui-scale)) calc(12px * var(--ui-scale));
  cursor: pointer;
  transition: background 0.1s;
  font-size: var(--font-base);
}

.ui-dropdown-item.hover {
  background: rgba(255, 255, 255, 0.1);
}

.ui-dropdown-item.selected {
  background: rgba(74, 222, 128, 0.2);
}

.ui-dropdown-item.disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.ui-dropdown-item.add-new {
  border-top: calc(1px * var(--ui-scale)) solid rgba(255, 255, 255, 0.1);
  color: var(--accent-color);
}

.ui-dropdown-item-label {
  flex: 1;
}

.ui-dropdown-badge {
  font-size: var(--font-xs);
  padding: calc(2px * var(--ui-scale)) calc(6px * var(--ui-scale));
  background: rgba(255, 255, 255, 0.15);
  border-radius: calc(4px * var(--ui-scale));
  color: var(--text-muted);
}

/* ============ Unicode Picker ============ */
.ui-unicode-picker {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: calc(200px * var(--ui-scale));
  background: rgba(0, 0, 0, 0.3);
  border-radius: calc(6px * var(--ui-scale));
  border: 1px solid rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

.ucp-search {
  padding: calc(10px * var(--ui-scale));
  background: rgba(0, 0, 0, 0.2);
  flex-shrink: 0;
}

.ucp-search-input {
  width: 100%;
  padding: calc(8px * var(--ui-scale)) calc(12px * var(--ui-scale));
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: calc(4px * var(--ui-scale));
  color: var(--text-color);
  font-size: var(--font-sm);
}

.ucp-search-input:focus {
  outline: none;
  border-color: var(--accent-color);
  background: rgba(255, 255, 255, 0.12);
}

.ucp-search-input::placeholder {
  color: var(--text-muted);
}

.ucp-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: calc(4px * var(--ui-scale));
  padding: calc(8px * var(--ui-scale)) calc(10px * var(--ui-scale));
  background: rgba(0, 0, 0, 0.15);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  max-height: calc(70px * var(--ui-scale));
  overflow-y: auto;
  flex-shrink: 0;
}

.ucp-tab {
  padding: calc(4px * var(--ui-scale)) calc(8px * var(--ui-scale));
  background: rgba(255, 255, 255, 0.06);
  border-radius: calc(3px * var(--ui-scale));
  cursor: pointer;
  font-size: calc(11px * var(--ui-scale));
  white-space: nowrap;
  transition: all 0.1s;
  color: var(--text-muted);
}

.ucp-tab.hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-color);
}

.ucp-tab.active {
  background: var(--accent-color);
  color: black;
  font-weight: 600;
}

.ucp-grid-container {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  position: relative;
  padding: calc(8px * var(--ui-scale));
  min-height: calc(100px * var(--ui-scale));
}

.ucp-grid {
  position: relative;
  width: 100%;
}

.ucp-cell {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.06);
  border-radius: calc(3px * var(--ui-scale));
  cursor: pointer;
  transition: all 0.1s;
  user-select: none;
  border: 1px solid transparent;
}

.ucp-cell.hover {
  background: rgba(74, 222, 128, 0.25);
  border-color: var(--accent-color);
  transform: scale(1.15);
  z-index: 10;
}

.ucp-cell.favorite {
  box-shadow: inset 0 0 0 2px rgba(255, 215, 0, 0.4);
}

.ucp-preview {
  display: flex;
  align-items: center;
  gap: calc(12px * var(--ui-scale));
  padding: calc(10px * var(--ui-scale)) calc(12px * var(--ui-scale));
  background: rgba(0, 0, 0, 0.25);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  min-height: calc(44px * var(--ui-scale));
  flex-shrink: 0;
}

.ucp-preview-char {
  font-size: calc(24px * var(--ui-scale));
  min-width: calc(36px * var(--ui-scale));
  text-align: center;
  background: rgba(255, 255, 255, 0.08);
  border-radius: calc(4px * var(--ui-scale));
  padding: calc(4px * var(--ui-scale));
}

.ucp-preview-info {
  font-size: calc(11px * var(--ui-scale));
  color: var(--text-muted);
  font-family: 'Consolas', 'Monaco', monospace;
}

/* ============ Emoji Picker ============ */
.ui-emoji-picker {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: calc(200px * var(--ui-scale));
  background: rgba(0, 0, 0, 0.3);
  border-radius: calc(6px * var(--ui-scale));
  border: 1px solid rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

.emp-search {
  padding: calc(10px * var(--ui-scale));
  background: rgba(0, 0, 0, 0.2);
  flex-shrink: 0;
}

.emp-search-input {
  width: 100%;
  padding: calc(8px * var(--ui-scale)) calc(12px * var(--ui-scale));
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: calc(4px * var(--ui-scale));
  color: var(--text-color);
  font-size: var(--font-sm);
}

.emp-search-input:focus {
  outline: none;
  border-color: var(--accent-color);
  background: rgba(255, 255, 255, 0.12);
}

.emp-search-input::placeholder {
  color: var(--text-muted);
}

.emp-categories {
  display: flex;
  gap: calc(3px * var(--ui-scale));
  padding: calc(8px * var(--ui-scale)) calc(10px * var(--ui-scale));
  background: rgba(0, 0, 0, 0.15);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  overflow-x: auto;
  flex-shrink: 0;
}

.emp-cat {
  padding: calc(6px * var(--ui-scale)) calc(10px * var(--ui-scale));
  background: rgba(255, 255, 255, 0.06);
  border-radius: calc(4px * var(--ui-scale));
  cursor: pointer;
  font-size: calc(16px * var(--ui-scale));
  transition: all 0.1s;
  flex-shrink: 0;
}

.emp-cat.hover {
  background: rgba(255, 255, 255, 0.12);
}

.emp-cat.active {
  background: var(--accent-color);
  transform: scale(1.05);
}

.emp-grid-container {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  position: relative;
  padding: calc(8px * var(--ui-scale));
  min-height: calc(100px * var(--ui-scale));
}

.emp-grid {
  position: relative;
  width: 100%;
}

.emp-cell {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border-radius: calc(4px * var(--ui-scale));
  cursor: pointer;
  transition: all 0.1s;
  user-select: none;
}

.emp-cell.hover {
  background: rgba(255, 255, 255, 0.15);
  transform: scale(1.25);
  z-index: 10;
}

/* ============ Keyboard Pickers Section ============ */
.keyboard-pickers {
  margin-top: var(--space-lg);
  background: rgba(0, 0, 0, 0.25);
  border-radius: calc(8px * var(--ui-scale));
  border: 1px solid rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.picker-tabs {
  display: flex;
  background: rgba(0, 0, 0, 0.2);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.picker-tab {
  padding: calc(12px * var(--ui-scale)) calc(24px * var(--ui-scale));
  cursor: pointer;
  font-size: var(--font-base);
  color: var(--text-muted);
  transition: all 0.15s;
  border-bottom: calc(3px * var(--ui-scale)) solid transparent;
  font-weight: 500;
}

.picker-tab.hover {
  color: var(--text-color);
  background: rgba(255, 255, 255, 0.05);
}

.picker-tab.active {
  color: var(--accent-color);
  border-bottom-color: var(--accent-color);
  background: rgba(74, 222, 128, 0.05);
}

.picker-container {
  height: calc(280px * var(--ui-scale));
  padding: 0;
}

.picker-output {
  display: flex;
  align-items: center;
  gap: calc(10px * var(--ui-scale));
  padding: calc(12px * var(--ui-scale)) calc(14px * var(--ui-scale));
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.2);
}

.picker-output label {
  font-size: var(--font-sm);
  color: var(--text-muted);
  white-space: nowrap;
  font-weight: 500;
}

.picker-output input {
  flex: 1;
  padding: calc(10px * var(--ui-scale)) calc(14px * var(--ui-scale));
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: calc(4px * var(--ui-scale));
  color: var(--text-color);
  font-size: var(--font-base);
  font-family: 'Consolas', 'Monaco', monospace;
}

.picker-output input:focus {
  outline: none;
  border-color: var(--accent-color);
}

.picker-output .settings-btn {
  padding: calc(10px * var(--ui-scale)) calc(16px * var(--ui-scale));
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-color);
  font-size: var(--font-sm);
}

.picker-output .settings-btn.hover {
  background: rgba(255, 255, 255, 0.2);
}

/* ============ Remap Dialog ============ */
.remap-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  /* backdrop-filter removed for performance - causes severe FPS drops */
}

.remap-dialog-container {
  width: calc(480px * var(--ui-scale));
  max-width: 90vw;
  max-height: 90vh;
  background: var(--window-bg);
  border-radius: calc(10px * var(--ui-scale));
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.remap-dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(14px * var(--ui-scale)) calc(18px * var(--ui-scale));
  background: var(--window-titlebar-bg);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  font-size: var(--font-lg);
  font-weight: 600;
}

.remap-dialog-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: calc(24px * var(--ui-scale));
  cursor: pointer;
  padding: 0;
  line-height: 1;
  transition: color 0.15s;
}

.remap-dialog-close.hover {
  color: #ef4444;
}

.remap-dialog-body {
  padding: calc(16px * var(--ui-scale));
  display: flex;
  flex-direction: column;
  gap: calc(14px * var(--ui-scale));
  overflow-y: auto;
}

.remap-dialog {
  padding: calc(16px * var(--ui-scale));
  display: flex;
  flex-direction: column;
  gap: calc(14px * var(--ui-scale));
  height: 100%;
}

.remap-header {
  display: flex;
  align-items: center;
  gap: calc(12px * var(--ui-scale));
  padding-bottom: calc(12px * var(--ui-scale));
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.remap-key-preview {
  width: calc(48px * var(--ui-scale));
  height: calc(48px * var(--ui-scale));
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(74, 222, 128, 0.3), rgba(74, 222, 128, 0.1));
  border: 2px solid var(--accent-color);
  border-radius: calc(6px * var(--ui-scale));
  font-size: calc(18px * var(--ui-scale));
  font-weight: 700;
}

.remap-key-code {
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: var(--font-sm);
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.08);
  padding: calc(4px * var(--ui-scale)) calc(8px * var(--ui-scale));
  border-radius: calc(4px * var(--ui-scale));
}

.remap-modifiers {
  display: flex;
  gap: calc(16px * var(--ui-scale));
  flex-wrap: wrap;
}

.remap-mod-toggle {
  display: flex;
  align-items: center;
  gap: calc(6px * var(--ui-scale));
  cursor: pointer;
  font-size: var(--font-sm);
  color: var(--text-muted);
  padding: calc(6px * var(--ui-scale)) calc(10px * var(--ui-scale));
  background: rgba(255, 255, 255, 0.05);
  border-radius: calc(4px * var(--ui-scale));
  transition: all 0.15s;
}

.remap-mod-toggle.hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-color);
}

.remap-mod-toggle input[type="checkbox"] {
  accent-color: var(--accent-color);
}

.remap-current {
  display: flex;
  align-items: center;
  gap: calc(10px * var(--ui-scale));
  font-size: var(--font-sm);
}

.remap-current label {
  color: var(--text-muted);
}

.remap-current-value {
  font-family: 'Consolas', 'Monaco', monospace;
  background: rgba(255, 255, 255, 0.08);
  padding: calc(4px * var(--ui-scale)) calc(10px * var(--ui-scale));
  border-radius: calc(4px * var(--ui-scale));
  min-width: calc(60px * var(--ui-scale));
}

.remap-input-section {
  display: flex;
  flex-direction: column;
  gap: calc(6px * var(--ui-scale));
}

.remap-input-section label {
  font-size: var(--font-sm);
  color: var(--text-muted);
}

.remap-input {
  padding: calc(10px * var(--ui-scale)) calc(14px * var(--ui-scale));
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: calc(4px * var(--ui-scale));
  color: var(--text-color);
  font-size: var(--font-base);
  font-family: 'Consolas', 'Monaco', monospace;
}

.remap-input:focus {
  outline: none;
  border-color: var(--accent-color);
  background: rgba(255, 255, 255, 0.12);
}

.remap-pickers {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: calc(200px * var(--ui-scale));
  max-height: calc(280px * var(--ui-scale));
  background: rgba(0, 0, 0, 0.2);
  border-radius: calc(6px * var(--ui-scale));
  overflow: hidden;
}

.remap-picker-tabs {
  display: flex;
  background: rgba(0, 0, 0, 0.2);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  flex-shrink: 0;
}

.remap-picker-tab {
  padding: calc(8px * var(--ui-scale)) calc(16px * var(--ui-scale));
  cursor: pointer;
  font-size: var(--font-sm);
  color: var(--text-muted);
  transition: all 0.15s;
}

.remap-picker-tab.hover {
  color: var(--text-color);
  background: rgba(255, 255, 255, 0.05);
}

.remap-picker-tab.active {
  color: var(--accent-color);
  border-bottom: 2px solid var(--accent-color);
}

.remap-picker-content {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: visible;
}

/* Ensure pickers inside remap dialog fill their container and scroll properly */
.remap-picker-content .ui-unicode-picker,
.remap-picker-content .ui-emoji-picker {
  flex: 1;
  min-height: 0;
  height: auto;
}

.remap-picker-content .ucp-grid-container,
.remap-picker-content .emp-grid-container {
  flex: 1;
  min-height: 0;
  overflow-y: auto !important;
}

.remap-actions {
  display: flex;
  justify-content: flex-end;
  gap: calc(10px * var(--ui-scale));
  padding-top: calc(12px * var(--ui-scale));
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.remap-save {
  background: var(--accent-color) !important;
  color: black !important;
  font-weight: 600;
}

.remap-save.hover {
  background: var(--accent-hover) !important;
}

/* Clickable visual keyboard keys */
.vk-key {
  cursor: pointer;
}

.vk-key.hover:not(.active) {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.3);
}

/* Keyboard layout row */
.keyboard-layout-row {
  display: flex;
  align-items: center;
  gap: calc(10px * var(--ui-scale));
  flex-wrap: wrap;
}

.layout-action {
  padding: calc(8px * var(--ui-scale)) calc(14px * var(--ui-scale)) !important;
  font-size: var(--font-sm) !important;
  background: rgba(255, 255, 255, 0.08) !important;
}

.layout-action.hover {
  background: rgba(255, 255, 255, 0.15) !important;
}

#deleteLayoutBtn.hover {
  background: rgba(239, 68, 68, 0.2) !important;
  color: #ef4444;
}

/* ============ Placeholder App ============ */
.placeholder-app {
  text-align: center;
  padding: var(--space-xl);
}

.placeholder-app h2 {
  margin-bottom: var(--space-lg);
  color: var(--accent-color);
  font-size: var(--font-xl);
}

.placeholder-counter {
  font-size: calc(4rem * var(--ui-scale));
  font-weight: bold;
  margin: var(--space-xl) 0;
  color: var(--accent-color);
}

.placeholder-buttons {
  display: flex;
  justify-content: center;
  gap: var(--space-lg);
  margin-bottom: var(--space-xl);
}

.placeholder-btn {
  width: calc(60px * var(--ui-scale));
  height: calc(60px * var(--ui-scale));
  font-size: var(--font-2xl);
  border: none;
  border-radius: calc(10px * var(--ui-scale));
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-color);
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}

.placeholder-btn.hover {
  background: rgba(255, 255, 255, 0.2);
}

.placeholder-btn:active {
  transform: scale(0.95);
}

.placeholder-info {
  color: var(--text-muted);
  font-size: var(--font-base);
}

/* ============ FileBrowser App ============ */
.filebrowser {
  display: flex;
  flex-direction: column;
  height: 100%;
  margin: calc(-1 * var(--space-lg)); /* Counteract window content padding */
}

.filebrowser-toolbar {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-lg);
  background: rgba(0, 0, 0, 0.2);
  border-bottom: 1px solid var(--border-color);
}

.fb-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: calc(36px * var(--ui-scale));
  height: calc(36px * var(--ui-scale));
  border: none;
  border-radius: calc(6px * var(--ui-scale));
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-color);
  cursor: pointer;
  font-size: var(--font-lg);
  transition: background 0.15s;
}

.fb-btn.hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.2);
}

.fb-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.fb-btn-danger.hover:not(:disabled) {
  background: rgba(239, 68, 68, 0.3);
  color: #ef4444;
}

.fb-icon {
  font-size: var(--font-base);
}

.fb-path {
  flex: 1;
  padding: var(--space-sm) var(--space-lg);
  background: rgba(0, 0, 0, 0.3);
  border-radius: calc(6px * var(--ui-scale));
  font-family: monospace;
  font-size: var(--font-base);
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin: 0 var(--space-sm);
}

.fb-toolbar-spacer {
  width: 1px;
  height: calc(24px * var(--ui-scale));
  background: var(--border-color);
  margin: 0 var(--space-sm);
}

.filebrowser-list {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-sm);
}

.fb-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-muted);
  font-size: var(--font-lg);
}

.fb-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-lg);
  border-radius: calc(6px * var(--ui-scale));
  cursor: pointer;
  transition: background 0.1s;
  user-select: none;
}

.fb-item.hover {
  background: rgba(255, 255, 255, 0.05);
}

.fb-item.selected {
  background: rgba(74, 222, 128, 0.15);
  outline: 1px solid var(--accent-color);
}

.fb-item-icon {
  font-size: var(--font-2xl);
  width: calc(32px * var(--ui-scale));
  text-align: center;
}

.fb-item-name {
  flex: 1;
  font-size: var(--font-base);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fb-item-size {
  width: calc(80px * var(--ui-scale));
  text-align: right;
  color: var(--text-muted);
  font-size: var(--font-sm);
}

.fb-item-modified {
  width: calc(150px * var(--ui-scale));
  text-align: right;
  color: var(--text-muted);
  font-size: var(--font-sm);
}

.filebrowser-status {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  padding: var(--space-sm) var(--space-lg);
  background: rgba(0, 0, 0, 0.2);
  border-top: 1px solid var(--border-color);
  font-size: var(--font-sm);
  color: var(--text-muted);
}

/* File Browser - Trash Mode */
.fb-toolbar-divider {
  width: 1px;
  height: 24px;
  background: var(--border-color);
  margin: 0 var(--space-sm);
}

.fb-trash-toggle {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.fb-btn-label {
  font-size: var(--font-sm);
}

.fb-trash-toggle.active {
  background: rgba(239, 68, 68, 0.3);
  border-color: rgba(239, 68, 68, 0.5);
  color: #ef4444;
}

.fb-trash-toggle.active.hover {
  background: rgba(239, 68, 68, 0.4);
}

.filebrowser.trash-mode .filebrowser-toolbar {
  background: rgba(239, 68, 68, 0.1);
  border-bottom-color: rgba(239, 68, 68, 0.3);
}

.filebrowser.trash-mode .fb-path {
  color: #ef4444;
}

.fb-trash-item {
  grid-template-columns: 32px 1fr 1.5fr 120px 80px;
}

.fb-item-original-path {
  color: var(--text-muted);
  font-size: var(--font-sm);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fb-item-trashed-date {
  color: var(--text-muted);
  font-size: var(--font-sm);
  text-align: right;
}

/* ============ Folder Picker Dialog ============ */
.folder-picker-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}

.folder-picker-dialog {
  background: var(--surface-bg);
  border: 1px solid var(--border-color);
  border-radius: calc(12px * var(--ui-scale));
  min-width: calc(400px * var(--ui-scale));
  max-width: calc(600px * var(--ui-scale));
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.folder-picker-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--border-color);
  font-weight: 600;
  font-size: var(--font-lg);
}

.folder-picker-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: var(--font-lg);
  padding: var(--space-xs);
  border-radius: 4px;
  transition: background 0.15s;
}

.folder-picker-close.hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-color);
}

.folder-picker-tree {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-sm) 0;
  max-height: calc(400px * var(--ui-scale));
}

.folder-picker-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  cursor: pointer;
  transition: background 0.1s;
  user-select: none;
}

.folder-picker-item.hover {
  background: rgba(255, 255, 255, 0.05);
}

.folder-picker-item.selected {
  background: rgba(74, 222, 128, 0.15);
}

.folder-picker-expand {
  width: 16px;
  text-align: center;
  font-size: var(--font-xs);
  color: var(--text-muted);
}

.folder-picker-expand.hidden {
  visibility: hidden;
}

.folder-picker-icon {
  font-size: var(--font-base);
}

.folder-picker-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.folder-picker-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-md) var(--space-lg);
  border-top: 1px solid var(--border-color);
  gap: var(--space-md);
}

.folder-picker-selected {
  flex: 1;
  color: var(--text-muted);
  font-size: var(--font-sm);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.folder-picker-buttons {
  display: flex;
  gap: var(--space-sm);
}

/* Conflict dialog */
.conflict-dialog {
  min-width: calc(350px * var(--ui-scale));
}

.conflict-content {
  padding: var(--space-lg);
}

.conflict-content p {
  margin: 0 0 var(--space-sm) 0;
}

.conflict-content p:last-child {
  margin-bottom: 0;
  color: var(--text-muted);
}

/* ============ Drag & Drop Styles ============ */
.filebrowser.drag-mode .fb-path {
  display: none;
}

.filebrowser.drag-mode .fb-path-segments {
  display: flex;
}

.fb-path-segments {
  display: none;
  align-items: center;
  gap: calc(4px * var(--ui-scale));
  flex: 1;
  overflow-x: auto;
}

.fb-path-seg {
  padding: calc(4px * var(--ui-scale)) calc(8px * var(--ui-scale));
  border-radius: calc(4px * var(--ui-scale));
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  font-size: var(--font-sm);
}

.fb-path-seg.hover {
  background: rgba(255, 255, 255, 0.15);
}

.fb-path-seg.drop-target {
  border-color: var(--accent-color);
  background: rgba(74, 222, 128, 0.2);
  box-shadow: 0 0 8px rgba(74, 222, 128, 0.3);
}

.fb-path-sep {
  color: var(--text-muted);
  font-size: var(--font-sm);
}

/* Drop targets on buttons */
.fb-btn.drop-target {
  border: 2px solid var(--accent-color) !important;
  background: rgba(74, 222, 128, 0.2) !important;
  box-shadow: 0 0 8px rgba(74, 222, 128, 0.3);
}

.fb-btn.drop-target-danger {
  border: 2px solid #ef4444 !important;
  background: rgba(239, 68, 68, 0.2) !important;
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.3);
}

/* Folder drop target in list */
.fb-item[data-type="dir"].drop-target {
  background: rgba(74, 222, 128, 0.2);
  outline: 2px solid var(--accent-color);
}

/* Dragging item visual */
.fb-item.dragging {
  opacity: 0.5;
}

/* Droppable hint - subtle highlight for valid drop targets in drag mode */
.fb-path-seg.droppable-hint {
  border-color: rgba(74, 222, 128, 0.3);
  background: rgba(74, 222, 128, 0.08);
}

.fb-btn.droppable-hint {
  border: 2px solid rgba(74, 222, 128, 0.3) !important;
  background: rgba(74, 222, 128, 0.08) !important;
}

.fb-btn.droppable-hint-danger {
  border: 2px solid rgba(239, 68, 68, 0.3) !important;
  background: rgba(239, 68, 68, 0.08) !important;
}

/* ============ UI Dialogs ============ */
.ui-dialog-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  opacity: 0;
  transition: opacity 0.15s;
  /* backdrop-filter removed for performance - causes severe FPS drops */
}

.ui-dialog-overlay.visible {
  opacity: 1;
}

.ui-dialog {
  background: var(--window-bg);
  border: 1px solid var(--border-color);
  border-radius: calc(12px * var(--ui-scale));
  min-width: calc(320px * var(--ui-scale));
  max-width: calc(500px * var(--ui-scale));
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  transform: scale(0.9);
  transition: transform 0.15s;
}

.ui-dialog-overlay.visible .ui-dialog {
  transform: scale(1);
}

.ui-dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) var(--space-lg);
  background: var(--window-titlebar-bg);
  border-bottom: 1px solid var(--border-color);
  border-radius: calc(12px * var(--ui-scale)) calc(12px * var(--ui-scale)) 0 0;
}

.ui-dialog-title {
  font-size: var(--font-lg);
  font-weight: 500;
  color: var(--text-color);
}

.ui-dialog-close {
  width: var(--window-btn-size);
  height: var(--window-btn-size);
  border: none;
  border-radius: calc(6px * var(--ui-scale));
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
  cursor: pointer;
  font-size: var(--font-xl);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}

.ui-dialog-close.hover {
  background: #ef4444;
  color: white;
}

.ui-dialog-body {
  padding: var(--space-xl);
}

.ui-dialog-message {
  font-size: var(--font-base);
  color: var(--text-color);
  margin: 0;
  line-height: 1.5;
}

.ui-dialog-message strong {
  color: var(--accent-color);
}

.ui-dialog-label {
  display: block;
  font-size: var(--font-base);
  color: var(--text-color);
  margin-bottom: var(--space-sm);
}

.ui-dialog-input {
  width: 100%;
  padding: var(--space-md) var(--space-lg);
  font-size: var(--font-base);
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-color);
  border-radius: calc(6px * var(--ui-scale));
  color: var(--text-color);
  outline: none;
  transition: border-color 0.15s;
}

.ui-dialog-input:focus {
  border-color: var(--accent-color);
}

.ui-dialog-list {
  margin: var(--space-md) 0 0 0;
  padding-left: var(--space-xl);
  color: var(--text-muted);
  font-size: var(--font-sm);
}

.ui-dialog-list li {
  margin: var(--space-xs) 0;
}

.ui-dialog-footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-lg);
  background: rgba(0, 0, 0, 0.2);
  border-top: 1px solid var(--border-color);
  border-radius: 0 0 calc(12px * var(--ui-scale)) calc(12px * var(--ui-scale));
}

.ui-dialog-btn {
  padding: var(--space-sm) var(--space-xl);
  font-size: var(--font-base);
  border: none;
  border-radius: calc(6px * var(--ui-scale));
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-color);
}

.ui-dialog-btn.hover {
  background: rgba(255, 255, 255, 0.2);
}

.ui-dialog-btn:active {
  transform: scale(0.97);
}

.ui-dialog-btn.primary {
  background: var(--accent-color);
  color: #000;
}

.ui-dialog-btn.primary.hover {
  background: var(--accent-hover);
}

.ui-dialog-btn.danger {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
}

.ui-dialog-btn.danger.hover {
  background: #ef4444;
  color: white;
}

/* ============ UI Tooltips ============ */
.ui-tooltip {
  position: fixed;
  padding: var(--space-sm) var(--space-md);
  background: rgba(0, 0, 0, 0.9);
  color: var(--text-color);
  font-size: var(--font-sm);
  border-radius: calc(4px * var(--ui-scale));
  pointer-events: none;
  z-index: 10001;
  opacity: 0;
  transition: opacity 0.15s;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.ui-tooltip.visible {
  opacity: 1;
}

/* ============ UI Sliders ============ */
.ui-slider {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  width: 100%;
  max-width: calc(400px * var(--ui-scale));
  outline: none;
}

.ui-slider:focus .ui-slider-thumb {
  box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.4);
}

.ui-slider-track {
  position: relative;
  flex: 1;
  height: calc(12px * var(--ui-scale));
  background: rgba(255, 255, 255, 0.1);
  border-radius: calc(6px * var(--ui-scale));
  cursor: pointer;
  transition: background 0.15s;
}

.ui-slider-track.hover {
  background: rgba(255, 255, 255, 0.15);
}

.ui-slider.dragging .ui-slider-track {
  background: rgba(255, 255, 255, 0.2);
}

.ui-slider-fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--accent-color), var(--accent-hover));
  border-radius: calc(6px * var(--ui-scale));
  pointer-events: none;
  transition: width 0.05s ease-out;
}

.ui-slider-thumb {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: calc(28px * var(--ui-scale));
  height: calc(28px * var(--ui-scale));
  background: var(--accent-color);
  border: calc(3px * var(--ui-scale)) solid white;
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  pointer-events: none;
  transition: transform 0.1s, box-shadow 0.15s;
}

.ui-slider.dragging .ui-slider-thumb {
  transform: translate(-50%, -50%) scale(1.15);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.ui-slider-value {
  min-width: calc(60px * var(--ui-scale));
  padding: var(--space-sm) var(--space-md);
  background: rgba(0, 0, 0, 0.3);
  border-radius: calc(6px * var(--ui-scale));
  font-size: var(--font-base);
  font-weight: 500;
  text-align: center;
  color: var(--accent-color);
}

/* ============ UI Buttons ============ */
.ui-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: calc(6px * var(--ui-scale));
  padding: calc(8px * var(--ui-scale)) calc(14px * var(--ui-scale));
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: calc(6px * var(--ui-scale));
  color: var(--text-color);
  font-size: calc(14px * var(--ui-scale));
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
  outline: none;
  text-decoration: none;
}

.ui-btn.hover {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.25);
}

.ui-btn:active {
  transform: scale(0.97);
  background: rgba(255, 255, 255, 0.12);
}

.ui-btn:focus-visible {
  box-shadow: 0 0 0 2px var(--accent-color);
}

.ui-btn.primary {
  background: var(--accent-color);
  border-color: var(--accent-color);
  color: #000;
  font-weight: 500;
}

.ui-btn.primary.hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.ui-btn.danger {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.3);
  color: #ef4444;
}

.ui-btn.danger.hover {
  background: #ef4444;
  border-color: #ef4444;
  color: white;
}

.ui-btn.small {
  padding: calc(5px * var(--ui-scale)) calc(10px * var(--ui-scale));
  font-size: calc(12px * var(--ui-scale));
}

.ui-btn .material-symbols-outlined {
  font-size: calc(18px * var(--ui-scale));
}

.ui-btn.small .material-symbols-outlined {
  font-size: calc(14px * var(--ui-scale));
}

.ui-btn.icon-only {
  padding: calc(8px * var(--ui-scale));
}

.ui-btn.icon-only.small {
  padding: calc(5px * var(--ui-scale));
}

/* ============ UI Checkbox ============ */
.ui-checkbox {
  /* Checkbox styles are mostly handled inline by createCheckbox() */
  /* Native checkbox styling can be enhanced here if needed */
}

.ui-checkbox input[type="checkbox"] {
  accent-color: var(--color-primary);
}

/* ============ UI Toast Notifications ============ */
.ui-toast-container {
  position: fixed;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  pointer-events: none;
  max-width: calc(400px * var(--ui-scale));
}

.ui-toast-container[data-position="top-right"] {
  top: var(--space-lg);
  right: var(--space-lg);
}

.ui-toast-container[data-position="top-center"] {
  top: var(--space-lg);
  left: 50%;
  transform: translateX(-50%);
}

.ui-toast-container[data-position="bottom-right"] {
  bottom: var(--space-lg);
  right: var(--space-lg);
}

.ui-toast-container[data-position="bottom-center"] {
  bottom: var(--space-lg);
  left: 50%;
  transform: translateX(-50%);
}

.ui-toast {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-md);
  background: rgba(20, 20, 30, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: calc(8px * var(--ui-scale));
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  pointer-events: all;
  opacity: 0;
  transform: translateY(calc(-10px * var(--ui-scale)));
  transition: opacity 0.3s, transform 0.3s;
}

.ui-toast.visible {
  opacity: 1;
  transform: translateY(0);
}

.ui-toast-icon {
  font-size: calc(20px * var(--ui-scale));
  flex-shrink: 0;
}

.ui-toast[data-type="info"] {
  border-left: calc(4px * var(--ui-scale)) solid #3b82f6;
}

.ui-toast[data-type="info"] .ui-toast-icon {
  color: #3b82f6;
}

.ui-toast[data-type="success"] {
  border-left: calc(4px * var(--ui-scale)) solid #10b981;
}

.ui-toast[data-type="success"] .ui-toast-icon {
  color: #10b981;
}

.ui-toast[data-type="warning"] {
  border-left: calc(4px * var(--ui-scale)) solid #f59e0b;
}

.ui-toast[data-type="warning"] .ui-toast-icon {
  color: #f59e0b;
}

.ui-toast[data-type="error"] {
  border-left: calc(4px * var(--ui-scale)) solid #ef4444;
}

.ui-toast[data-type="error"] .ui-toast-icon {
  color: #ef4444;
}

.ui-toast-message {
  flex: 1;
  font-size: var(--font-base);
  color: var(--text-color);
  line-height: 1.4;
}

.ui-toast-action {
  padding: calc(6px * var(--ui-scale)) calc(12px * var(--ui-scale));
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: calc(4px * var(--ui-scale));
  color: var(--text-color);
  font-size: var(--font-sm);
  cursor: pointer;
  transition: background 0.15s;
}

.ui-toast-action.hover {
  background: rgba(255, 255, 255, 0.2);
}

.ui-toast-close {
  width: calc(24px * var(--ui-scale));
  height: calc(24px * var(--ui-scale));
  padding: 0;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: calc(20px * var(--ui-scale));
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
  transition: color 0.15s;
}

.ui-toast-close.hover {
  color: var(--text-color);
}

/* ============ UI Copyable Block ============ */
.ui-copyable-block {
  position: relative;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: calc(6px * var(--ui-scale));
  overflow: hidden;
}

.ui-copyable-content {
  margin: 0;
  padding: calc(12px * var(--ui-scale));
  padding-right: calc(40px * var(--ui-scale));
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: calc(13px * var(--ui-scale));
  line-height: 1.5;
  color: #a5f3fc;
  white-space: pre-wrap;
  word-break: break-all;
  overflow-x: auto;
}

.ui-copyable-btn {
  position: absolute;
  top: calc(6px * var(--ui-scale));
  right: calc(6px * var(--ui-scale));
  background: rgba(255, 255, 255, 0.1) !important;
}

.ui-copyable-btn.hover {
  background: rgba(255, 255, 255, 0.2) !important;
}

/* ============ UI Dropdown ============ */
/* Note: Uses fixed px values - scaling handled by parent transform */
.ui-dropdown {
  position: relative;
  display: inline-block;
  min-width: 120px;
}

.ui-dropdown.disabled {
  opacity: 0.5;
  pointer-events: none;
}

.ui-dropdown-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
  font-size: 14px;
  color: var(--text-color);
  outline: none;
}

.ui-dropdown-trigger.hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

.ui-dropdown-trigger:focus {
  border-color: var(--accent-color);
  box-shadow: 0 0 0 2px rgba(74, 222, 128, 0.2);
}

.ui-dropdown.open .ui-dropdown-trigger {
  border-color: var(--accent-color);
  background: rgba(0, 0, 0, 0.4);
}

.ui-dropdown-text {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ui-dropdown-arrow {
  font-size: 10px;
  color: var(--text-muted);
  transition: transform 0.2s;
}

.ui-dropdown.open .ui-dropdown-arrow {
  transform: rotate(180deg);
}

.ui-dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 4px;
  background: var(--window-bg);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 4px 0;
  z-index: 10001;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  overflow-y: auto;
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
  transition: opacity 0.15s, transform 0.15s;
}

.ui-dropdown.open .ui-dropdown-menu {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.ui-dropdown-menu.flip-up {
  top: auto;
  bottom: 100%;
  margin-top: 0;
  margin-bottom: 4px;
  transform-origin: bottom center;
}

.ui-dropdown-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  cursor: pointer;
  transition: background 0.1s;
  font-size: 14px;
  color: var(--text-color);
}

.ui-dropdown-item.hover:not(.disabled),
.ui-dropdown-item.highlighted:not(.disabled) {
  background: rgba(255, 255, 255, 0.1);
}

.ui-dropdown-item.selected {
  color: var(--accent-color);
  font-weight: 500;
}

.ui-dropdown-item.selected::after {
  content: '✓';
  margin-left: auto;
  font-size: 12px;
}

.ui-dropdown-item.disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.ui-dropdown-icon {
  font-size: 14px;
  flex-shrink: 0;
}

.ui-dropdown-item-text {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ============ UI Context Menu ============ */
.ui-context-menu {
  position: fixed;
  min-width: calc(180px * var(--ui-scale));
  background: var(--window-bg);
  border: 1px solid var(--border-color);
  border-radius: calc(8px * var(--ui-scale));
  padding: var(--space-xs) 0;
  z-index: 10002;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  /* backdrop-filter removed for performance */
  opacity: 0;
  transform: scale(0.95);
  transform-origin: top left;
  transition: opacity 0.1s, transform 0.1s;
}

.ui-context-menu.visible {
  opacity: 1;
  transform: scale(1);
}

.ui-context-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-lg);
  cursor: pointer;
  transition: background 0.1s;
  font-size: var(--font-base);
  color: var(--text-color);
}

.ui-context-item.hover:not(.disabled) {
  background: rgba(255, 255, 255, 0.1);
}

.ui-context-item:active:not(.disabled) {
  background: rgba(255, 255, 255, 0.15);
}

.ui-context-item.disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.ui-context-icon {
  width: calc(20px * var(--ui-scale));
  text-align: center;
  font-size: var(--font-lg);
}

.ui-context-icon svg {
  width: calc(16px * var(--ui-scale));
  height: calc(16px * var(--ui-scale));
  display: inline-block;
  vertical-align: middle;
}

.ui-context-label {
  flex: 1;
}

.ui-context-shortcut {
  font-size: var(--font-sm);
  color: var(--text-muted);
  margin-left: var(--space-lg);
}

.ui-context-separator {
  height: 1px;
  background: var(--border-color);
  margin: var(--space-xs) var(--space-md);
}

/* ============ File Picker Dialog ============ */

.filepicker-dialog {
  width: calc(600px * var(--ui-scale));
  max-width: 90vw;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
}

.filepicker-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
}

.filepicker-pathbar {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md);
  border-bottom: 1px solid var(--border-color);
  background: rgba(0, 0, 0, 0.2);
}

.filepicker-path-label {
  font-size: var(--font-sm);
  color: var(--text-muted);
}

.filepicker-path {
  flex: 1;
  font-family: 'Consolas', monospace;
  font-size: var(--font-sm);
  color: var(--text-color);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.filepicker-up {
  width: calc(32px * var(--ui-scale));
  height: calc(32px * var(--ui-scale));
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  border-radius: calc(4px * var(--ui-scale));
  color: var(--text-color);
  cursor: pointer;
  font-size: var(--font-lg);
}

.filepicker-up.hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.2);
}

.filepicker-up:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.filepicker-list {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-sm);
  min-height: calc(200px * var(--ui-scale));
  max-height: calc(300px * var(--ui-scale));
}

.filepicker-loading,
.filepicker-empty {
  padding: var(--space-xl);
  text-align: center;
  color: var(--text-muted);
  font-size: var(--font-sm);
}

.filepicker-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-sm) var(--space-md);
  border-radius: calc(4px * var(--ui-scale));
  cursor: pointer;
  transition: background 0.1s;
}

.filepicker-item.hover {
  background: rgba(255, 255, 255, 0.1);
}

.filepicker-item.selected {
  background: var(--accent-color);
  color: #000;
}

.filepicker-item-icon {
  font-size: var(--font-lg);
  width: calc(24px * var(--ui-scale));
  text-align: center;
}

.filepicker-item-name {
  flex: 1;
  font-size: var(--font-base);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.filepicker-item-size {
  font-size: var(--font-sm);
  color: var(--text-muted);
}

.filepicker-item.selected .filepicker-item-size {
  color: rgba(0, 0, 0, 0.6);
}

.filepicker-filename {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md);
  border-top: 1px solid var(--border-color);
}

.filepicker-filename label {
  font-size: var(--font-sm);
  color: var(--text-muted);
  white-space: nowrap;
}

.filepicker-input {
  flex: 1;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-color);
  border-radius: calc(4px * var(--ui-scale));
  padding: var(--space-sm) var(--space-md);
  color: var(--text-color);
  font-size: var(--font-base);
  font-family: 'Consolas', monospace;
}

.filepicker-input:focus {
  outline: none;
  border-color: var(--accent-color);
}

.filepicker-footer {
  padding: var(--space-md);
}

/* ============ Notepad App ============ */

.notepad-app {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--window-bg);
}

.notepad-menubar {
  display: flex;
  border-bottom: 1px solid var(--border-color);
  background: rgba(0, 0, 0, 0.2);
}

.notepad-menu {
  position: relative;
}

.notepad-menu-trigger {
  padding: var(--space-sm) var(--space-md);
  cursor: pointer;
  font-size: var(--font-sm);
  color: var(--text-color);
  user-select: none;
}

.notepad-menu-trigger.hover {
  background: rgba(255, 255, 255, 0.1);
}

.notepad-menu.open .notepad-menu-trigger {
  background: rgba(255, 255, 255, 0.15);
}

.notepad-menu-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: calc(180px * var(--ui-scale));
  background: var(--window-bg);
  border: 1px solid var(--border-color);
  border-radius: calc(4px * var(--ui-scale));
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  display: none;
  z-index: 100;
}

.notepad-menu.open .notepad-menu-dropdown {
  display: block;
}

.notepad-menu-item {
  padding: var(--space-sm) var(--space-md);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: var(--font-sm);
  color: var(--text-color);
}

.notepad-menu-item.hover {
  background: rgba(255, 255, 255, 0.1);
}

.notepad-menu-shortcut {
  font-size: var(--font-xs);
  color: var(--text-muted);
  margin-left: var(--space-lg);
}

.notepad-menu-separator {
  height: 1px;
  background: var(--border-color);
  margin: var(--space-xs) 0;
}

.notepad-textarea {
  flex: 1;
  resize: none;
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
  font-size: var(--font-base);
  padding: var(--space-md);
  border: none;
  outline: none;
  background: rgba(0, 0, 0, 0.2);
  color: var(--text-color);
  line-height: 1.5;
}

.notepad-textarea::placeholder {
  color: var(--text-muted);
}

.notepad-statusbar {
  display: flex;
  justify-content: flex-end;
  padding: var(--space-xs) var(--space-md);
  border-top: 1px solid var(--border-color);
  background: rgba(0, 0, 0, 0.2);
  font-size: var(--font-xs);
  color: var(--text-muted);
}

/* ============ Draw App ============ */

.draw-app {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--window-bg);
}

.draw-toolbar {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-sm) var(--space-md);
  border-bottom: 1px solid var(--border-color);
  background: rgba(0, 0, 0, 0.2);
  flex-wrap: wrap;
}

.draw-tool-group {
  display: flex;
  gap: calc(2px * var(--ui-scale));
}

.draw-tool-btn {
  width: calc(36px * var(--ui-scale));
  height: calc(36px * var(--ui-scale));
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: calc(4px * var(--ui-scale));
  cursor: pointer;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-color);
  font-size: var(--font-lg);
  transition: background 0.1s;
}

.draw-tool-btn svg {
  width: calc(18px * var(--ui-scale, 1));
  height: calc(18px * var(--ui-scale, 1));
  fill: currentColor;
}

.draw-tool-btn.hover {
  background: rgba(255, 255, 255, 0.1);
}

.draw-tool-btn.active {
  background: var(--accent-color);
  color: #000;
  border-color: var(--accent-color);
}

.draw-separator {
  width: 1px;
  height: calc(28px * var(--ui-scale));
  background: var(--border-color);
  margin: 0 var(--space-xs);
}

.draw-color-group {
  display: flex;
  gap: var(--space-sm);
}

.draw-color-box {
  width: calc(32px * var(--ui-scale));
  height: calc(32px * var(--ui-scale));
  border: 2px solid var(--border-color);
  border-radius: calc(4px * var(--ui-scale));
  cursor: pointer;
  transition: border-color 0.1s;
}

.draw-color-box.hover {
  border-color: var(--text-color);
}

.draw-color-input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.draw-slider-group {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.draw-slider-label {
  font-size: var(--font-xs);
  color: var(--text-muted);
  white-space: nowrap;
}

.draw-size-slider,
.draw-tolerance-slider {
  width: calc(80px * var(--ui-scale));
  accent-color: var(--accent-color);
}

.draw-size-value,
.draw-tolerance-value {
  font-size: var(--font-xs);
  color: var(--text-color);
  min-width: calc(24px * var(--ui-scale));
  text-align: right;
}

.draw-action-btn {
  padding: var(--space-xs) var(--space-md);
  border: 1px solid var(--border-color);
  border-radius: calc(4px * var(--ui-scale));
  background: transparent;
  color: var(--text-color);
  font-size: var(--font-sm);
  cursor: pointer;
  transition: background 0.1s, border-color 0.1s;
  display: inline-flex;
  align-items: center;
  gap: calc(4px * var(--ui-scale, 1));
}

.draw-action-btn svg {
  width: calc(14px * var(--ui-scale, 1));
  height: calc(14px * var(--ui-scale, 1));
  fill: currentColor;
}

.draw-action-btn.hover {
  background: rgba(255, 255, 255, 0.1);
}

.draw-action-btn.primary {
  background: var(--accent-color);
  color: #000;
  border-color: var(--accent-color);
}

.draw-action-btn.primary.hover {
  background: var(--accent-hover);
}

.draw-canvas-container {
  flex: 1;
  overflow: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #2a2a3a;
  padding: var(--space-lg);
  position: relative;
}

.draw-canvas-wrapper {
  position: relative;
  display: inline-block;
}

.draw-canvas {
  display: block;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  cursor: crosshair;
  max-width: 100%;
  max-height: 100%;
}

.draw-preview-canvas {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
  max-width: 100%;
  max-height: 100%;
}

.draw-cursor {
  position: absolute;
  pointer-events: none;
  border: 2px solid #000;
  border-radius: 50%;
  transform: translate(0, 0);
  display: none;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.5);
}

/* ============ Window Size Indicator ============ */
.tv-window-size {
  margin-left: var(--space-md);
  padding: var(--space-xs) var(--space-md);
  background: rgba(0, 0, 0, 0.4);
  border-radius: calc(4px * var(--ui-scale));
  font-size: var(--font-sm);
  font-family: 'Consolas', 'Monaco', monospace;
  color: var(--accent-color);
  opacity: 0;
  transform: translateY(-2px);
  transition: opacity 0.15s, transform 0.15s;
  white-space: nowrap;
}

.tv-window-size.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ============ Browser App ============ */

.browser-app {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--window-bg);
}

.browser-toolbar {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-sm) var(--space-md);
  border-bottom: 1px solid var(--border-color);
  background: rgba(0, 0, 0, 0.2);
}

.browser-btn {
  width: calc(32px * var(--ui-scale));
  height: calc(32px * var(--ui-scale));
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-color);
  border-radius: calc(4px * var(--ui-scale));
  background: transparent;
  color: var(--text-color);
  cursor: pointer;
  transition: background 0.1s, border-color 0.1s;
}

.browser-btn.hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--text-muted);
}

.browser-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.browser-btn-icon {
  font-size: var(--font-md);
}

.browser-btn-go {
  background: var(--accent-color);
  color: #000;
  border-color: var(--accent-color);
}

.browser-btn-go.hover:not(:disabled) {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.browser-address-bar {
  flex: 1;
  min-width: 0;
  position: relative;
}

.browser-address-input {
  width: 100%;
  padding: var(--space-sm) var(--space-md);
  border: 1px solid var(--border-color);
  border-radius: calc(4px * var(--ui-scale));
  background: rgba(0, 0, 0, 0.3);
  color: var(--text-color);
  font-size: var(--font-sm);
  outline: none;
  transition: border-color 0.1s;
}

.browser-address-input:focus {
  border-color: var(--accent-color);
}

.browser-address-input::placeholder {
  color: var(--text-muted);
}

.browser-content {
  flex: 1;
  position: relative;
  overflow: hidden;
}

.browser-iframe {
  width: 100%;
  height: 100%;
  border: none;
  background: #fff;
}

.browser-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-muted);
}

.browser-empty-icon {
  font-size: calc(64px * var(--ui-scale));
  margin-bottom: var(--space-md);
  opacity: 0.5;
}

.browser-empty-text {
  font-size: var(--font-lg);
}

.browser-statusbar {
  padding: var(--space-xs) var(--space-md);
  border-top: 1px solid var(--border-color);
  background: rgba(0, 0, 0, 0.2);
  font-size: var(--font-xs);
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Browser Quicklinks Dropdown */
.browser-quicklinks {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: var(--space-xs);
  background: var(--window-bg);
  border: 1px solid var(--border-color);
  border-radius: calc(6px * var(--ui-scale));
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  z-index: 100;
  display: none;
  overflow: hidden;
}

.browser-quicklinks.visible {
  display: block;
}

.browser-quicklinks-header {
  padding: var(--space-sm) var(--space-md);
  font-size: var(--font-xs);
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-color);
  background: rgba(0, 0, 0, 0.2);
}

.browser-quicklinks-list {
  max-height: calc(200px * var(--ui-scale));
  overflow-y: auto;
}

.browser-quicklink {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  cursor: pointer;
  transition: background 0.1s;
}

.browser-quicklink.hover {
  background: rgba(255, 255, 255, 0.1);
}

.browser-quicklink-icon {
  font-size: var(--font-md);
  opacity: 0.7;
}

.browser-quicklink-name {
  font-weight: 500;
  color: var(--text-color);
}

.browser-quicklink-url {
  font-size: var(--font-xs);
  color: var(--text-muted);
  margin-left: auto;
}

/* Browser Empty State Quicklinks */
.browser-empty-quicklinks {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  margin-top: var(--space-lg);
  justify-content: center;
}

.browser-empty-quicklink {
  padding: var(--space-sm) var(--space-lg);
  border: 1px solid var(--accent-color);
  border-radius: calc(20px * var(--ui-scale));
  background: transparent;
  color: var(--accent-color);
  font-size: var(--font-md);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.browser-empty-quicklink.hover {
  background: var(--accent-color);
  color: #000;
}

/* Browser Toolbar Controls */
.browser-separator {
  width: 1px;
  height: calc(24px * var(--ui-scale));
  background: var(--border-color);
  margin: 0 var(--space-xs);
}

.browser-zoom-controls {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.browser-zoom-level {
  min-width: calc(48px * var(--ui-scale));
  text-align: center;
  font-size: var(--font-sm);
  color: var(--text-color);
  font-family: 'Consolas', 'Monaco', monospace;
}

.browser-device-controls {
  display: flex;
  gap: calc(2px * var(--ui-scale));
}

.browser-device-btn.active {
  background: var(--accent-color);
  color: #000;
  border-color: var(--accent-color);
}

/* Browser Viewport (for device simulation) */
.browser-viewport {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.browser-viewport-device {
  height: 100%;
  background: #1a1a2e;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
  border-left: 1px solid var(--border-color);
  border-right: 1px solid var(--border-color);
}

.browser-viewport .browser-iframe {
  width: 100%;
  height: 100%;
}

.browser-viewport .browser-empty {
  height: 100%;
}

/* Browser Status Bar Device Info */
.browser-statusbar {
  display: flex;
  justify-content: space-between;
}

.browser-status-device {
  color: var(--accent-color);
  font-family: 'Consolas', 'Monaco', monospace;
}

/* ============ Screen Info Display ============ */
.screen-info {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  padding: var(--space-md);
  background: rgba(0, 0, 0, 0.3);
  border-radius: calc(6px * var(--ui-scale));
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: var(--font-sm);
}

.screen-info div {
  display: flex;
  justify-content: space-between;
  color: var(--text-muted);
}

.screen-info span {
  color: var(--accent-color);
  font-weight: 500;
}

/* ============ Storage Explorer App ============ */
.storage-explorer {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--window-bg);
  font-size: var(--font-sm);
}

.storage-explorer-toolbar {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  background: rgba(0, 0, 0, 0.3);
  border-bottom: 1px solid var(--border-color);
}

.storage-explorer-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-xs) var(--space-md);
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--border-color);
  border-radius: calc(4px * var(--ui-scale));
  color: var(--text-color);
  font-size: var(--font-sm);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.storage-explorer-btn.hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.2);
  border-color: var(--accent-color);
}

.storage-explorer-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.storage-explorer-btn-primary {
  background: var(--accent-color);
  color: #000;
  border-color: var(--accent-color);
}

.storage-explorer-btn-primary.hover:not(:disabled) {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.storage-explorer-btn-danger {
  color: #f87171;
  border-color: #f8717133;
}

.storage-explorer-btn-danger.hover:not(:disabled) {
  background: rgba(248, 113, 113, 0.2);
  border-color: #f87171;
}

.storage-explorer-spacer {
  flex: 1;
}

.storage-explorer-status {
  color: var(--text-muted);
  font-size: var(--font-xs);
}

.storage-explorer-toolbar-right {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-left: var(--space-md);
}

.storage-explorer-main {
  display: flex;
  flex: 1;
  overflow: hidden;
}

.storage-explorer-tree-pane {
  width: 320px;
  min-width: 200px;
  max-width: 50%;
  border-right: 1px solid var(--border-color);
  overflow: auto;
  background: rgba(0, 0, 0, 0.2);
}

.storage-explorer-divider {
  width: 4px;
  cursor: ew-resize;
  background: transparent;
}

.storage-explorer-divider.hover {
  background: var(--accent-color);
}

.storage-explorer-data-pane {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Tree View */
.storage-explorer-tree {
  padding: var(--space-sm);
}

.storage-explorer-empty {
  padding: var(--space-xl);
  text-align: center;
  color: var(--text-muted);
}

.storage-explorer-node {
  user-select: none;
}

.storage-explorer-node-row {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-xs) var(--space-sm);
  border-radius: calc(4px * var(--ui-scale));
  cursor: pointer;
  transition: background 0.1s;
}

.storage-explorer-node-row.hover {
  background: rgba(255, 255, 255, 0.1);
}

.storage-explorer-node-row.selected {
  background: var(--accent-color);
  color: #000;
}

.storage-explorer-node-toggle {
  width: calc(16px * var(--ui-scale));
  text-align: center;
  font-size: var(--font-xs);
  color: var(--text-muted);
  flex-shrink: 0;
}

.storage-explorer-node-toggle.has-children {
  cursor: pointer;
}

.storage-explorer-node-row.selected .storage-explorer-node-toggle {
  color: #000;
}

.storage-explorer-node-label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: 'Consolas', 'Monaco', monospace;
}

/* Data Pane */
.storage-explorer-data-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  color: var(--text-muted);
}

.storage-explorer-data-icon {
  font-size: calc(48px * var(--ui-scale));
  margin-bottom: var(--space-lg);
  opacity: 0.5;
}

.storage-explorer-data-text {
  font-size: var(--font-base);
}

.storage-explorer-data-header {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md);
  background: rgba(0, 0, 0, 0.3);
  border-bottom: 1px solid var(--border-color);
}

.storage-explorer-data-path {
  flex: 1;
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: var(--font-sm);
  color: var(--accent-color);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.storage-explorer-data-type {
  padding: var(--space-xs) var(--space-sm);
  background: rgba(255, 255, 255, 0.1);
  border-radius: calc(4px * var(--ui-scale));
  font-size: var(--font-xs);
  color: var(--text-muted);
}

.storage-explorer-data-size {
  font-size: var(--font-xs);
  color: var(--text-muted);
}

.storage-explorer-data-actions {
  display: flex;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  border-bottom: 1px solid var(--border-color);
}

.storage-explorer-data-content {
  flex: 1;
  overflow: auto;
  padding: var(--space-md);
}

.storage-explorer-data-json {
  margin: 0;
  padding: var(--space-md);
  background: rgba(0, 0, 0, 0.3);
  border-radius: calc(6px * var(--ui-scale));
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: var(--font-sm);
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text-color);
}

.storage-explorer-data-editor {
  width: 100%;
  height: 100%;
  min-height: 300px;
  padding: var(--space-md);
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-color);
  border-radius: calc(6px * var(--ui-scale));
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: var(--font-sm);
  line-height: 1.5;
  color: var(--text-color);
  resize: none;
}

.storage-explorer-data-editor:focus {
  outline: none;
  border-color: var(--accent-color);
}

.storage-explorer-data-loading {
  padding: var(--space-xl);
  text-align: center;
  color: var(--text-muted);
}

.storage-explorer-data-error {
  padding: var(--space-md);
  background: rgba(248, 113, 113, 0.2);
  border: 1px solid #f87171;
  border-radius: calc(6px * var(--ui-scale));
  color: #f87171;
}

/* Migration Modal */
.storage-explorer-migration {
  min-width: 400px;
  max-width: 500px;
}

.migration-section {
  margin-bottom: var(--space-lg);
}

.migration-section h4 {
  margin: 0 0 var(--space-sm) 0;
  font-size: var(--font-md);
  color: var(--text-color);
  border-bottom: 1px solid var(--border-color);
  padding-bottom: var(--space-xs);
}

.migration-stat {
  display: flex;
  gap: var(--space-sm);
  padding: var(--space-xs) 0;
}

.migration-label {
  color: var(--text-muted);
  min-width: 80px;
}

.migration-value {
  color: var(--text-color);
}

.migration-hash {
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: var(--font-sm);
  background: rgba(0, 0, 0, 0.3);
  padding: 2px 6px;
  border-radius: 4px;
}

.migration-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.migration-item {
  padding: var(--space-xs) var(--space-sm);
  margin-bottom: var(--space-xs);
  background: rgba(0, 0, 0, 0.2);
  border-radius: 4px;
  font-size: var(--font-sm);
}

.migration-completed {
  color: #4ade80;
}

.migration-success {
  border-left: 3px solid #4ade80;
}

.migration-failed {
  border-left: 3px solid #f87171;
  color: #f87171;
}

.migration-history .migration-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-sm);
}

.migration-id {
  flex: 1;
}

.migration-status {
  font-size: var(--font-xs);
  text-transform: uppercase;
}

.migration-time {
  font-size: var(--font-xs);
  color: var(--text-muted);
}

.migration-empty {
  color: var(--text-muted);
  font-style: italic;
  padding: var(--space-sm) 0;
}

.migration-info {
  color: var(--text-muted);
  font-size: var(--font-sm);
  margin: 0;
}

.migration-info-section {
  border-top: 1px solid var(--border-color);
  padding-top: var(--space-md);
}

/* ============================================================
   NOTIFICATION SYSTEM
   ============================================================ */

/* Bell Icon in Taskbar */
/* ============ Notification Bell Button ============ */
.notification-bell {
  position: relative;
  width: calc(40px * var(--ui-scale, 1));
  height: calc(36px * var(--ui-scale, 1));
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: calc(4px * var(--ui-scale, 1));
  transition: background 0.2s;
  margin: 0 calc(2px * var(--ui-scale, 1));
}

.notification-bell.hover {
  background: rgba(255, 255, 255, 0.15);
}

.notification-bell-icon {
  width: calc(20px * var(--ui-scale, 1));
  height: calc(20px * var(--ui-scale, 1));
  opacity: 0.7;
  transition: opacity 0.2s;
  color: var(--text-color, #ffffff);
}

.notification-bell-icon svg {
  width: 100%;
  height: 100%;
  fill: currentColor;
}

.notification-bell.has-notifications .notification-bell-icon {
  opacity: 1;
  animation: notification-bell-shake 0.5s ease-in-out;
}

@keyframes notification-bell-shake {
  0%, 100% { transform: rotate(0); }
  20% { transform: rotate(12deg); }
  40% { transform: rotate(-10deg); }
  60% { transform: rotate(6deg); }
  80% { transform: rotate(-4deg); }
}

.notification-badge {
  position: absolute;
  top: calc(2px * var(--ui-scale, 1));
  right: calc(2px * var(--ui-scale, 1));
  min-width: calc(16px * var(--ui-scale, 1));
  height: calc(16px * var(--ui-scale, 1));
  padding: 0 calc(4px * var(--ui-scale, 1));
  background: #e94560;
  border-radius: calc(8px * var(--ui-scale, 1));
  font-size: calc(10px * var(--ui-scale, 1));
  font-weight: bold;
  color: white;
  display: none;
  align-items: center;
  justify-content: center;
  line-height: 1;
  box-shadow: 0 calc(1px * var(--ui-scale, 1)) calc(3px * var(--ui-scale, 1)) rgba(0, 0, 0, 0.3);
}

.notification-badge.visible {
  display: flex;
}

/* ============ Notification Panel (Mini Window) ============ */
.notification-panel {
  position: fixed;
  bottom: calc(70px * var(--ui-scale, 1));
  right: calc(16px * var(--ui-scale, 1));
  width: calc(380px * var(--ui-scale, 1));
  max-height: calc(500px * var(--ui-scale, 1));
  background: rgba(25, 25, 40, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: calc(10px * var(--ui-scale, 1));
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  z-index: 10000;
  opacity: 0;
  transform: translateY(10px) scale(0.95);
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  overflow: hidden;
}

.notification-panel.visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.notification-panel.dragging {
  transition: none;
}

.notification-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: calc(12px * var(--ui-scale, 1)) calc(16px * var(--ui-scale, 1));
  background: rgba(40, 40, 60, 0.95);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  cursor: grab;
  user-select: none;
}

.notification-panel-header:active {
  cursor: grabbing;
}

.notification-panel-title {
  font-weight: 600;
  font-size: calc(14px * var(--ui-scale, 1));
  color: #fff;
  display: flex;
  align-items: center;
  gap: calc(8px * var(--ui-scale, 1));
}

.notification-panel-title svg {
  width: calc(16px * var(--ui-scale, 1));
  height: calc(16px * var(--ui-scale, 1));
  fill: currentColor;
  opacity: 0.8;
}

.notification-panel-actions {
  display: flex;
  gap: calc(8px * var(--ui-scale, 1));
  align-items: center;
}

.notification-clear-btn {
  padding: calc(5px * var(--ui-scale, 1)) calc(12px * var(--ui-scale, 1));
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: calc(4px * var(--ui-scale, 1));
  color: rgba(255, 255, 255, 0.8);
  font-size: calc(12px * var(--ui-scale, 1));
  cursor: pointer;
  transition: all 0.2s;
}

.notification-clear-btn.hover {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.notification-close-btn {
  width: calc(24px * var(--ui-scale, 1));
  height: calc(24px * var(--ui-scale, 1));
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  font-size: calc(18px * var(--ui-scale, 1));
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: calc(4px * var(--ui-scale, 1));
  transition: all 0.2s;
}

.notification-close-btn.hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.notification-panel-list {
  flex: 1;
  overflow-y: auto;
  padding: calc(8px * var(--ui-scale, 1));
  max-height: calc(400px * var(--ui-scale, 1));
}

.notification-empty {
  text-align: center;
  padding: calc(40px * var(--ui-scale, 1)) calc(20px * var(--ui-scale, 1));
  color: rgba(255, 255, 255, 0.5);
  font-style: italic;
  font-size: calc(14px * var(--ui-scale, 1));
}

.notification-empty svg {
  width: calc(48px * var(--ui-scale, 1));
  height: calc(48px * var(--ui-scale, 1));
  fill: currentColor;
  opacity: 0.3;
  margin-bottom: calc(12px * var(--ui-scale, 1));
}

/* ============ Notification Item ============ */
.notification-item {
  padding: calc(12px * var(--ui-scale, 1));
  margin-bottom: calc(8px * var(--ui-scale, 1));
  background: rgba(255, 255, 255, 0.05);
  border-radius: calc(8px * var(--ui-scale, 1));
  border-left: calc(3px * var(--ui-scale, 1)) solid rgba(255, 255, 255, 0.2);
  transition: background 0.2s;
}

.notification-item.hover {
  background: rgba(255, 255, 255, 0.08);
}

.notification-item.unread {
  background: rgba(74, 222, 128, 0.08);
}

.notification-info {
  border-left-color: #3b82f6;
}

.notification-warning {
  border-left-color: #f59e0b;
}

.notification-error {
  border-left-color: #ef4444;
}

.notification-success {
  border-left-color: #22c55e;
}

.notification-item-header {
  display: flex;
  align-items: center;
  gap: calc(8px * var(--ui-scale, 1));
  margin-bottom: calc(6px * var(--ui-scale, 1));
}

.notification-item-icon {
  font-size: calc(16px * var(--ui-scale, 1));
  flex-shrink: 0;
}

.notification-item-icon svg {
  width: calc(16px * var(--ui-scale, 1));
  height: calc(16px * var(--ui-scale, 1));
  fill: currentColor;
}

.notification-item-title {
  flex: 1;
  font-weight: 500;
  font-size: calc(13px * var(--ui-scale, 1));
  color: #fff;
}

.notification-item-time {
  font-size: calc(11px * var(--ui-scale, 1));
  color: rgba(255, 255, 255, 0.5);
}

.notification-dismiss-btn {
  width: calc(20px * var(--ui-scale, 1));
  height: calc(20px * var(--ui-scale, 1));
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.4);
  cursor: pointer;
  font-size: calc(16px * var(--ui-scale, 1));
  line-height: 1;
  opacity: 0.5;
  transition: opacity 0.2s;
  border-radius: calc(3px * var(--ui-scale, 1));
}

.notification-dismiss-btn.hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.1);
}

.notification-item-message {
  font-size: calc(12px * var(--ui-scale, 1));
  color: rgba(255, 255, 255, 0.7);
  line-height: 1.5;
  margin-left: calc(24px * var(--ui-scale, 1));
}

.notification-image {
  margin-top: calc(8px * var(--ui-scale, 1));
  margin-left: calc(24px * var(--ui-scale, 1));
}

.notification-image img {
  max-width: 100%;
  max-height: calc(150px * var(--ui-scale, 1));
  border-radius: calc(6px * var(--ui-scale, 1));
}

.notification-actions {
  display: flex;
  gap: calc(8px * var(--ui-scale, 1));
  margin-top: calc(10px * var(--ui-scale, 1));
  margin-left: calc(24px * var(--ui-scale, 1));
}

.notification-action-btn {
  padding: calc(5px * var(--ui-scale, 1)) calc(14px * var(--ui-scale, 1));
  background: var(--accent-color);
  border: none;
  border-radius: calc(4px * var(--ui-scale, 1));
  color: #000;
  font-size: calc(11px * var(--ui-scale, 1));
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.notification-action-btn.hover {
  filter: brightness(1.15);
}

/* ============ Toast Notifications ============ */
.notification-toast-container {
  position: fixed;
  bottom: calc(70px * var(--ui-scale, 1));
  right: calc(16px * var(--ui-scale, 1));
  z-index: 11000;
  display: flex;
  flex-direction: column-reverse;
  gap: calc(10px * var(--ui-scale, 1));
  pointer-events: none;
}

.notification-toast {
  width: calc(340px * var(--ui-scale, 1));
  background: rgba(25, 25, 40, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: calc(10px * var(--ui-scale, 1));
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  pointer-events: auto;
  opacity: 0;
  transform: translateX(100%);
  transition: opacity 0.3s, transform 0.3s;
}

.notification-toast.visible {
  opacity: 1;
  transform: translateX(0);
}

.notification-toast.hiding {
  opacity: 0;
  transform: translateX(100%);
}

.notification-toast.notification-info {
  border-left: calc(4px * var(--ui-scale, 1)) solid #3b82f6;
}

.notification-toast.notification-warning {
  border-left: calc(4px * var(--ui-scale, 1)) solid #f59e0b;
}

.notification-toast.notification-error {
  border-left: calc(4px * var(--ui-scale, 1)) solid #ef4444;
}

.notification-toast.notification-success {
  border-left: calc(4px * var(--ui-scale, 1)) solid #22c55e;
}

.notification-toast-content {
  display: flex;
  align-items: flex-start;
  gap: calc(12px * var(--ui-scale, 1));
  padding: calc(14px * var(--ui-scale, 1));
}

.notification-toast-icon {
  font-size: calc(20px * var(--ui-scale, 1));
  flex-shrink: 0;
}

.notification-toast-icon svg {
  width: calc(20px * var(--ui-scale, 1));
  height: calc(20px * var(--ui-scale, 1));
  fill: currentColor;
}

.notification-toast-text {
  flex: 1;
  min-width: 0;
}

.notification-toast-title {
  font-weight: 600;
  font-size: calc(13px * var(--ui-scale, 1));
  margin-bottom: calc(4px * var(--ui-scale, 1));
  color: #fff;
}

.notification-toast-message {
  font-size: calc(12px * var(--ui-scale, 1));
  color: rgba(255, 255, 255, 0.7);
  line-height: 1.5;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.notification-toast-close {
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.5);
  font-size: calc(18px * var(--ui-scale, 1));
  cursor: pointer;
  padding: 0;
  line-height: 1;
  transition: color 0.2s;
}

.notification-toast-close.hover {
  color: #fff;
}

/* ============ System Cursor Overlay ============ */

/* Hide native cursor when overlay is active */
body.cursor-overlay-active {
  cursor: none;
}

/* Apply cursor:none to all elements - custom cursor will handle context changes */
body.cursor-overlay-active *:not(select):not(option):not(.cursor-native):not(.cursor-native *) {
  cursor: none;
}

/* Elements that need native cursor interaction (form elements) */
body.cursor-overlay-active select,
body.cursor-overlay-active option {
  cursor: pointer;
}

/* Native custom cursor mode - applies custom cursor but allows child elements to override */
body.cursor-native-active {
  cursor: var(--custom-cursor-url, auto);
}

/* Apps can use .cursor-app-controlled to handle their own cursor */
.cursor-app-controlled {
  cursor: auto !important;
}

/* Main cursor overlay */
.tv-cursor {
  position: fixed;
  pointer-events: none;
  z-index: 50000;
  transform: translate(-50%, -50%);
  will-change: left, top;
  transition: opacity 0.1s ease;
}

.tv-cursor-inner {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: width 0.1s ease, height 0.1s ease, transform 0.15s ease, opacity 0.1s ease;
}

.tv-cursor-inner svg {
  display: block;
}

/* Click highlight effect */
.tv-cursor.clicking .tv-cursor-inner {
  animation: cursor-click-pulse 0.2s ease-out;
}

@keyframes cursor-click-pulse {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.4); opacity: 0.7; }
  100% { transform: scale(1); opacity: 1; }
}

/* Cursor trail elements */
.tv-cursor-trail {
  position: fixed;
  pointer-events: none;
  z-index: 49999;
  width: var(--cursor-computed-size);
  height: var(--cursor-computed-size);
  background: var(--cursor-color);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  will-change: left, top, opacity;
}

.tv-cursor-trail:nth-child(1) { opacity: 0.25; }
.tv-cursor-trail:nth-child(2) { opacity: 0.20; }
.tv-cursor-trail:nth-child(3) { opacity: 0.15; }
.tv-cursor-trail:nth-child(4) { opacity: 0.12; }
.tv-cursor-trail:nth-child(5) { opacity: 0.09; }
.tv-cursor-trail:nth-child(6) { opacity: 0.07; }
.tv-cursor-trail:nth-child(7) { opacity: 0.05; }
.tv-cursor-trail:nth-child(8) { opacity: 0.04; }
.tv-cursor-trail:nth-child(9) { opacity: 0.03; }
.tv-cursor-trail:nth-child(10) { opacity: 0.02; }

/* Cursor preview box in settings */
.cursor-preview-box {
  position: relative;
  width: 100%;
  height: 150px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 1px solid var(--border-color);
}

.cursor-preview-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  transition: width 0.2s ease, height 0.2s ease;
}

.cursor-preview-indicator svg {
  display: block;
}

/* Settings checkbox label */
.settings-checkbox-label {
  display: flex;
  align-items: center;
  gap: calc(8px * var(--ui-scale, 1));
  cursor: pointer;
  font-weight: normal;
}

.settings-checkbox-label input[type="checkbox"] {
  width: calc(18px * var(--ui-scale, 1));
  height: calc(18px * var(--ui-scale, 1));
  cursor: pointer;
}

.cursor-preview-hint {
  position: absolute;
  bottom: 10px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: var(--font-xs);
  color: var(--text-muted);
}

/* ============ Video Player App ============ */

.video-player-app {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: #000;
}

.video-container {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  overflow: hidden;
}

.video-element {
  max-width: 100%;
  max-height: 100%;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.video-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-lg);
  color: var(--text-muted);
}

.video-placeholder-icon {
  opacity: 0.3;
}

.video-placeholder-icon svg {
  width: calc(64px * var(--ui-scale));
  height: calc(64px * var(--ui-scale));
  fill: currentColor;
}

.video-placeholder-text {
  font-size: var(--font-lg);
}

.video-open-btn {
  padding: var(--space-sm) var(--space-lg);
  background: var(--accent-color);
  color: #000;
  border: none;
  border-radius: calc(4px * var(--ui-scale));
  font-size: var(--font-base);
  cursor: pointer;
  transition: background 0.15s;
}

.video-open-btn.hover {
  background: var(--accent-hover);
}

.video-controls {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
  padding: var(--space-md);
  padding-top: calc(40px * var(--ui-scale));
  transition: opacity 0.3s;
}

.video-controls.hidden {
  opacity: 0;
  pointer-events: none;
}

.video-progress-container {
  margin-bottom: var(--space-sm);
}

.video-progress-bar {
  height: calc(6px * var(--ui-scale));
  background: rgba(255, 255, 255, 0.2);
  border-radius: calc(3px * var(--ui-scale));
  cursor: pointer;
  position: relative;
  overflow: visible;
}

.video-progress-bar.hover {
  height: calc(8px * var(--ui-scale));
}

.video-progress-buffered {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background: rgba(255, 255, 255, 0.3);
  border-radius: calc(3px * var(--ui-scale));
  width: 0;
}

.video-progress-played {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background: var(--accent-color);
  border-radius: calc(3px * var(--ui-scale));
  width: 0;
}

.video-progress-handle {
  position: absolute;
  top: 50%;
  width: calc(14px * var(--ui-scale));
  height: calc(14px * var(--ui-scale));
  background: var(--accent-color);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  left: 0;
  opacity: 0;
  transition: opacity 0.15s;
}

.video-progress-bar.hover .video-progress-handle {
  opacity: 1;
}

.video-controls-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
}

.video-controls-left,
.video-controls-right {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.video-btn {
  width: calc(36px * var(--ui-scale));
  height: calc(36px * var(--ui-scale));
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: #fff;
  cursor: pointer;
  border-radius: calc(4px * var(--ui-scale));
  transition: background 0.15s;
}

.video-btn svg {
  width: calc(20px * var(--ui-scale));
  height: calc(20px * var(--ui-scale));
  fill: currentColor;
}

.video-btn.hover {
  background: rgba(255, 255, 255, 0.2);
}

.video-play-btn svg {
  width: calc(24px * var(--ui-scale));
  height: calc(24px * var(--ui-scale));
}

.video-volume-container {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.video-volume-slider {
  width: calc(80px * var(--ui-scale));
  height: calc(4px * var(--ui-scale));
  -webkit-appearance: none;
  appearance: none;
  background: rgba(255, 255, 255, 0.3);
  border-radius: calc(2px * var(--ui-scale));
  outline: none;
  opacity: 0;
  transition: opacity 0.15s, width 0.15s;
}

.video-volume-container.hover .video-volume-slider {
  opacity: 1;
}

.video-volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: calc(12px * var(--ui-scale));
  height: calc(12px * var(--ui-scale));
  background: var(--accent-color);
  border-radius: 50%;
  cursor: pointer;
}

.video-volume-slider::-moz-range-thumb {
  width: calc(12px * var(--ui-scale));
  height: calc(12px * var(--ui-scale));
  background: var(--accent-color);
  border-radius: 50%;
  cursor: pointer;
  border: none;
}

.video-time {
  font-size: var(--font-sm);
  color: #fff;
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  white-space: nowrap;
}

.video-time-separator {
  opacity: 0.5;
}

.video-speed-select {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  font-size: var(--font-sm);
  padding: var(--space-xs) var(--space-sm);
  border-radius: calc(4px * var(--ui-scale));
  cursor: pointer;
  outline: none;
}

.video-speed-select option {
  background: var(--window-bg);
  color: var(--text-color);
}

.video-statusbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-xs) var(--space-md);
  background: rgba(0, 0, 0, 0.8);
  font-size: var(--font-xs);
  color: var(--text-muted);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.video-status-file {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.video-status-info {
  margin-left: var(--space-md);
  white-space: nowrap;
}

/* Fullscreen mode adjustments */
.video-container:fullscreen {
  background: #000;
}

.video-container:fullscreen .video-controls {
  padding-bottom: calc(20px * var(--ui-scale));
}

.video-container:-webkit-full-screen {
  background: #000;
}

.video-container:-webkit-full-screen .video-controls {
  padding-bottom: calc(20px * var(--ui-scale));
}
