/* CSS Variables for consistent theming */
:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #3b82f6;
  --secondary: #64748b;
  --secondary-hover: #475569;
  --accent: #f59e0b;
  --accent-hover: #d97706;
  --success: #10b981;
  --success-hover: #059669;
  --warning: #f59e0b;
  --warning-hover: #d97706;
  --danger: #ef4444;
  --danger-hover: #dc2626;
  --background: #f8fafc;
  --surface: #ffffff;
  --surface-dark: #f1f5f9;
  --surface-darker: #e2e8f0;
  --surface-light: #f8fafc;
  --surface-hover: #f1f5f9;
  --surface-alt: #f8fafc;
  --border: #e2e8f0;
  --border-dark: #cbd5e1;
  --border-focus: #3b82f6;
  --text: #1e293b;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
  --shadow-md:
    0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg:
    0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-xl:
    0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  --radius: 0.375rem;
  --radius-lg: 0.5rem;
  --transition: all 0.2s ease-in-out;
  --text-primary: var(--text);
}

/* Dark theme variables */
[data-theme='dark'] {
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --primary-light: #60a5fa;
  --secondary: #94a3b8;
  --secondary-hover: #cbd5e1;
  --accent: #fbbf24;
  --accent-hover: #f59e0b;
  --success: #34d399;
  --success-hover: #10b981;
  --warning: #fbbf24;
  --warning-hover: #f59e0b;
  --danger: #f87171;
  --danger-hover: #ef4444;
  --background: #0f172a;
  --surface: #1e293b;
  --surface-dark: #334155;
  --surface-darker: #475569;
  --surface-light: #334155;
  --surface-hover: #475569;
  --surface-alt: #334155;
  --border: #334155;
  --border-dark: #475569;
  --border-focus: #3b82f6;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --text-light: #64748b;
  --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.3), 0 1px 2px 0 rgba(0, 0, 0, 0.2);
  --shadow-md:
    0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
  --shadow-lg:
    0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.2);
  --shadow-xl:
    0 20px 25px -5px rgba(0, 0, 0, 0.3), 0 10px 10px -5px rgba(0, 0, 0, 0.2);
  --text-primary: var(--text);
}

/* Improved dark mode styles */
[data-theme='dark'] {
  color-scheme: dark;
}
[data-theme='dark'] input:focus,
[data-theme='dark'] textarea:focus,
[data-theme='dark'] select:focus {
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.5);
}

[data-theme='dark'] .toast {
  background: var(--surface-darker);
  border: 1px solid var(--border-dark);
}

[data-theme='dark'] .modal-content {
  background: var(--surface);
  border: 1px solid var(--border);
}

[data-theme='dark'] .dropdown-menu {
  background: var(--surface-dark);
  border: 1px solid var(--border-dark);
}

[data-theme='dark'] ::-webkit-scrollbar-track {
  background: var(--surface-dark);
}

[data-theme='dark'] ::-webkit-scrollbar-thumb {
  background: var(--border-dark);
}

[data-theme='dark'] ::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* Base styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* Smooth theme transitions */
*,
*::before,
*::after {
  transition:
    background-color 0.3s ease,
    color 0.3s ease,
    border-color 0.3s ease,
    box-shadow 0.3s ease;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  height: 100%;
}

body {
  font-family:
    -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu,
    Cantarell, sans-serif;
  background-color: var(--background);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  height: 100%;
}

/* App container */
.app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  max-width: 1400px;
  margin: 0 auto;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}

/* Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 1rem 1.5rem;
  box-shadow: var(--shadow);
  position: relative;
  z-index: 10;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.header-left h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
  margin: 0;
  display: flex;
  align-items: center;
}

.header-left h1 i {
  margin-right: 0.5rem;
  color: var(--accent);
}

.app-logo {
  height: 2rem;
  width: 2rem;
  margin-right: 0.5rem;
}

.version {
  background: var(--primary);
  color: white;
  padding: 0.125rem 0.5rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 500;
}

.header-right {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

/* Dropdown component */
.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-toggle {
  background: none;
  border: none;
  cursor: pointer;
}

.dropdown-menu {
  position: absolute;
  top: 100%;
  right: 0;
  z-index: 1000;
  display: none;
  min-width: 200px;
  padding: 0.5rem 0;
  margin: 0.125rem 0 0;
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}

.dropdown.active .dropdown-menu {
  display: block !important; /* Force display when active */
}

/* Debug styles */
/*.dropdown.active {
  outline: 2px solid red; 
}

.dropdown.active .dropdown-menu {
  outline: 2px solid blue; 
}*/

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.75rem 1rem;
  border: none;
  background: none;
  text-align: left;
  cursor: pointer;
  transition: var(--transition);
  font-size: 0.9rem;
}

.dropdown-item:hover {
  background: var(--surface-dark);
}

.dropdown-item i {
  width: 1rem;
  color: var(--text-muted);
}

.dropdown-item select {
  flex: 1;
  font-size: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.25rem 0.5rem;
  background: var(--surface);
  color: var(--text);
}

.dropdown-item select:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Profile bar */
.profile-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--surface-dark);
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 1.5rem;
  gap: 1rem;
}

.profile-selector {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex: 1;
}

.profile-selector i {
  font-size: 1.1rem;
}

.profile-selector select {
  font-size: 1.1rem;
  font-weight: 600;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.25rem 0.5rem;
  background: var(--surface);
  color: var(--text);
  min-width: 200px;
  cursor: pointer;
}

.profile-selector select:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}
.profile-info {
  display: flex;
  gap: 1rem;
  align-items: center;
  font-size: 0.9rem;
}

.mode-toggle {
  background: var(--surface);
  border: 1px solid var(--border);
  overflow: hidden;
}

.mode-btn {
  padding: 0.375rem 0.75rem;
}

.mode-btn:hover {
  background: var(--surface-dark);
}

.status-indicators {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.modified-indicator {
  color: var(--warning);
  font-weight: 500;
  animation: pulse 2s infinite;
}

.status-indicator {
  color: var(--success);
  font-weight: 500;
}

.key-count,
.alias-count {
  color: var(--text-muted);
  font-size: 0.875rem;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
}

/* Main content layout */
.main-content {
  display: grid;
  grid-template-columns: 300px 1fr 320px;
  gap: 1rem;
  padding: 1rem;
  flex: 1;
  overflow: hidden;
  min-height: 0;
}

/* Key selector */
.key-selector-container {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  /*height: max(300px, calc(100vh - 180px));*/ /* Use all available space within the grid cell */
  /*min-height: 300px;*/
  height: 100%;
}

.key-selector-header {
  padding: 1rem 1rem 0.5rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface-dark);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.key-selector-header h3 {
  margin: 0;
  color: #1e293b; /* Dark gray for light mode */
  font-size: 1.1rem;
  text-align: center;
  width: 100%;
}
/* Dark mode override for key-selector-header h3 */
[data-theme='dark'] .key-selector-header h3 {
  color: #ffffff; /* White for dark mode */
}
.key-selector {
  padding: 1rem;
  flex: 1;
  overflow: hidden; /* scrolling handled by key-grid */
  display: flex;
  flex-direction: column;
  min-height: 0;
  max-height: calc(100% - 3rem); /* Account for own padding + extra space for button breathing room */
}

.key-grid {
  grid-template-columns: repeat(auto-fit, minmax(60px, 60px));
  margin-bottom: 1rem;
  justify-content: start;
  align-content: start;
  overflow-x: hidden;
  flex: 1;
  min-height: 0;
  max-height: calc(100% - 1rem); /* Ensure space for margin-bottom */
  padding-right: 0.5rem;
  box-sizing: border-box;
}

.key-grid.categorized {
  display: block;
  grid-template-columns: unset;
  gap: unset;
}

.key-item {
  position: relative;
}

/* Dynamic font sizing based on label length */


.key-preview-display {
  padding: 0.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 0.75rem;
  min-height: 2rem;
  display: flex;
  align-items: center;
  font-family: 'Courier New', monospace;
  font-weight: 600;
  font-size: 1rem;
}

.key-preview-display .no-selection {
  color: var(--text-muted);
  font-style: italic;
}

.key-preview-display .key-combination {
  color: var(--primary);
}
#confirmKeySelection {
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
}

#confirmKeySelection:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Key category enhancements */

/* Key-specific styling for command items */

/* Dynamic font sizing for categorized view keys */

/* Command chain */

/* Dark mode override for chain-header h3 */

/* Command library */

/* Dark mode override for library-header h3 */

/* Command Library category collapsible enhancements */

/* Empty states */

/* Buttons */

/* Form elements */
.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: var(--text);
  font-size: 0.9rem;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.625rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.9rem;
  transition: var(--transition);
  background: var(--surface);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-group input.error,
.form-group select.error,
.form-group textarea.error {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.form-group small {
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-top: 0.25rem;
  display: block;
}

.form-group textarea {
  resize: vertical;
  min-height: 80px;
}

/* Preferences modal layout */
.preferences-layout {
  display: flex;
  height: 500px;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.preferences-sidebar {
  width: 220px;
  background: var(--surface-dark);
  border-right: 1px solid var(--border);
  flex-shrink: 0;
}

.category-tree {
  padding: 0;
}

.category-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  cursor: pointer;
  transition: var(--transition);
  border-bottom: 1px solid var(--border-light);
  color: var(--text);
}

.category-item:hover {
  background: var(--surface-hover, var(--surface-dark));
}

.category-item.active {
  background: var(--primary);
  color: white;
}

.category-item i {
  width: 16px;
  font-size: 0.9rem;
}

.preferences-content {
  flex: 1;
  padding: 1.5rem;
  overflow-y: auto;
  background: var(--surface);
}

.settings-panel {
  display: none;
}

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

.settings-panel h4 {
  margin: 0 0 1.5rem 0;
  color: var(--text);
  font-size: 1.1rem;
  font-weight: 600;
}

.settings-group {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.setting-item {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.setting-item label {
  font-weight: 500;
  color: var(--text);
  font-size: 0.9rem;
}

.setting-control {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.setting-description {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Toggle Switch */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 24px;
}

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

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--border);
  transition: var(--transition);
  border-radius: 24px;
}

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

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

input:checked + .slider:before {
  transform: translateX(26px);
}

/* Setting Select */
.setting-select {
  padding: 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-size: 0.9rem;
  max-width: 200px;
}

.setting-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Folder Setting */
.folder-setting {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-dark);
}

.folder-path {
  flex: 1;
  font-size: 0.9rem;
  color: var(--text-muted);
  font-family: 'Courier New', monospace;
  word-break: break-all;
}

.folder-setting .btn {
  flex-shrink: 0;
}

/* Checkbox styling */
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  cursor: pointer;
  user-select: none;
  color: var(--text);
  transition: var(--transition);
}

.checkbox-label:hover {
  color: var(--primary);
}

.checkbox-label input[type='checkbox'] {
  width: 16px;
  height: 16px;
  margin: 0;
  cursor: pointer;
  accent-color: var(--primary);
}

.checkbox-label .checkmark {
  display: none; /* Using native checkbox for simplicity */
}


/* Modals */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  display: none;
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.modal-overlay.active {
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
}

.modal {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.9);
  z-index: 1001;
  max-width: 90vw;
  max-height: 90vh;
  transition: transform 0.3s ease;
}

.modal.active {
  display: block;
  transform: translate(-50%, -50%) scale(1);
}

.modal-content {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  width: 500px;
  max-height: 80vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.large-modal .modal-content {
  width: 800px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface-dark);
}

.modal-header h3 {
  color: var(--primary);
  margin: 0;
  font-size: 1.2rem;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  color: var(--text-muted);
  padding: 0.5rem;
  border-radius: var(--radius);
  transition: var(--transition);
}

.modal-close:hover {
  color: var(--text);
  background: var(--surface-darker);
}

.modal-body {
  padding: 1.5rem;
  flex: 1;
  overflow-y: auto;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 1.5rem;
  border-top: 1px solid var(--border);
  background: var(--surface-dark);
}

/* Bindset selection modal styles */
.bindset-list {
  max-height: 300px;
  overflow-y: auto;
  margin: 1rem 0;
  border: 1px solid var(--border);
  border-radius: 0.375rem;
  background: var(--surface);
}

/* Single bindset selection - clean styling inspired by table modal */
.single-bindset-container {
  margin: 1.5rem 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  overflow: hidden;
}

.single-bindset-option {
  border-bottom: 1px solid var(--border);
  transition: background-color 0.2s ease;
  cursor: pointer;
}

.single-bindset-option:last-child {
  border-bottom: none;
}

.single-bindset-option:hover {
  background: var(--surface-light);
}

.single-bindset-option.selected {
  background: var(--surface-light);
}

.single-bindset-label {
  display: flex;
  align-items: center;
  padding: 1rem;
  cursor: pointer;
  width: 100%;
  margin: 0;
  font-weight: normal;
}

.single-bindset-radio {
  margin-right: 0.75rem;
  width: 1rem;
  height: 1rem;
  accent-color: var(--primary);
}

.single-bindset-content {
  flex: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.single-bindset-main {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.single-bindset-name {
  font-weight: 500;
  color: var(--text);
  font-size: 0.95rem;
}

.single-bindset-badge {
  display: inline-block;
  font-size: 0.75rem;
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  margin-left: 0.5rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.single-bindset-badge.primary {
  background: var(--primary);
  color: white;
}

.single-bindset-meta {
  color: var(--text-muted);
  font-size: 0.875rem;
}

.single-bindset-count {
  font-weight: 400;
}

.single-bindset-note {
  background: var(--surface-dark);
  border-radius: var(--radius);
  padding: 1rem;
  margin-top: 1rem;
  color: var(--text);
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.single-bindset-note i {
  color: var(--primary);
}

.bindset-functionality-info {
  margin: 1.5rem 0;
  border: 1px solid var(--primary-light, #93c5fd);
  border-radius: var(--radius-lg);
  background: var(--surface-light);
  overflow: hidden;
}

.info-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.05) 0%, rgba(59, 130, 246, 0.02) 100%);
  border-bottom: 1px solid var(--primary-light, #93c5fd);
  font-weight: 600;
  color: var(--primary, #3b82f6);
}

.info-header i {
  font-size: 1rem;
}

.info-content {
  padding: 1rem;
}

.info-content p {
  margin: 0 0 0.75rem 0;
  color: var(--text);
  line-height: 1.5;
}

.info-content p:last-child {
  margin-bottom: 0;
}

.info-content strong {
  color: var(--primary, #3b82f6);
}

.bindset-option {
  display: flex;
  align-items: center;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  transition: background-color 0.2s ease;
}

.bindset-option:last-child {
  border-bottom: none;
}

.bindset-option:hover {
  background: var(--surface-light);
}

.bindset-option input[type="checkbox"] {
  margin-right: 0.75rem;
  width: 1rem;
  height: 1rem;
  accent-color: var(--primary);
}

.bindset-option label {
  flex: 1;
  cursor: pointer;
  font-weight: 500;
  color: var(--text);
  margin: 0;
}

/* Enhanced bindset table-grid layout */
.enhanced-bindset-grid {
  margin: 1.5rem 0;
  border-radius: 0.5rem;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface);
}

.bindset-table {
  width: 100%;
  border-collapse: collapse;
  border-spacing: 0;
}

.bindset-table th {
  background: var(--surface-dark);
  color: var(--text);
  font-weight: 600;
  padding: 1rem;
  text-align: left;
  border-bottom: 2px solid var(--border);
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.bindset-row {
  transition: background-color 0.2s ease;
  border-bottom: 1px solid var(--border);
}

.bindset-row:last-child {
  border-bottom: none;
}

.bindset-row:hover {
  background: var(--surface-light);
}

.bindset-name-cell {
  padding: 1rem;
  width: 40%;
  vertical-align: middle;
}

.bindset-mapping-cell {
  padding: 1rem;
  width: 60%;
  vertical-align: middle;
}

/* 3-column layout adjustments */
.bindset-name-cell {
  width: 40%;
}

.bindset-name {
  font-weight: 500;
  color: var(--text);
  font-size: 0.95rem;
}

.bindset-indicator {
  display: inline-block;
  font-size: 0.75rem;
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  margin-left: 0.5rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.bindset-indicator.primary {
  background: var(--primary);
  color: white;
}

.bindset-mapping-select {
  width: 100%;
  max-width: 200px;
  padding: 0.5rem;
  border: 1px solid var(--border);
  border-radius: 0.375rem;
  background: var(--background);
  color: var(--text);
  font-size: 0.875rem;
  margin-right: 0.75rem;
  cursor: pointer;
}

.bindset-mapping-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.1);
}

.bindset-custom-input {
  width: 100%;
  max-width: 250px;
  padding: 0.5rem;
  border: 1px solid var(--border);
  border-radius: 0.375rem;
  background: var(--background);
  color: var(--text);
  font-size: 0.875rem;
  margin-top: 0.5rem;
}

.bindset-custom-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.1);
}

.bindset-custom-input::placeholder {
  color: var(--text-dim);
  font-style: italic;
}

/* New 3-column layout CSS classes */
.bindset-type-cell {
  padding: 1rem;
  width: 35%;
  vertical-align: middle;
}

.bindset-custom-cell {
  padding: 1rem;
  width: 25%;
  vertical-align: middle;
}

.bindset-custom-container {
  margin-top: 0.5rem;
  display: none;
}

/* Enhanced preview section styling */
.enhanced-preview-section {
  margin-top: 2rem;
  padding: 1.5rem;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  background: var(--surface);
}

.enhanced-preview-section h4 {
  margin: 0 0 1rem 0;
  color: var(--text);
  font-weight: 600;
  font-size: 1rem;
}

.preview-table {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.preview-row {
  display: flex;
  align-items: center;
  padding: 0.75rem;
  background: var(--surface-light);
  border-radius: 0.375rem;
  border-left: 4px solid var(--primary);
}

.preview-original {
  font-weight: 500;
  color: var(--text);
  margin-right: 0.75rem;
  flex: 1;
}

.preview-arrow {
  color: var(--text-dim);
  margin: 0 0.75rem;
  font-weight: bold;
}

.mapping-indicator {
  padding: 0.25rem 0.75rem;
  border-radius: 0.25rem;
  font-size: 0.875rem;
  font-weight: 500;
  white-space: nowrap;
}

.mapping-indicator.primary {
  background: var(--success);
  color: white;
}

.mapping-indicator.custom {
  background: var(--primary);
  color: white;
}

.mapping-indicator.custom.conflict {
  background: var(--warning);
  color: var(--text);
}

.conflict-warning {
  background: var(--warning);
  color: var(--text);
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  font-size: 0.75rem;
  margin-left: 0.5rem;
  font-weight: 600;
}

.preview-placeholder {
  color: var(--text-dim);
  font-style: italic;
  text-align: center;
  padding: 2rem 1rem;
  margin: 0;
}

.modal-open {
  overflow: hidden;
}

/* KBF Import Progress Modal */
.progress-modal .modal-content {
  width: 450px;
}

.progress-container {
  margin: 1.5rem 0;
}

.progress-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
  font-weight: 500;
  color: var(--text);
}

.progress-stage {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.progress-percentage {
  font-size: 0.85rem;
  color: var(--primary);
  font-weight: 600;
}

.progress-bar {
  width: 100%;
  height: 8px;
  background-color: var(--surface-light);
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary) 0%, var(--primary-light) 100%);
  border-radius: 3px;
  transition: width 0.3s ease;
  min-width: 2px;
}

.progress-bar-fill.indeterminate {
  background: linear-gradient(90deg,
    var(--primary) 0%,
    var(--primary-light) 25%,
    var(--surface-light) 50%,
    var(--primary-light) 75%,
    var(--primary) 100%);
  background-size: 200% 100%;
  animation: indeterminate-progress 2s ease-in-out infinite;
}

@keyframes indeterminate-progress {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

.progress-details {
  margin-top: 0.75rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  text-align: center;
  min-height: 1.2rem;
}

/* Progress modal footer adjustments */
.progress-modal .modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  background: var(--surface-dark);
  display: flex;
  justify-content: center;
}

.progress-modal .progress-cancel-btn {
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
}

/* About modal specific styles */
.about-content {
  line-height: 1.6;
}

.app-info h4 {
  color: var(--primary);
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.app-info p {
  margin-bottom: 1.5rem;
  color: var(--text-muted);
}

.features h4,
.usage h4,
.contact-info h4 {
  color: var(--text);
  margin-bottom: 0.75rem;
  font-size: 1rem;
}

.features ul {
  margin-bottom: 1.5rem;
  padding-left: 1.5rem;
}

.features li {
  margin-bottom: 0.5rem;
  color: var(--text-muted);
}

.usage ol {
  padding-left: 1.5rem;
  margin-bottom: 1.5rem;
}

.usage li {
  margin-bottom: 0.5rem;
  color: var(--text-muted);
}

.contact-info {
  margin-bottom: 1.5rem;
}

.contact-info p {
  color: var(--text-muted);
  line-height: 1.8;
}

.contact-info a {
  color: var(--primary);
  text-decoration: none;
  transition: var(--transition);
}

.contact-info a:hover {
  color: var(--primary-dark);
  text-decoration: underline;
}

.contact-info i {
  width: 1.2rem;
  color: var(--primary);
}

.copyright {
  text-align: center;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  margin-top: 1rem;
}

.copyright p {
  margin: 0;
  color: var(--text-muted);
}

/* Header logo link styling */
.header-left h1 a {
  text-decoration: none;
  display: inline-block;
  transition: var(--transition);
}

.header-left h1 a:hover {
  transform: scale(1.05);
}

.header-left h1 a:hover .app-logo {
  filter: brightness(1.1);
}

/* Toast notifications */
.toast-container {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.toast {
  background: var(--surface);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  min-width: 300px;
  max-width: 400px;
  opacity: 0;
  transform: translateX(100%);
  transition: all 0.3s ease;
}

.toast.show {
  opacity: 1;
  transform: translateX(0);
}

.toast.removing {
  opacity: 0;
  transform: translateX(100%);
}

.toast-content {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem;
}

.toast-message {
  flex: 1;
  color: var(--text);
  font-size: 0.9rem;
}

.toast-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 0.25rem;
  border-radius: var(--radius);
  transition: var(--transition);
}

.toast-close:hover {
  background: var(--surface-dark);
  color: var(--text);
}

.toast-success {
  border-left-color: var(--success);
}

.toast-success .fas {
  color: var(--success);
}

.toast-error {
  border-left-color: var(--danger);
}

.toast-error .fas {
  color: var(--danger);
}

.toast-warning {
  border-left-color: var(--warning);
}

.toast-warning .fas {
  color: var(--warning);
}

.toast-info {
  border-left-color: var(--primary);
}

.toast-info .fas {
  color: var(--primary);
}
/* Command type styling */
.command-type.targeting {
  background: var(--success);
}
.command-type.combat {
  background: var(--danger);
}
.command-type.tray {
  background: var(--primary);
}
.command-type.power {
  background: var(--warning);
}
.command-type.movement {
  background: var(--accent);
}
.command-type.camera {
  background: #06b6d4;
}
.command-type.communication {
  background: #8b5cf6;
}
.command-type.system {
  background: var(--secondary);
}
.command-type.alias {
  background: linear-gradient(135deg, var(--accent), #fbbf24);
}
.command-type.vfx-alias {
  background: linear-gradient(135deg, #8b5cf6, #6366f1);
}

/* Responsive design */
@media (max-width: 1200px) {
  .main-content {
    grid-template-columns: 280px 1fr;
    grid-template-rows: auto 1fr;
  }

  .command-library {
    grid-column: 1 / -1;
  }
}

@media (max-width: 768px) {
  .main-content {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto 1fr;
    gap: 0.75rem;
    padding: 0.75rem;
  }

  .app-header {
    padding: 0.75rem 1rem;
    flex-wrap: wrap;
    gap: 1rem;
  }

  .header-right {
    order: 3;
    width: 100%;
    justify-content: flex-end;
  }

  .profile-bar {
    flex-direction: column;
    gap: 1rem;
    align-items: flex-start;
    padding: 1rem;
  }

  
  .key-grid {
    grid-template-columns: repeat(auto-fill, minmax(50px, 1fr));
  }

  .command-item-row {
    grid-template-columns: auto 1fr auto;
    gap: 0.5rem;
  }

  /* Remove flex-direction: column - command-actions should stay horizontal like toolbar-group */

  
  .modal-content {
    width: 95vw;
    margin: 1rem;
  }

  .large-modal .modal-content {
    width: 95vw;
  }
}

@media (max-width: 480px) {
  .key-grid {
    grid-template-columns: repeat(auto-fill, minmax(45px, 1fr));
    gap: 0.375rem;
  }

  .key-item {
    padding: 0.5rem 0.25rem;
    font-size: 0.8rem;
    min-height: 50px;
  }

  .command-item-row {
    grid-template-columns: 1fr auto;
    gap: 0.5rem;
  }

  .command-number {
    display: none;
  }

  .chain-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
  }
}

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--surface-dark);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: var(--border-dark);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

::-webkit-scrollbar-corner {
  background: var(--surface-dark);
}

/* Firefox scrollbar */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--border-dark) var(--surface-dark);
}

/* Animation utilities */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
/* Parameterized Command Styling */
.command-item.customizable,
.command-item-row.customizable {
  position: relative;
  border-left: 3px solid var(--accent);
}

.command-item.customizable:hover,
.command-item-row.customizable:hover {
  border-left-color: var(--primary);
}

.param-indicator {
  font-size: 0.8em;
  margin-left: 0.25rem;
  color: var(--accent);
  opacity: 0.8;
}

.command-item.customizable .param-indicator,
.command-item-row.customizable .param-indicator {
  opacity: 1;
}

/* Parameter Modal Styling */
#parameterModal .modal-content {
  min-width: 400px;
  max-width: 600px;
}

#parameterInputs {
  margin-bottom: 1.5rem;
}

#parameterInputs .form-group {
  margin-bottom: 1rem;
}

#parameterInputs input[type='number'] {
  width: 120px;
}

#parameterInputs small {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.3;
}

#parameterCommandPreview {
  font-family: 'Courier New', Consolas, monospace;
  font-size: 0.9rem;
  color: var(--accent);
  background: var(--surface-dark);
  padding: 0.5rem;
  border-radius: 3px;
  border: 1px solid var(--border-dark);
  min-height: 1.5rem;
  line-height: 1.4;
}

/* Enhanced command display for parameterized commands */
.command-item-row .command-text {
  position: relative;
}

.command-item-row[data-parameters] .command-text::after {
  content: '⚙️';
  position: absolute;
  right: -1.2rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.8em;
  opacity: 0.6;
}

.command-item-row[data-parameters]:hover .command-text::after {
  opacity: 1;
}

/* Focus states for accessibility */
*:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Print styles */
@media print {
  .app-header,
  .profile-bar,
  .chain-bottom-actions,
  .library-header,
  .modal-overlay,
  .toast-container {
    display: none !important;
  }

  .main-content {
    grid-template-columns: 1fr !important;
    gap: 1rem !important;
  }

  .command-chain-container {
    break-inside: avoid;
  }
}
.key-button {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: 'Courier New', Consolas, monospace;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  position: relative;
  min-height: 60px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}
.key-button:active {
  transform: translateY(0);
}

.key-button .key-name {
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.key-button .key-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: var(--font-family);
  font-weight: normal;
  line-height: 1.2;
}

/* Responsive adjustments for key selection */
@media (max-width: 768px) {
  
  .key-button {
    padding: 0.5rem;
    min-height: 50px;
  }

  .key-button .key-name {
    font-size: 0.8rem;
  }

  .key-button .key-desc {
    font-size: 0.7rem;
  }

  }

@media (max-width: 480px) {
  
  }

/* Mobile responsiveness for textarea with buttons */
@media (max-width: 768px) {
  .textarea-with-button {
    flex-direction: column;
    align-items: stretch;
  }

  .textarea-with-button .insert-target-btn {
    margin-top: 0.5rem;
    align-self: flex-start;
  }
}

/* Vertigo Modal Styles */
.vertigo-content {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.vertigo-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.vertigo-header p {
  color: var(--text-muted);
  margin: 0;
  flex: 1;
}

.vertigo-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.vertigo-environments {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
}

.vertigo-environment {
  background: var(--surface-dark);
  border-radius: var(--radius);
  padding: 1rem;
}

.environment-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.environment-header h4 {
  margin: 0;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.environment-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.effect-count {
  font-size: 0.875rem;
  color: var(--text-muted);
  background: var(--surface);
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.effects-list {
  max-height: 400px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.effect-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem;
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  transition: var(--transition);
}

.effect-item:hover {
  background: var(--surface-darker);
  border-color: var(--border-dark);
}

.effect-item input[type='checkbox'] {
  margin: 0;
  cursor: pointer;
}

.effect-label {
  flex: 1;
  font-size: 0.9rem;
  color: var(--text);
  cursor: pointer;
}

.effect-item.selected {
  background: var(--primary-light);
  color: white;
  border-color: var(--primary);
}

.effect-item.selected .effect-label {
  color: white;
}

.vertigo-preview {
  background: var(--surface-dark);
  border-radius: var(--radius);
  padding: 1rem;
}

.alias-preview-section h4 {
  margin: 0 0 1rem 0;
  color: var(--primary);
}

.alias-preview {
  margin-bottom: 1rem;
}

.alias-preview:last-child {
  margin-bottom: 0;
}

.alias-preview label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text);
}

.alias-preview .command-preview {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem;
  font-family: 'Courier New', monospace;
  font-size: 0.875rem;
  color: var(--text);
  word-break: break-all;
  max-height: 100px;
  overflow-y: auto;
}

.alias-preview .command-preview:empty:before {
  content: 'No effects selected';
  color: var(--text-muted);
  font-style: italic;
}

/* Responsive adjustments for Vertigo modal */
@media (max-width: 1024px) {
  .vertigo-environments {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .environment-header {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
  }

  .environment-controls {
    justify-content: space-between;
  }
}

@media (max-width: 768px) {
  .vertigo-header {
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
  }

  .effects-list {
    max-height: 300px;
  }

  .effect-item {
    padding: 0.75rem 0.5rem;
  }
}

/* File Explorer Modal */
.file-explorer-content {
  display: flex;
  gap: 1rem;
  max-height: 60vh;
}

.file-tree {
  flex: 0 0 30%;
  overflow-y: auto;
  border-right: 1px solid var(--border);
  padding-right: 0.5rem;
}

.tree-node {
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius);
  transition: background 0.2s;
}
.tree-node:hover {
  background: var(--surface-dark);
}
.tree-node.selected {
  background: var(--primary-light);
  color: #fff;
}
.tree-node.profile {
  font-weight: 600;
  margin-top: 0.5rem;
}
.tree-children {
  margin-left: 1rem;
}

.file-details {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.file-actions {
  margin-bottom: 0.5rem;
}

.file-content {
  flex: 1;
  background: var(--surface-dark);
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: auto;
  white-space: pre-wrap;
  font-family: monospace;
  font-size: 0.8rem;
}

/* Auto-Sync Indicator Styles */
#modifiedIndicator {
  display: none;
  color: var(--warning);
  font-size: 0.9em;
  margin-left: 10px;
  transition: all 0.3s ease;
}

#modifiedIndicator.syncing {
  color: var(--primary);
  display: inline !important;
}

#modifiedIndicator.synced {
  color: var(--success);
  display: inline !important;
}

#modifiedIndicator.error {
  color: var(--danger);
  display: inline !important;
}

#modifiedIndicator i {
  margin-right: 0.25rem;
}

/* Import Strategy Options */
.import-strategy-section {
  margin: 1.5rem 0;
}

.import-strategy-label {
  display: block;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.75rem;
  font-size: 0.95rem;
}

.import-strategy-options {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-left: 0.5rem;
}

.import-strategy-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: var(--radius);
  transition: background-color 0.2s ease;
}

.import-strategy-option:hover {
  background-color: var(--surface-light);
}

.import-strategy-option input[type="radio"] {
  margin: 0;
  accent-color: var(--primary);
}

.import-strategy-option span {
  color: var(--text);
  user-select: none;
  font-size: 0.9rem;
}

.strategy-description {
  color: var(--text-dim);
  font-size: 0.8rem;
  margin-top: 0.25rem;
  line-height: 1.3;
  padding-left: 1.5rem;
  font-style: italic;
}

/* Alias Chain Builder Styles */
.alias-selector-container {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: 100%; /* Use all available space within the grid cell */
}

.alias-selector-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 1rem 1rem 0.5rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface-dark);
  gap: 1rem;
}

.alias-header-left {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 1;
}

.alias-selector-header h3 {
  margin: 0;
  color: #1e293b; /* Dark gray for light mode */
  font-size: 1.1rem;
  text-align: center;
  width: 100%;
}


/* Dark mode override for alias-selector-header h3 */
[data-theme='dark'] .alias-selector-header h3 {
  color: #ffffff; /* White for dark mode */
}

.alias-selector {
  padding: 1rem;
  flex: 1;
  overflow: hidden; /* scrolling handled by alias-grid */
  display: flex;
  flex-direction: column;
  min-height: 0;
  max-height: calc(100% - 3rem); /* Account for own padding + extra space for button breathing room */
}

.alias-grid-container {
  flex: 1;
  overflow: hidden;
  margin-bottom: 1rem;
  min-height: 0; /* Allow flexbox child to shrink properly */
  display: flex;
  flex-direction: column;
}

.alias-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 0.5rem;
  overflow-y: auto;
  overflow-x: hidden;
  align-content: start;
  flex: 1;
  min-height: 0;
  max-height: calc(100% - 1rem); /* Ensure space for margin-bottom */
  padding-right: 0.5rem;
  box-sizing: border-box;
}

.alias-selector-container .alias-item {
  display: flex;
  flex-direction: column;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
  transition: var(--transition);
  gap: 0.25rem;
  min-height: 80px;
}

.alias-selector-container .alias-item:hover {
  border-color: var(--primary-light);
  background: var(--surface-dark);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.alias-selector-container .alias-item.selected {
  border-color: var(--primary);
  background: rgba(37, 99, 235, 0.05);
  box-shadow: var(--shadow-md);
}

.alias-selector-container .alias-item.active {
  border-color: var(--primary);
  background: rgba(37, 99, 235, 0.05);
  box-shadow: var(--shadow-md);
}

.alias-name {
  font-weight: 600;
  color: var(--text);
  font-size: 0.9rem;
  line-height: 1.2;
  word-break: break-word;
  hyphens: auto;
  transition: font-size 0.2s ease;
  text-align: center;
  width: 100%;
}

/* Dynamic font sizing for alias names based on length */
.alias-selector-container .alias-item[data-length='short'] .alias-name {
  font-size: 0.9rem;
}

.alias-selector-container .alias-item[data-length='medium'] .alias-name {
  font-size: 0.8rem;
}

.alias-selector-container .alias-item[data-length='long'] .alias-name {
  font-size: 0.7rem;
}

.alias-selector-container .alias-item[data-length='extra-long'] .alias-name {
  font-size: 0.6rem;
}

.alias-command-count {
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 500;
  margin-top: auto;
}

.alias-selector-actions {
  display: flex;
  gap: 0.5rem;
  padding: 1rem 0.25rem; /* More vertical space, minimal horizontal padding */
  border-top: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0; /* Fixed to bottom - never shrinks */
  justify-content: flex-start; /* Keep buttons grouped together on the left */
}
/* Mode toggle adjustments for three buttons */
.mode-toggle {
  display: flex;
  background: var(--surface-dark);
  border-radius: var(--radius);
  padding: 0.25rem;
  gap: 0.125rem;
}

.mode-btn {
  padding: 0.5rem 1rem;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: calc(var(--radius) - 0.125rem);
  cursor: pointer;
  transition: var(--transition);
  font-size: 0.875rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.375rem;
  flex: 1;
  justify-content: center;
  min-width: 0;
}

.mode-btn:hover:not(:disabled) {
  background: var(--surface);
  color: var(--text);
}

.mode-btn.active {
  background: var(--primary);
  color: white;
  box-shadow: var(--shadow);
}

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

.mode-btn i {
  font-size: 0.875rem;
}

/* Responsive adjustments for three-button mode toggle */
@media (max-width: 768px) {
  .mode-btn {
    padding: 0.375rem 0.75rem;
    font-size: 0.8rem;
  }
  
  .mode-btn span {
    display: none;
  }
  
  .mode-btn i {
    margin: 0;
  }
}

@media (max-width: 480px) {
  .mode-btn {
    padding: 0.375rem 0.5rem;
  }
}

/* ===== COMPACT ICON-BASED TOOLBAR SYSTEM ===== */

/* Header Toolbar Container */
.header-toolbar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  justify-content: flex-end;
}

/* Toolbar Groups */
.toolbar-group {
  display: flex;
  align-items: center;
  gap: 0.125rem;
  background: var(--surface-light, var(--surface-dark));
  border-radius: var(--radius);
  padding: 0.125rem;
  border: 1px solid var(--border);
}

/* Compact Toolbar Buttons */
.toolbar-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: none;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  transition: var(--transition);
  font-size: 0.75rem;
  position: relative;
}

.toolbar-btn:hover:not(:disabled) {
  background: var(--surface-dark);
  color: var(--primary);
}

.toolbar-btn:active:not(:disabled) {
  transform: scale(0.95);
}

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

/* Toolbar Button Variants */
.toolbar-btn-primary {
  background: var(--primary);
  color: white;
}

.toolbar-btn-primary:hover:not(:disabled) {
  background: var(--primary-dark);
  color: white;
}

.toolbar-btn-danger {
  background: var(--danger);
  color: white;
}

.toolbar-btn-danger:hover:not(:disabled) {
  background: var(--danger-dark);
  color: white;
}

/* Toggle Button States */
.toolbar-toggle.active {
  background: var(--primary);
  color: white;
}

.toolbar-toggle.active:hover {
  background: var(--primary-dark);
  color: white;
}

/* Expandable Search Input */
.toolbar-search {
  position: relative;
  display: flex;
  align-items: center;
}

.toolbar-search-input {
  position: absolute;
  right: 32px;
  top: 0;
  width: 0;
  height: 24px;
  border: none;
  background: #ffffff;
  border-radius: var(--radius);
  padding: 0;
  font-size: 0.8rem;
  color: #333333;
  outline: none;
  opacity: 0;
  transition: all 0.3s ease;
  z-index: 100;
  border: 1px solid #d1d5db;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.toolbar-search-input.expanded {
  width: 150px;
  padding: 0 0.5rem;
  opacity: 1;
  margin-right: 4px;
  background: #ffffff;
  z-index: 1000;
}

.toolbar-search-input:focus {
  background: #f9fafb;
  border-color: #3b82f6;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

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

.toolbar-search-btn {
  position: relative;
}
/* Dark Mode Adjustments */
[data-theme='dark'] .toolbar-group {
  background: var(--surface-dark);
  border-color: var(--border-dark);
}

[data-theme='dark'] .toolbar-btn {
  color: var(--text);
}

[data-theme='dark'] .toolbar-btn:hover:not(:disabled) {
  background: var(--surface);
  color: var(--primary);
}

[data-theme='dark'] .toolbar-input-group {
  background: var(--surface-dark);
  border-color: var(--border-dark);
}

[data-theme='dark'] .toolbar-input {
  background: transparent;
  color: var(--text);
}

[data-theme='dark'] .toolbar-input:focus {
  background: var(--surface);
}

[data-theme='dark'] .toolbar-input-group .toolbar-btn {
  background: var(--surface);
  border-color: var(--border-dark);
}
/* Responsive Toolbar */
@media (max-width: 768px) {
  .header-toolbar {
    gap: 0.25rem;
  }
  
  .toolbar-group {
    gap: 0.0625rem;
    padding: 0.0625rem;
  }
  
  .toolbar-btn {
    width: 20px;
    height: 20px;
    font-size: 0.7rem;
  }
  
  .toolbar-search-input.expanded {
    width: 120px;
    font-size: 0.75rem;
    height: 20px;
    right: 28px;
  }
}

@media (max-width: 480px) {
  .header-toolbar {
    gap: 0.2rem;
  }
  
  .toolbar-group {
    justify-content: center;
  }
  
  .toolbar-btn {
    width: 18px;
    height: 18px;
    font-size: 0.65rem;
  }
  
  .toolbar-search-input.expanded {
    width: 100px;
    font-size: 0.7rem;
    height: 18px;
    right: 26px;
  }
}

/* Special styling for command count in toolbar */
.command-count {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-weight: 500;
}

.command-count i {
  opacity: 0.7;
}

/* CSS-based tooltips removed - using UIUtilityService tooltips instead */

[data-theme='dark'] .toolbar-search-input {
  background: #1f2937;
  color: #f9fafb;
  border-color: #4b5563;
}

[data-theme='dark'] .toolbar-search-input.expanded {
  background: #374151;
  border-color: #6b7280;
}

[data-theme='dark'] .toolbar-search-input:focus {
  background: #4b5563;
  border-color: #3b82f6;
}

[data-theme='dark'] .toolbar-search-input:focus {
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.5);
}

/* Key Capture Section Styles */
.capture-indicator {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  color: var(--primary);
  font-weight: 500;
}

.capture-indicator i {
  font-size: 1rem;
}
@media (max-width: 768px) {
  .capture-indicator {
    font-size: 0.9rem;
  }
  }

/* Key Selection Modal specific styles */
#keySelectionModal .modal-content {
  min-width: 600px;
  min-height: 400px;
  width: 800px;
  height: auto;
  max-height: 90vh; /* Allow expansion up to 90% of viewport height */
}

#keySelectionModal .modal-body {
  min-height: 300px;
  max-height: calc(90vh - 120px); /* Account for header and footer */
  display: flex;
  flex-direction: column;
  overflow: hidden; /* Let content handle scrolling */
}

#keySelectionModal .key-selection-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden; /* Let sections handle scrolling */
}
/* Key Selection Modal specific styles - high specificity */
/* Enhanced Key Selection Modal */
#keySelectionModal.extra-large-modal .modal-content {
  min-width: 1000px !important;
  min-height: 600px !important;
  width: 90vw !important;
  max-width: 1400px !important;
  height: auto !important;
  max-height: 95vh !important;
}

#keySelectionModal.large-modal .modal-content {
  min-width: 600px !important;
  min-height: 400px !important;
  width: 800px !important;
  height: auto !important;
  max-height: 90vh !important; /* Allow expansion up to 90% of viewport height */
}

#keySelectionModal .modal-body {
  min-height: 300px !important;
  max-height: calc(90vh - 120px) !important; /* Account for header and footer */
  display: flex !important;
  flex-direction: column !important;
  width: 100% !important;
  overflow: hidden !important; /* Let content handle scrolling */
}

#keySelectionModal .key-selection-content {
  flex: 1 !important;
  display: flex !important;
  flex-direction: column !important;
  min-height: 0 !important;
  width: 100% !important;
  overflow: hidden !important; /* Let sections handle scrolling */
}

.key-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
  gap: 0.5rem;
  overflow-y: auto;
}

.key-item {
  padding: 0.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
  font-size: 0.9rem;
  font-weight: 500;
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.key-item .key-label {
  line-height: 1;
  word-break: normal;
  hyphens: none;
  font-size: 0.875rem;
  transition: font-size 0.2s ease;
  text-align: center;
  width: 100%;
}

/* Dynamic font sizing based on label length */
.key-item[data-length='short'] .key-label {
  font-size: 0.75rem;
}

.key-item[data-length='medium'] .key-label {
  font-size: 0.65rem;
}

.key-item[data-length='long'] .key-label {
  font-size: 0.55rem;
}

.key-item[data-length='extra-long'] .key-label {
  font-size: 0.45rem;
}

.key-item:hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.key-item.selected {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.key-item.active:hover {
  background: var(--secondary);
  color: white;
  border-color: var(--primary);
}

[data-theme='dark'] .key-item.active:hover {
  background: var(--secondary);
  color: var(--text-primary);
  border-color: var(--primary);
}

.key-item.active {
  border-color: var(--primary);
  background: rgba(37, 99, 235, 0.05);
  box-shadow: var(--shadow-md);
}

.key-item .activity-bar {
  position: absolute;
  bottom: 2px;
  left: 2px;
  right: 2px;
  height: 3px;
  background: currentColor;
  border-radius: 2px;
  opacity: 0.7;
}

.key-item .command-count-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  background: var(--accent);
  color: white;
  font-size: 0.6rem;
  font-weight: 600;
  padding: 0.125rem 0.25rem;
  border-radius: 9999px;
  min-width: 14px;
  height: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
}


/* Key category enhancements */

.category h4 .key-count {
  margin-left: auto;
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: normal;
}

/* Key-specific styling for command items */
.command-item[data-key] .key-label {
  font-weight: 500;
  flex-shrink: 0;
  transition: font-size 0.2s ease;
}

/* Dynamic font sizing for categorized view keys */
.command-item[data-key][data-length='short'] .key-label {
  font-size: 0.875rem;
}

.command-item[data-key][data-length='medium'] .key-label {
  font-size: 0.8rem;
}

.command-item[data-key][data-length='long'] .key-label {
  font-size: 0.75rem;
}

.command-item[data-key] .command-count-badge {
  background: var(--accent);
  color: white;
  font-size: 0.6rem;
  font-weight: 600;
  padding: 0.125rem 0.375rem;
  border-radius: 9999px;
  min-width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: auto;
}

/* ============================================================================
 * Enhanced Hybrid Key Capture Interface Styles
 * ============================================================================ */

.hybrid-key-capture {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  /*padding: 1rem;*/
  min-height: 500px;
  height: 100%; /* occupy full modal height */
}

/* Make main content scrollable while header/footer remain fixed */
.capture-content {
  flex: 1 1 auto;
  overflow-y: auto;
}

.capture-footer {
  margin-top: auto; /* stick to bottom of flex container */
  padding-top: 0.25rem;
  background: var(--surface, #fff);
}

/* In case virtual keyboard gets too wide, allow horizontal scroll */
.virtual-keyboard {
  overflow: auto;
}

/* Capture Header */
.capture-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.0rem;
  background: linear-gradient(135deg, var(--primary-light, #eff6ff), var(--surface-light, #f8fafc));
  border-radius: var(--radius, 8px);
  border: 2px dashed var(--primary, #2563eb);
}

.capture-zone {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.capture-indicator {
  position: relative;
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--surface, #ffffff);
  border: 3px solid var(--border, #d1d5db);
  transition: all 0.3s ease;
}

.capture-indicator.active {
  border-color: var(--primary, #2563eb);
  background: var(--primary, #2563eb);
  color: white;
  animation: pulse 2s infinite;
}

.capture-indicator.active .pulse-ring {
  position: absolute;
  top: -4px;
  left: -4px;
  right: -4px;
  bottom: -4px;
  border: 2px solid var(--primary, #2563eb);
  border-radius: 50%;
  animation: pulsering 2s infinite;
}

@keyframes pulsering {
  0% { transform: scale(1); opacity: 1; }
  100% { transform: scale(1.3); opacity: 0; }
}

.capture-instructions h3 {
  margin: 0 0 0.5rem 0;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary, #111827);
}

.capture-instructions p {
  margin: 0;
  color: var(--text-secondary, #6b7280);
  font-size: 0.9rem;
}
/* Selection Preview */
.selection-preview {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 1.0rem;
  background: var(--surface, #ffffff);
  border: 1px solid var(--border, #d1d5db);
  border-radius: var(--radius, 8px);
}

.preview-display label {
  font-weight: 600;
  color: var(--text-primary, #111827);
  margin-bottom: 0.5rem;
  display: block;
}

.key-preview-display {
  min-height: 2.5rem;
  display: flex;
  align-items: center;
  padding: 0.75rem 1rem;
  background: var(--surface-light, #f8fafc);
  border: 1px solid var(--border, #d1d5db);
  border-radius: var(--radius, 6px);
  font-family: 'Courier New', monospace;
  font-weight: 600;
}

.key-combination {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.key-combination kbd {
  background: var(--primary, #2563eb);
  color: white;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.875rem;
  font-weight: 600;
  border: none;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.key-combination .plus {
  color: var(--text-secondary, #6b7280);
  font-weight: 600;
  margin: 0 0.25rem;
}

.no-selection {
  color: var(--text-secondary, #6b7280);
  font-style: italic;
}
/* Smart Suggestions */



.modifier-toggle {
  padding: 0.75rem 1rem;
  background: var(--surface-light, #f8fafc);
  border: 2px solid var(--border, #d1d5db);
  border-radius: var(--radius, 6px);
  cursor: pointer;
  transition: all 0.2s ease;
  font-weight: 600;
  min-width: 70px;
  text-align: center;
}

.modifier-toggle:hover {
  border-color: var(--primary, #2563eb);
  background: var(--primary-light, #eff6ff);
}
.location-specific-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: var(--text-secondary, #6b7280);
  margin-top: 0.5rem;
}

/* Virtual Keyboard */
.virtual-keyboard {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.25rem;
  background: var(--surface-light, #f8fafc);
  border: 1px solid var(--border, #d1d5db);
  border-radius: var(--radius, 8px);
  overflow-x: auto;
}

.keyboard-row {
  display: flex;
  gap: 0.25rem;
  justify-content: flex-start; /* was center */
  min-width: fit-content;
}

.vkey {
  position: relative;
  min-width: 2.5rem;
  height: 2.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--surface, #ffffff);
  border: 1px solid var(--border, #d1d5db);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
  font-size: 0.75rem;
  font-weight: 500;
  user-select: none;
}

.vkey:hover {
  background: var(--primary-light, #eff6ff);
  border-color: var(--primary, #2563eb);
  transform: translateY(-1px);
  z-index: 2;
}

.vkey.pressed {
  background: var(--warning, #f59e0b);
  border-color: var(--warning, #f59e0b);
  color: white;
  transform: translateY(1px);
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.2);
}

.vkey.selected {
  background: var(--primary, #2563eb);
  border-color: var(--primary, #2563eb);
  color: white;
  box-shadow: 0 0 0 2px var(--primary-light, #eff6ff);
}

.key-primary {
  font-weight: 600;
  line-height: 1;
}

.key-secondary {
  font-size: 0.6rem;
  opacity: 0.7;
  line-height: 1;
  margin-top: 1px;
}

/* Special key styling */

.vkey[data-key-code="Space"] {
  min-width: 13.75rem; /* 5.5u */
}

.vkey[data-key-code="Enter"],
.vkey[data-key-code="Backspace"] {
  min-width: 4rem;
}

.vkey[data-key-code="Tab"] {
  min-width: 3.5rem;
}

.vkey[data-key-code*="Shift"] {
  min-width: 5.625rem; /* 2.25u */
}
/* Responsive Design for Hybrid Interface */
@media (max-width: 1200px) {
  .hybrid-key-capture {
    gap: 1rem;
  }
  
  }

@media (max-width: 900px) {
  .capture-header {
    flex-direction: column;
    gap: 1rem;
    text-align: center;
  }
  
  .selection-preview {
    flex-direction: column;
    gap: 1rem;
  }
  
  .virtual-keyboard {
    overflow-x: scroll;
  }
}

/* Command chain */
.command-chain-container {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
  page-break-inside: avoid;
}

.chain-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1rem;
  padding: 1rem 1rem 0.5rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface-dark);
  gap: 0.25rem;
}

.chain-header-left {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex: 1;
}

.chain-header h3 {
  color: #1e293b; /* Dark gray for light mode */
  font-size: 1.2rem;
  margin: 0;
  text-align: center;
  width: 100%;
}

.chain-header-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

/* Dark mode override for chain-header h3 */
[data-theme='dark'] .chain-header h3 {
  color: #ffffff; /* White for dark mode */
}

.command-count {
  background: var(--surface-dark);
  padding: 0.25rem 0.5rem;
  border-radius: 9999px;
  font-size: 0.8rem;
  color: var(--text-muted);
}
.command-list-container {
  flex: 1;
  overflow: hidden;
  margin-bottom: 1rem;
  padding: 0 1rem;
}

.command-list {
  height: 100%;
  overflow-y: auto;
  padding-right: 0.5rem;
}

.command-item-row {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 1rem;
  align-items: center;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 0.5rem;
  background: var(--surface-dark);
  cursor: grab;
  transition: var(--transition);
  position: relative;
}

.command-item-row:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.command-item-row:active {
  cursor: grabbing;
}

.command-item-row.dragging {
  opacity: 0.5;
  transform: rotate(2deg);
}

.command-item-row.drag-over {
  border-color: var(--primary);
  background: rgba(37, 99, 235, 0.1);
}

.command-number {
  font-weight: bold;
  color: var(--text-muted);
  min-width: 1.5rem;
  text-align: center;
  background: var(--surface);
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
}

.command-content {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.command-icon {
  font-size: 1.1rem;
  flex-shrink: 0;
}

.command-text {
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.command-type {
  background: var(--secondary);
  color: white;
  padding: 0.25rem 0.5rem;
  border-radius: 9999px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  flex-shrink: 0;
}

.command-actions {
  display: flex;
  align-items: center;
  gap: 0.125rem;
  background: var(--surface-light, var(--surface-dark));
  border-radius: var(--radius);
  padding: 0.125rem;
  border: 1px solid var(--border);
}

/* Palindromic Controls */
/* Palindromic toggle button - uses toolbar-toggle class for styling */
/* Active state = included in palindrome, Inactive = excluded */

/* Command Groups - Grouped view for stabilized chains */
.command-group-separator {
  height: 32px;
  background: linear-gradient(to bottom, transparent, var(--surface-dark, rgba(0,0,0,0.05)), transparent);
  border-left: 3px solid var(--primary, #4a90e2);
  margin: 8px 0 4px 0;
  padding: 0 12px;
  display: flex;
  align-items: center;
  cursor: pointer;
  transition: background-color 0.2s;
  border-radius: var(--radius);
}

.command-group-separator:hover {
  background: linear-gradient(to bottom, transparent, var(--surface-hover, rgba(0,0,0,0.08)), transparent);
}

.group-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.group-info {
  display: flex;
  align-items: center;
  gap: 8px;
}

.twisty {
  width: 12px;
  height: 12px;
  transition: transform 0.2s ease;
  display: inline-block;
  font-size: 10px;
  color: var(--text-muted);
}

.twisty.collapsed {
  transform: rotate(0deg);
}

.twisty:not(.collapsed) {
  transform: rotate(90deg);
}

/* Component-specific adjustments for command-group-separator */
.command-group-separator .twisty {
  width: 12px;
  height: 12px;
  font-size: 10px;
  margin-right: 8px;
}

.group-title {
  font-weight: 600;
  color: var(--text);
  font-size: 0.85rem;
}

.group-count {
  color: var(--text-muted);
  font-size: 0.75rem;
  background: var(--surface, rgba(0,0,0,0.1));
  padding: 2px 6px;
  border-radius: 10px;
}

.group-hint {
  color: var(--text-muted);
  font-size: 0.7rem;
  font-style: italic;
}

/* Command items in groups - subtle visual distinction */
.command-item-row[data-group] {
  margin-left: 12px;
  border-left: 2px solid transparent;
}

.command-item-row[data-group="non-trayexec"] {
  border-left-color: var(--secondary, #6c757d);
}

.command-item-row[data-group="palindromic"] {
  border-left-color: var(--primary, #4a90e2);
}

.command-item-row[data-group="pivot"] {
  border-left-color: var(--accent, #f39c12);
}

/* Command Action Buttons - Match toolbar-btn styling */
.command-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: none;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  transition: var(--transition);
  font-size: 0.75rem;
  position: relative;
}

.command-action-btn:hover:not(:disabled) {
  background: var(--surface-dark);
  color: var(--primary);
}

.command-action-btn:active:not(:disabled) {
  transform: scale(0.95);
}

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


.command-action-btn-danger {
  background: var(--danger);
  color: white;
}

.command-action-btn-danger:hover:not(:disabled) {
  background: var(--danger-dark);
  color: white;
}

/* Dark Mode Adjustments for Command Actions */
[data-theme='dark'] .command-actions {
  background: var(--surface-dark);
  border-color: var(--border-dark);
}

[data-theme='dark'] .command-action-btn {
  color: var(--text);
}

[data-theme='dark'] .command-action-btn:hover:not(:disabled) {
  background: var(--surface);
  color: var(--primary);
}

/* Responsive Command Actions */
@media (max-width: 768px) {
  .command-actions {
    gap: 0.0625rem;
    padding: 0.0625rem;
  }
  
  .command-action-btn {
    width: 20px;
    height: 20px;
    font-size: 0.7rem;
  }
}

@media (max-width: 480px) {
  .command-action-btn {
    width: 18px;
    height: 18px;
    font-size: 0.65rem;
  }
}

.command-warning-icon {
  color: var(--warning);
  margin-left: 0.5rem;
  cursor: help;
  position: relative;
  display: inline-flex;
  align-items: center;
}

.command-warning-icon i {
  font-size: 0.9rem;
  animation: warning-pulse 2s infinite;
}

.command-warning-icon:hover {
  color: #f59e0b;
}

@keyframes warning-pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.6;
  }
}

/*.generated-command {
  margin-bottom: 1rem;
}*/

.command-preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.25rem;
  margin-left: 0.5rem;
  margin-right: 0.5rem;
}

.command-preview-header label {
  font-weight: 600;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.command-count-display {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
  margin-left: auto;
  margin-right: 1rem;
}

.command-preview {
  background: var(--surface-darker);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem;
  font-family:
    'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New',
    monospace;
  font-size: 0.85rem;
  word-break: break-all;
  color: var(--primary);
  max-height: 100px;
  overflow-y: auto;
}


/* Command library */
.command-library {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.library-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 1rem 1rem 0.5rem 1rem;
  background: var(--surface-dark);
  border-bottom: 1px solid var(--border);
  gap: 1rem;
}

.library-header-left {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 1;
}

.library-header h3 {
  margin: 0;
  color: #1e293b;
  font-size: 1.1rem;
  text-align: center;
  width: 100%;
}
/* Dark mode override for library-header h3 */
[data-theme='dark'] .library-header h3 {
  color: #ffffff;
}

.library-content {
  flex: 1;
  overflow: hidden;
  padding: 0 1rem 1rem 1rem;
}

.command-categories {
  height: 100%;
  overflow-y: auto;
  padding-right: 0.5rem;
}

.category {
  margin-bottom: 1.5rem;
}

.category h4 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  font-size: 1rem;
  color: var(--text);
  cursor: pointer;
  padding: 0.5rem;
  border-radius: var(--radius);
  transition: var(--transition);
}

.category h4:hover {
  background: var(--surface-dark);
}

.category h4 i {
  color: var(--primary);
  width: 1.25rem;
}

/* Command Library category collapsible enhancements */
.category h4 .category-chevron {
  transition: transform 0.2s ease;
  color: var(--text-muted);
  font-size: 0.8rem;
  width: 12px;
}

.category h4:not(.collapsed) .category-chevron {
  transform: rotate(90deg);
}

.category h4.collapsed {
  margin-bottom: 0;
}

.category h4 .command-count {
  margin-left: auto;
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: normal;
}

.category-commands {
  display: grid;
  gap: 0.25rem;
  margin-left: 1.75rem;
}

.category-commands.collapsed {
  display: none;
}

.command-item {
  padding: 0.625rem 0.75rem;
  background: var(--surface-dark);
  border-radius: var(--radius);
  cursor: pointer;
  transition: var(--transition);
  font-size: 0.875rem;
  border: 1px solid transparent;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.command-item:hover {
  background: var(--primary);
  color: white;
  transform: translateX(4px);
  box-shadow: var(--shadow);
}

.command-item.alias-item {
  background: linear-gradient(135deg, var(--accent), #fbbf24);
  color: white;
  font-weight: 500;
}

.command-item.alias-item:hover {
  background: linear-gradient(135deg, var(--accent-hover), var(--accent));
  transform: translateX(4px) scale(1.02);
}

.command-item.vertigo-alias-item {
  background: linear-gradient(135deg, #8b5cf6, #6366f1);
  color: white;
  font-weight: 500;
}

.command-item.vertigo-alias-item:hover {
  background: linear-gradient(135deg, #7c3aed, #5b21b6);
  transform: translateX(4px) scale(1.02);
}

.command-item.bindset-alias-item {
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
  font-weight: 500;
}

.command-item.bindset-alias-item:hover {
  background: linear-gradient(135deg, #047857, #065f46);
  transform: translateX(4px) scale(1.02);
}

/* Empty states */
.empty-state {
  text-align: center;
  padding: 3rem 2rem;
  color: var(--text-muted);
  display: none; /* Hidden by default to prevent flicker */
}

/* Show empty state only when explicitly needed */
.empty-state.show {
  display: block;
}

.empty-state i {
  font-size: 3rem;
  margin-bottom: 1rem;
  color: var(--text-light);
}

.empty-state h4 {
  margin-bottom: 0.5rem;
  color: var(--text);
  font-size: 1.1rem;
}

.empty-state p {
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: var(--transition);
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  min-height: 35px;
}

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

.btn-primary {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

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

.btn-secondary {
  background: var(--secondary);
  color: white;
  border-color: var(--secondary);
}

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

.btn-danger {
  background: var(--danger);
  color: white;
  border-color: var(--danger);
}

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

.btn-small {
  padding: 0.25rem 0.5rem;
  font-size: 0.8rem;
}

.btn-icon {
  padding: 0.5rem;
  min-width: 2.5rem;
}

/* Key Selection Modal specific key grid */
#keySelectionModal .key-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
  gap: 0.25rem;
  /* Remove max-height constraint to allow expansion */
  max-height: none !important;
  overflow-y: auto;
}

#keySelectionModal .key-item {
  padding: 0.25rem;
  min-height: 35px;
}

/* Validation error helper (used in forms inside modals etc.) */
.validation-error {
  color: var(--danger);
  font-size: 0.875rem;
  margin-top: 0.25rem;
  line-height: 1.2;
  display: block;
  transition: opacity 0.2s ease;
}

[data-theme='dark'] .validation-error {
  color: var(--danger);
}

/* Active state for generic toolbar buttons (used by search/filter) */
.toolbar-btn.active {
  background: var(--primary);
  color: #ffffff;
}

.toolbar-btn.active:hover {
  background: var(--primary-hover);
  color: #ffffff;
}

[data-theme='dark'] .toolbar-btn.active {
  background: var(--primary);
  color: #ffffff;
}
/* Validation status colors */
.status-success { color: var(--success); }
.status-warning { color: var(--warning); }
.status-error   { color: var(--danger); }
.status-indicator.clickable { cursor: pointer; text-decoration: underline; }

.modal-body ul { list-style: none; padding-left: 0; }
.error-item { color: var(--danger); }
.warning-item { color: var(--warning); }

/* Selected modifier keys should override the special styling */
.vkey[data-key-code*="Shift"].selected,
.vkey[data-key-code*="Control"].selected,
.vkey[data-key-code*="Alt"].selected {
  background: var(--primary, #2563eb) !important;
  color: white !important;
  border-color: var(--primary, #2563eb) !important;
  box-shadow: 0 0 0 2px var(--primary-light, #eff6ff) !important;
}

/* Modifier active state (when used as toggles) */
.vkey.modifier-active {
  background: var(--warning, #f59e0b) !important;
  color: white !important;
  border-color: var(--warning, #f59e0b) !important;
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.2) !important;
  transform: translateY(1px);
}

.vkey.modifier-active:hover {
  background: var(--warning-dark, #d97706) !important;
  border-color: var(--warning-dark, #d97706) !important;
}

/* Disabled state for virtual keyboard during capture mode */
.virtual-keyboard.disabled {
  opacity: 0.4;
  pointer-events: none;
  filter: grayscale(90%);
  transition: opacity 0.2s ease, filter 0.2s ease;
}

/* Ensure inner keys inherit disabled pointer event state */
.virtual-keyboard.disabled .vkey {
  pointer-events: none;
}

/* Key Capture Modal footer alignment */
.capture-footer .action-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

.vkey.modifier-active.selected {
  background: var(--warning, #f59e0b) !important;
  color: white !important;
  border-color: var(--warning, #f59e0b) !important;
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.2) !important;
}

/* ... existing code ...
@media (prefers-color-scheme: dark) {}

/* Dark theme overrides for Key Selection virtual keyboard */
[data-theme='dark'] .virtual-keyboard .vkey {
  background: #424242;
  color: #f5f5f5;
  border-color: #6b7280;
}

[data-theme='dark'] .virtual-keyboard .vkey:hover {
  background: #4f4f4f;
  border-color: #9ca3af;
}

/* Selected (blue) in dark mode – keep readable */
[data-theme='dark'] .virtual-keyboard .vkey.selected,
[data-theme='dark'] .virtual-keyboard .vkey.pressed {
  background: var(--primary, #3b82f6) !important;
  color: #ffffff !important;
  border-color: var(--primary, #3b82f6) !important;
}

/* Modifier-active (gold) in dark mode */
[data-theme='dark'] .virtual-keyboard .vkey.modifier-active,
[data-theme='dark'] .virtual-keyboard .vkey.modifier-active.selected {
  background: var(--warning, #f59e0b) !important;
  color: #ffffff !important;
  border-color: var(--warning, #f59e0b) !important;
}

/* Key labels inside the key */
[data-theme='dark'] .virtual-keyboard .vkey .key-primary,
[data-theme='dark'] .virtual-keyboard .vkey .key-secondary {
  color: inherit;
}

/* ... existing code ... */

/* Dark theme enhancements for Key Capture modal */
[data-theme='dark'] .key-preview-display {
  background: var(--surface-dark);
  border-color: var(--border-dark);
}

[data-theme='dark'] .key-preview-display .no-selection {
  color: var(--text-muted);
}

[data-theme='dark'] .key-combination .plus {
  color: var(--text-light);
}

/* Dark theme virtual keyboard container adjustments */
[data-theme='dark'] .virtual-keyboard-container,
[data-theme='dark'] .virtual-keyboard {
  background: var(--surface-dark);
  border-color: var(--border-dark);
}


/* New three-column virtual keyboard layout */
.keyboard-columns {
  display: flex;
  gap: 2rem;
}
.keyboard-column {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.keyboard-row { display: flex; gap: 0.25rem; height: 2.5rem;}
/* remove previous grid definitions if present */

.vkey.placeholder {
  visibility: hidden;
  pointer-events: none;
  min-width: 0; /* allow custom width */
  width: auto;
}

/* Wider keys to reflect physical sizes */
.vkey[data-key-code="CapsLock"] {
  min-width: 4.375rem; /* 1.75u */
}

/* Ctrl and Alt – 2u keys */
.vkey[data-key-code*="Control"] {
  min-width: 3.125rem; /* 1.25u */
}

/* Ctrl and Alt – 2u keys */
.vkey[data-key-code*="Numpad0"] {
  min-width: 5.25rem; /* 1.25u */
}
/* Spacebar now 5u instead of default */
.vkey[data-key-code="Space"] {
  min-width: 13.75rem; /* 5.5u */
}

.vkey[data-key-code*="Alt"] {
  min-width: 3.125rem; /* 1.25u */
}

.vkey[data-key-code="AltLeft"] {
  margin-left: 0.625rem; /* 0.25u gap after Ctrl */
}

.vkey[data-key-code="AltRight"] {
  margin-right: 0.625rem; /* 0.25u gap before CtrlR */
}

.vkey[data-key-code="Lclick"] {
  width: 4.375rem;
}

.vkey[data-key-code="Ldrag"] {
  width: 4.375rem;
}

.vkey[data-key-code="Ldblclick"] {
  width: 4.375rem;
}

/** Right mouse actions */
.vkey[data-key-code="Rclick"] {
  width: 4.375rem;
}
.vkey[data-key-code="Rdrag"] {
  width: 4.375rem;
}
.vkey[data-key-code="Rdblclick"] {
  width: 4.375rem;
}

/** Middle mouse actions */
.vkey[data-key-code="Mclick"] {
  width: 4.375rem;
}
.vkey[data-key-code="Mdrag"] {
  width: 4.375rem;
}
.vkey[data-key-code="Mdblclick"] {
  width: 4.375rem;
}

/** Extra buttons (Button4 - Button10) */
.vkey[data-key-code="Button4"] {
  width: 4.375rem;
}
.vkey[data-key-code="Button5"] {
  width: 4.375rem;
}
.vkey[data-key-code="Button6"] {
  width: 4.375rem;
}
.vkey[data-key-code="Button7"] {
  width: 4.375rem;
}
.vkey[data-key-code="Button8"] {
  width: 4.375rem;
}
.vkey[data-key-code="Button9"] {
  width: 4.375rem;
}
.vkey[data-key-code="Button10"] {
  width: 4.375rem;
}

/** Wheel gestures */
.vkey[data-key-code="Wheelplus"] {
  width: 4.375rem;
}
.vkey[data-key-code="Wheelminus"] {
  width: 4.375rem;
}



/* Bindset Select & Manager */
.bindset-select {
  margin-left: 1rem;
  padding: 4px 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
}
.bindset-list-container {
  max-height: 300px;
  overflow-y: auto;
  margin-bottom: 1rem;
}
.bindset-list li {
  padding: 4px 6px;
  cursor: pointer;
}
.bindset-list li.selected {
  background: var(--primary);
  color: #fff;
}
.bindset-actions { display:flex; gap:0.5rem; margin-top:0.5rem; }
.error-text { color: var(--danger); font-size: 0.8rem; }

/* Bindset select overlay */
.bindset-select {
  min-width: 180px;
  padding: 4px;
}
/* Bindset Selector Dropdown */
.bindset-dropdown-menu {
  position: fixed;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  min-width: 250px;
  max-height: 400px;
  overflow-y: auto;
}

.bindset-option {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.bindset-option:hover {
  background: var(--surface-hover, var(--surface-dark));
}

.bindset-option.active {
  background: var(--accent);
  color: var(--accent-text);
}

.bindset-option.greyed-out {
  opacity: 0.5;
  cursor: not-allowed;
}

.bindset-option.greyed-out .bindset-name {
  color: var(--text-muted);
}

.bindset-option.greyed-out:hover {
  background: var(--surface);
  opacity: 0.5;
}

.bindset-name {
  flex: 1;
  font-weight: 500;
}

.toolbar-group {
  display: flex;
  gap: 4px;
}

.bindset-option:hover .toolbar-group {
  opacity: 1;
}

.toolbar-btn-small {
  padding: 2px 6px;
  font-size: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.toolbar-btn-small:hover:not(:disabled) {
  background: var(--surface-hover, var(--surface-dark));
  border-color: var(--accent);
}

.toolbar-btn-small:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  background: var(--surface);
}

.toolbar-btn-small.add-key-btn:hover:not(:disabled) {
  color: var(--success);
  border-color: var(--success);
}

.toolbar-btn-small.remove-key-btn:hover:not(:disabled) {
  color: var(--danger);
  border-color: var(--danger);
}

.bindset-dropdown-footer {
  border-top: 1px solid var(--border);
  padding: 8px 12px;
  text-align: center;
  background: var(--surface-alt, var(--surface));
}

.text-link {
  color: var(--accent);
  text-decoration: none;
  font-size: 12px;
  font-weight: 500;
}

.text-link:hover {
  text-decoration: underline;
}

/* Ensure proper positioning for the dropdown container */
#bindsetSelectorContainer {
  position: relative;
  display: inline-block;
}

/* Bindset Sections - Sectional key grid display */
.bindset-section {
  margin-bottom: 16px;
  border-radius: var(--radius);
  overflow: visible;
}

.bindset-header {
  /* Reuse command-group-separator styling with bindset-specific modifications */
  height: 36px;
  background: linear-gradient(to bottom, transparent, var(--surface-dark, rgba(0,0,0,0.05)), transparent);
  border-left: 3px solid var(--primary, #4a90e2);
  margin: 0;
  padding: 0 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: background-color 0.2s, border-color 0.2s;
  border-radius: var(--radius);
}

.bindset-header:hover {
  background: linear-gradient(to bottom, transparent, var(--surface-hover, rgba(0,0,0,0.08)), transparent);
}

.bindset-header .bindset-info {
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
}

.bindset-header .twisty {
  width: 16px;
  height: 16px;
  margin-right: 8px;
  font-size: 12px;
  color: var(--text-muted);
  transition: transform 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.bindset-header .twisty.collapsed {
  transform: rotate(0deg);
}

.bindset-header .twisty:not(.collapsed) {
  transform: rotate(90deg);
}

.bindset-header .bindset-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.bindset-header .bindset-count {
  font-size: 12px;
  color: var(--text-muted);
  margin-left: 8px;
  font-weight: 500;
}

.bindset-header .bindset-actions {
  display: flex;
  gap: 4px;
  margin-left: 12px;
}

.bindset-header .control-btn {
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  font-size: 12px;
}

.bindset-header .control-btn:hover {
  background: var(--surface-hover, rgba(0,0,0,0.1));
  color: var(--text-primary);
}

.bindset-header .control-btn:active {
  transform: scale(0.95);
}

.bindset-content {
  transition: all 0.3s ease;
  overflow: hidden;
}

.bindset-content.collapsed {
  max-height: 0;
  opacity: 0;
  margin-top: 0;
}

.bindset-content:not(.collapsed) {
  max-height: 2000px;
  opacity: 1;
  margin-top: 8px;
}

.key-grid-subsection {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
  gap: 8px;
  padding: 0 4px;
}

.empty-section {
  padding: 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
  font-style: italic;
  background: var(--surface-alt, var(--surface));
  border-radius: var(--radius);
  margin: 8px 4px;
}

/* Bindset menu dropdown */
.bindset-menu-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  background: var(--surface-alt, var(--surface));
  border: 1px solid var(--border-light, rgba(0,0,0,0.1));
  border-radius: var(--radius);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  z-index: 1000;
  min-width: 160px;
  max-width: 200px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: all 0.2s ease;
  margin-top: 4px;
}

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

.bindset-menu-item {
  display: flex;
  align-items: center;
  padding: 10px 12px;
  cursor: pointer;
  transition: background-color 0.2s ease;
  color: var(--text-primary);
  font-size: 13px;
  border-bottom: 1px solid var(--border-light, rgba(0,0,0,0.05));
}

.bindset-menu-item:last-child {
  border-bottom: none;
}

.bindset-menu-item:hover {
  background: var(--surface-hover, rgba(0,0,0,0.05));
}

.bindset-menu-item.dangerous {
  color: var(--danger, #dc3545);
}

.bindset-menu-item.dangerous:hover {
  background: var(--danger-light, rgba(220,53,69,0.1));
}

.bindset-menu-item i {
  width: 16px;
  margin-right: 8px;
  font-size: 12px;
  text-align: center;
}

.bindset-menu-item span {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Bindset menu button specific styling */
.bindset-menu-btn {
  position: relative;
}

.bindset-actions {
  position: relative;
}

/* Table headers for import modal - should look like normal table headers */
.import-modal .bindset-table th.bindset-header,
.keybind-modal .bindset-table th.bindset-header,
.command-chain-modal .bindset-table th.bindset-header,
.auth-modal .bindset-table th.bindset-header,
.profile-modal .bindset-table th.bindset-header {
  /* Reset to normal table header styling */
  height: auto !important;
  background: var(--surface-dark) !important;
  color: var(--text) !important;
  font-size: 0.875rem !important;
  padding: 1rem !important;
  text-transform: none !important;
  letter-spacing: normal !important;
  font-weight: 600 !important;
  border: 1px solid var(--border) !important;
  border-radius: 0 !important;
  margin: 0 !important;
  text-align: left !important;
  box-shadow: none !important;
  background-clip: border-box !important;
  cursor: default !important;
  display: table-cell !important;
  vertical-align: middle !important;
}

/* Remove hover effects for table headers */
.import-modal .bindset-table th.bindset-header:hover,
.keybind-modal .bindset-table th.bindset-header:hover,
.command-chain-modal .bindset-table th.bindset-header:hover,
.auth-modal .bindset-table th.bindset-header:hover,
.profile-modal .bindset-table th.bindset-header:hover {
  background: var(--surface-dark) !important;
}

/* Hide table-specific elements in modal table headers */
.import-modal .bindset-table th.bindset-header .twisty,
.import-modal .bindset-table th.bindset-header .bindset-info,
.import-modal .bindset-table th.bindset-header .bindset-count,
.import-modal .bindset-table th.bindset-header .bindset-actions,
.keybind-modal .bindset-table th.bindset-header .twisty,
.keybind-modal .bindset-table th.bindset-header .bindset-info,
.keybind-modal .bindset-table th.bindset-header .bindset-count,
.keybind-modal .bindset-table th.bindset-header .bindset-actions {
  display: none !important;
}

/* Responsive adjustments for bindset sections */
@media (max-width: 768px) {
  .bindset-header {
    height: 40px;
    padding: 0 8px;
  }

  .bindset-header .bindset-actions {
    gap: 2px;
    margin-left: 8px;
  }

  .bindset-header .control-btn {
    width: 32px;
    height: 32px;
    font-size: 14px;
  }

  .key-grid-subsection {
    grid-template-columns: repeat(auto-fill, minmax(50px, 1fr));
    gap: 6px;
    padding: 0 2px;
  }
}

@media (max-width: 480px) {
  .bindset-section {
    margin-bottom: 12px;
  }

  .bindset-header {
    height: 44px;
    padding: 0 6px;
    flex-wrap: wrap;
  }

  .bindset-header .bindset-info {
    flex: 1;
    min-width: 0;
  }

  .bindset-header .bindset-name {
    font-size: 13px;
  }

  .key-grid-subsection {
    grid-template-columns: repeat(auto-fill, minmax(45px, 1fr));
    gap: 4px;
  }
}

/* Bindset Delete Confirmation Modal Styles */
.bindset-delete-confirm-modal .modal-content {
  width: 600px;
}

.bindset-delete-confirm-content {
  max-height: 90vh;
}

.bindset-delete-warning {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid var(--danger);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 1.5rem;
}

[data-theme='dark'] .bindset-delete-warning {
  background: rgba(239, 68, 68, 0.2);
}

.bindset-delete-warning p {
  margin: 0.5rem 0;
  color: var(--text);
}

.bindset-delete-warning p:first-child {
  margin-top: 0;
}

.bindset-delete-warning p:last-child {
  margin-bottom: 0;
}

.bindset-delete-steps {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.bindset-delete-step {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* Checkbox styles */
.checkbox-label {
  display: flex !important;
  align-items: center !important;
  gap: 0.75rem !important;
  cursor: pointer !important;
  font-weight: normal !important;
  color: var(--text) !important;
  margin: 0 !important;
  padding: 0.75rem !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius) !important;
  background: var(--surface) !important;
  transition: var(--transition) !important;
}

.checkbox-label:hover {
  background: var(--surface-hover) !important;
  border-color: var(--border-dark) !important;
}

.checkbox-label input[type="checkbox"] {
  appearance: none !important;
  width: 1.25rem !important;
  height: 1.25rem !important;
  border: 2px solid var(--border) !important;
  border-radius: 0.25rem !important;
  background: var(--surface) !important;
  cursor: pointer !important;
  position: relative !important;
  transition: var(--transition) !important;
  margin: 0 !important;
}

.checkbox-label input[type="checkbox"]:checked {
  background: var(--primary) !important;
  border-color: var(--primary) !important;
}

.checkbox-label input[type="checkbox"]:checked::after {
  content: '✓' !important;
  position: absolute !important;
  top: 50% !important;
  left: 50% !important;
  transform: translate(-50%, -50%) !important;
  color: white !important;
  font-size: 0.875rem !important;
  font-weight: bold !important;
}

.checkbox-label .checkmark {
  display: none !important;
}

/* Input field styles */
.input-label {
  display: block !important;
  font-weight: 600 !important;
  color: var(--text) !important;
  margin-bottom: 0.5rem !important;
  font-size: 0.875rem !important;
}

.bindset-delete-step .form-control {
  width: 100% !important;
  padding: 0.75rem !important;
  border: 2px solid var(--border) !important;
  border-radius: var(--radius) !important;
  background: var(--surface) !important;
  color: var(--text) !important;
  font-size: 1rem !important;
  transition: var(--transition) !important;
  font-family: monospace !important;
  text-transform: uppercase !important;
}

.bindset-delete-step .form-control:focus {
  outline: none !important;
  border-color: var(--border-focus) !important;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1) !important;
}

.bindset-delete-step .form-control:disabled {
  background: var(--surface-darker) !important;
  color: var(--text-muted) !important;
  cursor: not-allowed !important;
  border-color: var(--border-dark) !important;
}

/* Button styles */
.bindset-delete-confirm-btn:disabled {
  opacity: 0.5 !important;
  cursor: not-allowed !important;
  transform: none !important;
}

.bindset-delete-confirm-btn:disabled:hover {
  background: var(--danger) !important;
  transform: none !important;
}

/* Modal header icon styling */
.bindset-delete-confirm-modal .modal-header h3 i {
  color: var(--danger);
  margin-right: 0.5rem;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .bindset-delete-confirm-modal .modal-content {
    width: 95vw;
    margin: 1rem;
  }

  .bindset-delete-steps {
    gap: 1rem;
  }

  .bindset-delete-step {
    gap: 0.75rem;
  }
}
