/* ==================== */
/* Fira Code Font       */
/* ==================== */
@font-face {
  font-family: 'Fira Code';
  src: url('vendor/firacode/woff2/FiraCode-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Fira Code';
  src: url('vendor/firacode/woff2/FiraCode-Bold.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* ==================== */
/* CSS Variables        */
/* ==================== */

/* Default Theme: Eye Three (i3-gaps inspired) */
:root,
:root[data-theme="eye-three"] {
  /* Theme Variables - Override these for custom themes */
  --theme-bg-primary: #0d0d0d;
  --theme-bg-secondary: #161616;
  --theme-bg-tertiary: #1f1f1f;
  --theme-text-primary: #c5c8c6;
  --theme-text-secondary: #707880;
  --theme-border-color: #2a2a2a;
  --theme-accent: #81a1c1;
  --theme-accent-dim: #5e81ac;
  --theme-gap: 8px;
  --theme-transition: 0.15s cubic-bezier(0.4, 0, 0.2, 1);

  /* Semantic Tool Colors */
  --theme-color-red: #ec644e;
  --theme-color-orange: #ff6b35;
  --theme-color-yellow: #f9bc60;
  --theme-color-green: #4caf50;
  --theme-color-cyan: #81a1c1;
  --theme-color-blue: #64b5f6;
  --theme-color-purple: #7c3aed;
  --theme-color-pink: #ec4899;

  /* Legacy variables for backward compatibility */
  --bg-primary: var(--theme-bg-primary);
  --bg-secondary: var(--theme-bg-secondary);
  --bg-tertiary: var(--theme-bg-tertiary);
  --text-primary: var(--theme-text-primary);
  --text-secondary: var(--theme-text-secondary);
  --border-color: var(--theme-border-color);
  --accent: var(--theme-accent);
  --accent-dim: var(--theme-accent-dim);
  --gap: var(--theme-gap);
  --transition: var(--theme-transition);
}

/* Nord Theme */
:root[data-theme="nord"] {
  --theme-bg-primary: #2e3440;
  --theme-bg-secondary: #3b4252;
  --theme-bg-tertiary: #434c5e;
  --theme-text-primary: #eceff4;
  --theme-text-secondary: #d8dee9;
  --theme-border-color: #4c566a;
  --theme-accent: #88c0d0;
  --theme-accent-dim: #5e81ac;
  --theme-gap: 8px;
  --theme-transition: 0.15s cubic-bezier(0.4, 0, 0.2, 1);

  /* Semantic Tool Colors - Nord Palette */
  --theme-color-red: #bf616a;
  --theme-color-orange: #d08770;
  --theme-color-yellow: #ebcb8b;
  --theme-color-green: #a3be8c;
  --theme-color-cyan: #88c0d0;
  --theme-color-blue: #81a1c1;
  --theme-color-purple: #b48ead;
  --theme-color-pink: #b48ead;

  /* Legacy variables for backward compatibility */
  --bg-primary: var(--theme-bg-primary);
  --bg-secondary: var(--theme-bg-secondary);
  --bg-tertiary: var(--theme-bg-tertiary);
  --text-primary: var(--theme-text-primary);
  --text-secondary: var(--theme-text-secondary);
  --border-color: var(--theme-border-color);
  --accent: var(--theme-accent);
  --accent-dim: var(--theme-accent-dim);
  --gap: var(--theme-gap);
  --transition: var(--theme-transition);
}

/* Pastel Light Theme */
:root[data-theme="pastel"] {
  --theme-bg-primary: #faf9f6;
  --theme-bg-secondary: #f0ede6;
  --theme-bg-tertiary: #e8e3d8;
  --theme-text-primary: #2d2d2d;
  --theme-text-secondary: #6b6b6b;
  --theme-border-color: #d4cfc4;
  --theme-accent: #7b9ea8;
  --theme-accent-dim: #9fb8c0;
  --theme-gap: 8px;
  --theme-transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);

  /* Semantic Tool Colors - Soft Pastels */
  --theme-color-red: #e8a5a5;
  --theme-color-orange: #f5c090;
  --theme-color-yellow: #f5e6a8;
  --theme-color-green: #b8d4a8;
  --theme-color-cyan: #a8d5e2;
  --theme-color-blue: #a8c5e8;
  --theme-color-purple: #c5a8e8;
  --theme-color-pink: #e8a8c5;

  /* Legacy variables for backward compatibility */
  --bg-primary: var(--theme-bg-primary);
  --bg-secondary: var(--theme-bg-secondary);
  --bg-tertiary: var(--theme-bg-tertiary);
  --text-primary: var(--theme-text-primary);
  --text-secondary: var(--theme-text-secondary);
  --border-color: var(--theme-border-color);
  --accent: var(--theme-accent);
  --accent-dim: var(--theme-accent-dim);
  --gap: var(--theme-gap);
  --transition: var(--theme-transition);
}

/* Catppuccin Mocha Theme */
:root[data-theme="catppuccin-mocha"] {
  --theme-bg-primary: #1e1e2e;
  --theme-bg-secondary: #181825;
  --theme-bg-tertiary: #11111b;
  --theme-text-primary: #cdd6f4;
  --theme-text-secondary: #a6adc8;
  --theme-border-color: #6c7086;
  --theme-accent: #89b4fa;
  --theme-accent-dim: #74c7ec;
  --theme-gap: 8px;
  --theme-transition: 0.15s cubic-bezier(0.4, 0, 0.2, 1);

  /* Semantic Tool Colors - Catppuccin Mocha Accents */
  --theme-color-red: #f38ba8;
  --theme-color-orange: #fab387;
  --theme-color-yellow: #f9e2af;
  --theme-color-green: #a6e3a1;
  --theme-color-cyan: #89dceb;
  --theme-color-blue: #89b4fa;
  --theme-color-purple: #cba6f7;
  --theme-color-pink: #f5c2e7;

  /* Legacy variables for backward compatibility */
  --bg-primary: var(--theme-bg-primary);
  --bg-secondary: var(--theme-bg-secondary);
  --bg-tertiary: var(--theme-bg-tertiary);
  --text-primary: var(--theme-text-primary);
  --text-secondary: var(--theme-text-secondary);
  --border-color: var(--theme-border-color);
  --accent: var(--theme-accent);
  --accent-dim: var(--theme-accent-dim);
  --gap: var(--theme-gap);
  --transition: var(--theme-transition);
}

/* Solarized Dark Theme */
:root[data-theme="solarized-dark"] {
  --theme-bg-primary: #002b36;
  --theme-bg-secondary: #073642;
  --theme-bg-tertiary: #073642;
  --theme-text-primary: #839496;
  --theme-text-secondary: #586e75;
  --theme-border-color: #586e75;
  --theme-accent: #268bd2;
  --theme-accent-dim: #2aa198;
  --theme-gap: 8px;
  --theme-transition: 0.15s cubic-bezier(0.4, 0, 0.2, 1);

  /* Semantic Tool Colors - Solarized Accents */
  --theme-color-red: #dc322f;
  --theme-color-orange: #cb4b16;
  --theme-color-yellow: #b58900;
  --theme-color-green: #859900;
  --theme-color-cyan: #2aa198;
  --theme-color-blue: #268bd2;
  --theme-color-purple: #6c71c4;
  --theme-color-pink: #d33682;

  /* Legacy variables for backward compatibility */
  --bg-primary: var(--theme-bg-primary);
  --bg-secondary: var(--theme-bg-secondary);
  --bg-tertiary: var(--theme-bg-tertiary);
  --text-primary: var(--theme-text-primary);
  --text-secondary: var(--theme-text-secondary);
  --border-color: var(--theme-border-color);
  --accent: var(--theme-accent);
  --accent-dim: var(--theme-accent-dim);
  --gap: var(--theme-gap);
  --transition: var(--theme-transition);
}

/* Sage Theme - Earthy green tones */
:root[data-theme="sage"] {
  --theme-bg-primary: #0f120e;
  --theme-bg-secondary: #1a1f18;
  --theme-bg-tertiary: #252d22;
  --theme-text-primary: #d4d9d0;
  --theme-text-secondary: #8a9482;
  --theme-border-color: #3d4839;
  --theme-accent: #88a878;
  --theme-accent-dim: #6d8c5d;
  --theme-gap: 8px;
  --theme-transition: 0.15s cubic-bezier(0.4, 0, 0.2, 1);

  /* Semantic Tool Colors - Earthy palette */
  --theme-color-red: #c77d6d;
  --theme-color-orange: #d4a574;
  --theme-color-yellow: #d9c589;
  --theme-color-green: #88a878;
  --theme-color-cyan: #7da396;
  --theme-color-blue: #7d9fb5;
  --theme-color-purple: #9d8ba8;
  --theme-color-pink: #b88d9d;

  /* Legacy variables for backward compatibility */
  --bg-primary: var(--theme-bg-primary);
  --bg-secondary: var(--theme-bg-secondary);
  --bg-tertiary: var(--theme-bg-tertiary);
  --text-primary: var(--theme-text-primary);
  --text-secondary: var(--theme-text-secondary);
  --border-color: var(--theme-border-color);
  --accent: var(--theme-accent);
  --accent-dim: var(--theme-accent-dim);
  --gap: var(--theme-gap);
  --transition: var(--theme-transition);
}

/* Pastel Theme Overrides - Softer Aesthetic */
[data-theme="pastel"] {
  letter-spacing: 0.005em;
}

[data-theme="pastel"] body {
  background:
    radial-gradient(ellipse at 20% 30%, rgba(197, 168, 232, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 70%, rgba(168, 213, 226, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 90%, rgba(232, 165, 165, 0.06) 0%, transparent 40%),
    linear-gradient(135deg, #faf9f6 0%, #f5f2ed 100%);
  background-attachment: fixed;
}

[data-theme="pastel"] .tool-card {
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

[data-theme="pastel"] .card-header {
  border-radius: 0;
  background: linear-gradient(135deg, var(--header-color, var(--accent)) 0%, color-mix(in srgb, var(--header-color, var(--accent)) 80%, white) 100%) !important;
}

[data-theme="pastel"] .tool-name {
  font-weight: 600;
  letter-spacing: 0.02em;
}

[data-theme="pastel"] button {
  border-radius: 8px;
  font-weight: 500;
}

[data-theme="pastel"] .btn-fullscreen,
[data-theme="pastel"] .btn-close {
  border-radius: 6px;
}

[data-theme="pastel"] .dashboard-controls button {
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

[data-theme="pastel"] .dashboard-controls button:hover {
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
  transform: translateY(-1px);
}

[data-theme="pastel"] .modal-content {
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
}

[data-theme="pastel"] .theme-option {
  border-radius: 12px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

[data-theme="pastel"] .theme-option:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}

[data-theme="pastel"] .theme-color-swatch {
  border-radius: 4px;
}

[data-theme="pastel"] .tool-item {
  border-radius: 10px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
}

[data-theme="pastel"] .tool-item:hover {
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
  transform: translateY(-1px);
}

[data-theme="pastel"] .tool-add-btn {
  border-radius: 8px;
}

[data-theme="pastel"] h1,
[data-theme="pastel"] h2,
[data-theme="pastel"] h3 {
  font-weight: 600;
  letter-spacing: 0.01em;
}

/* Catppuccin Mocha Theme uses default i3-gaps styling (no overrides needed) */

/* ==================== */
/* Reset & Base         */
/* ==================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Fira Code', 'JetBrains Mono', 'SF Mono', 'Cascadia Code',
               'Consolas', monospace;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  overflow-x: hidden;
  min-height: 100vh;
  font-size: 13px;
  line-height: 1.5;
  letter-spacing: -0.01em;
}

/* ==================== */
/* Dashboard Header     */
/* ==================== */
.dashboard-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  padding: var(--gap) calc(var(--gap) * 2);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.dashboard-header h1 {
  font-size: 13px;
  font-weight: 400;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.dashboard-controls {
  display: flex;
  gap: var(--gap);
  align-items: center;
}

.dashboard-controls button {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  border-radius: 0;
  padding: 6px 12px;
  font-size: 12px;
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
  font-weight: 400;
}

.dashboard-controls button:hover {
  background: var(--bg-tertiary);
  color: var(--accent);
  border-color: var(--accent-dim);
}

.dashboard-controls button:active {
  background: var(--bg-primary);
}

#btn-compact-toggle {
  display: inline;
  align-items: center;
  justify-content: center;
}

/* ==================== */
/* Dashboard Container  */
/* ==================== */
.dashboard-container {
  padding: var(--gap);
  height: calc(100vh - 33px - calc(var(--gap) * 2));
  position: relative;
  overflow: auto;
  background-color: var(--bg-primary);
  background-image: radial-gradient(circle, rgba(255, 255, 255, 0.1) 1.5px, transparent 1.5px);
  background-size: 20px 20px;
}

.dashboard-grid {
  position: relative;
  width: 100%;
  height: 100%;
  background-color: var(--bg-primary);
  background-image: radial-gradient(circle, rgba(255, 255, 255, 0.1) 1.5px, transparent 1.5px);
  background-size: 20px 20px;
}

/* ==================== */
/* GridStack Overrides  */
/* ==================== */
.grid-stack {
  background: transparent;
}

.grid-stack-item {
  background: transparent;
}

/* Smooth animations for displaced grid items when others move */
.grid-stack-animate .grid-stack-item:not(.ui-draggable-dragging):not(.ui-resizable-resizing) {
  transition: left 0.2s cubic-bezier(0.25, 0.1, 0.25, 1),
              top 0.2s cubic-bezier(0.25, 0.1, 0.25, 1),
              height 0.2s cubic-bezier(0.25, 0.1, 0.25, 1),
              width 0.2s cubic-bezier(0.25, 0.1, 0.25, 1) !important;
}

.grid-stack-item-content {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color var(--transition);
  inset: 0 !important;
}

.grid-stack-item:hover .grid-stack-item-content {
  border-color: var(--tool-header-color, var(--accent-dim));
}

.grid-stack-item.ui-draggable-dragging .grid-stack-item-content {
  opacity: 0.8;
  border-color: var(--accent);
}

.grid-stack-item.ui-resizable-resizing .grid-stack-item-content {
  opacity: 0.9;
  border-color: var(--accent);
}

/* GridStack placeholder */
.grid-stack-placeholder > .placeholder-content {
  background: transparent;
  border: 1px dashed var(--accent);
  border-radius: 0;
}

/* ==================== */
/* Tool Cards           */
/* ==================== */
.tool-card {
  height: 100%;
  display: flex;
  flex-direction: column;
}

.card-header {
  padding: 4px calc(var(--gap) * 1.5);
  display: flex;
  align-items: center;
  gap: var(--gap);
  cursor: move;
  user-select: none;
  border-bottom: 1px solid var(--border-color);
  min-height: 22px;
  flex-shrink: 0;
  background: var(--bg-secondary);
}

.card-header:active {
  cursor: grabbing;
}

.tool-icon {
  font-size: 11px;
  line-height: 1;
  flex-shrink: 0;
  opacity: 1;
  font-style: normal;
  color: #ffffff;
}

.tool-icon-img {
  width: 12px;
  height: 12px;
  object-fit: contain;
  flex-shrink: 0;
  opacity: 0.9;
}

.fullscreen-icon {
  font-size: 14px;
  line-height: 1;
  opacity: 1;
  font-style: normal;
  color: #ffffff;
}

.tool-name {
  font-family: 'Fira Code', monospace;
  font-weight: 700;
  font-size: 11px;
  color: #ffffff;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.card-actions button {
  background: transparent;
  border: none;
  color: #ffffff;
  font-size: 12px;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 0;
  transition: color var(--transition);
  line-height: 1;
  opacity: 0.7;
}

.card-actions button:hover {
  color: var(--accent);
  opacity: 1;
}

.btn-fullscreen {
  font-size: 11px !important;
}

.btn-close {
  font-size: 14px !important;
}

.card-body {
  flex: 1;
  position: relative;
  overflow: hidden;
  background: var(--bg-secondary);
}

.card-body iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
  background: var(--bg-secondary);
}

/* Prevent iframes from interfering with resize operations */
.grid-stack-item.ui-resizable-resizing iframe {
  pointer-events: none;
}

.grid-stack-item.ui-draggable-dragging iframe {
  pointer-events: none;
}

/* ==================== */
/* GridStack Resize Handles */
/* ==================== */
.ui-resizable-handle {
  z-index: 10;
}

/* Hide edge handles */
.ui-resizable-n,
.ui-resizable-s,
.ui-resizable-e,
.ui-resizable-w {
  display: none;
}

/* Hide top corners */
.ui-resizable-ne,
.ui-resizable-nw {
  visibility: hidden;
}

/* Only show bottom corners */
.ui-resizable-se,
.ui-resizable-sw {
  width: 10px;
  height: 10px;
}

/* Bottom-right corner */
.ui-resizable-se::after {
  content: '';
  position: absolute;
  bottom: 0;
  right: 0;
  width: 5px;
  height: 5px;
  border-right: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
  opacity: 0;
  transition: opacity var(--transition);
}

/* Bottom-left corner */
.ui-resizable-sw::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 5px;
  height: 5px;
  border-left: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
  opacity: 0;
  transition: opacity var(--transition);
}

.grid-stack-item:hover .ui-resizable-se::after,
.grid-stack-item:hover .ui-resizable-sw::after {
  opacity: 0.4;
}

.grid-stack-item.ui-resizable-resizing .ui-resizable-se::after,
.grid-stack-item.ui-resizable-resizing .ui-resizable-sw::after {
  border-color: var(--accent);
  opacity: 0.7;
}

/* ==================== */
/* Fullscreen Mode      */
/* ==================== */
.fullscreen-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg-primary);
  z-index: 9999;
  display: none;
  flex-direction: column;
}

.fullscreen-overlay.active {
  display: flex;
}

.fullscreen-header {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  padding: var(--gap) calc(var(--gap) * 2);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.fullscreen-tool-title {
  font-size: 12px;
  font-weight: 400;
  display: flex;
  align-items: center;
  gap: var(--gap);
  color: var(--text-secondary);
}

.fullscreen-icon-img {
  width: 14px;
  height: 14px;
  object-fit: contain;
  opacity: 0.7;
}

.btn-exit-fullscreen {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  border-radius: 0;
  padding: 6px 12px;
  font-size: 12px;
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
}

.btn-exit-fullscreen:hover {
  background: var(--bg-tertiary);
  color: var(--accent);
  border-color: var(--accent-dim);
}

.fullscreen-body {
  flex: 1;
  position: relative;
  overflow: hidden;
}

.fullscreen-body iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

/* ==================== */
/* Tool Selector Modal  */
/* ==================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  z-index: 8888;
  display: none;
  align-items: center;
  justify-content: center;
  padding: calc(var(--gap) * 2);
  backdrop-filter: blur(2px);
}

.modal-overlay.active {
  display: flex;
}

.modal-content {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 0;
  max-width: 500px;
  width: 100%;
  max-height: 80vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.modal-header {
  padding: var(--gap) calc(var(--gap) * 2);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h2 {
  font-size: 12px;
  font-weight: 400;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 14px;
  cursor: pointer;
  padding: 2px 4px;
  line-height: 1;
  border-radius: 0;
  transition: color var(--transition);
}

.modal-close:hover {
  color: var(--accent);
}

.modal-body {
  padding: var(--gap);
  overflow-y: auto;
  flex: 1;
}

.tool-list {
  display: flex;
  flex-direction: column;
  gap: var(--gap);
}

.tool-item {
  display: flex;
  align-items: center;
  gap: calc(var(--gap) * 1.5);
  padding: var(--gap) calc(var(--gap) * 1.5);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 0;
  cursor: pointer;
  transition: all var(--transition);
}

.tool-item:hover {
  background: var(--bg-primary);
  border-color: var(--accent-dim);
}

.tool-item.active {
  border-color: var(--accent);
  background: var(--bg-primary);
}

.tool-item-icon {
  font-size: 12px;
  line-height: 1;
  flex-shrink: 0;
  opacity: 1;
  font-style: normal;
  color: var(--text-primary);
}

.tool-item-icon-img {
  width: 16px;
  height: 16px;
  object-fit: contain;
  flex-shrink: 0;
  opacity: 0.7;
}

.tool-item-info {
  flex: 1;
}

.tool-item-name {
  font-weight: 400;
  font-size: 12px;
  margin-bottom: 2px;
  color: var(--text-primary);
}

.tool-item-description {
  font-size: 11px;
  color: var(--text-secondary);
  opacity: 0.8;
}

.tool-item-checkbox {
  width: 14px;
  height: 14px;
  cursor: pointer;
  accent-color: var(--accent);
}

.tool-count-badge {
  display: inline-block;
  background: var(--accent-dim);
  color: var(--bg-primary);
  font-size: 9px;
  font-weight: 700;
  padding: 2px 5px;
  border-radius: 2px;
  margin-left: 6px;
  vertical-align: middle;
}

.tool-add-btn {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent-dim);
  border-radius: 0;
  padding: 4px 10px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
  flex-shrink: 0;
  line-height: 1;
}

.tool-add-btn:hover {
  background: var(--accent);
  color: var(--bg-primary);
  border-color: var(--accent);
}

/* ==================== */
/* Settings Modal       */
/* ==================== */
.settings-section {
  margin-bottom: calc(var(--gap) * 3);
}

.settings-section:last-child {
  margin-bottom: 0;
}

.settings-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-secondary);
  margin-bottom: calc(var(--gap) * 2);
}

.theme-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: calc(var(--gap) * 2);
}

.theme-option {
  background: var(--bg-tertiary);
  border: 2px solid var(--border-color);
  padding: calc(var(--gap) * 2);
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  flex-direction: column;
  gap: calc(var(--gap) * 2);
}

.theme-option:hover {
  border-color: var(--accent-dim);
  background: var(--bg-secondary);
}

.theme-option.active {
  border-color: var(--accent);
  background: var(--bg-secondary);
}

.theme-option-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.theme-option-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
}

.theme-option-checkmark {
  color: var(--accent);
  font-size: 14px;
  opacity: 0;
  transition: opacity var(--transition);
}

.theme-option.active .theme-option-checkmark {
  opacity: 1;
}

.theme-option-preview {
  display: flex;
  gap: calc(var(--gap) / 2);
  height: 24px;
}

.theme-color-swatch {
  flex: 1;
  border: 1px solid rgba(0, 0, 0, 0.2);
}

/* ==================== */
/* Settings Toggles     */
/* ==================== */
.settings-toggles {
  display: flex;
  flex-direction: column;
  gap: calc(var(--gap) * 2);
}

.settings-toggle {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  gap: 2px calc(var(--gap) * 2);
  align-items: center;
  padding: calc(var(--gap) * 1.5);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  cursor: pointer;
  transition: all var(--transition);
}

.settings-toggle:hover {
  border-color: var(--accent-dim);
}

.settings-toggle input[type="checkbox"] {
  display: none;
}

.toggle-label {
  font-size: 13px;
  font-weight: 400;
  color: var(--text-primary);
  grid-column: 1;
  grid-row: 1;
}

.toggle-description {
  font-size: 11px;
  color: var(--text-secondary);
  grid-column: 1;
  grid-row: 2;
}

.toggle-switch {
  width: 36px;
  height: 20px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  position: relative;
  transition: all var(--transition);
  grid-column: 2;
  grid-row: 1 / 3;
  align-self: center;
}

.toggle-switch::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  background: var(--text-secondary);
  transition: all var(--transition);
}

.settings-toggle input[type="checkbox"]:checked + .toggle-switch {
  background: var(--accent-dim);
  border-color: var(--accent);
}

.settings-toggle input[type="checkbox"]:checked + .toggle-switch::after {
  left: 18px;
  background: var(--accent);
}

.settings-danger-btn {
  width: 100%;
  background: transparent;
  color: var(--theme-color-red, #ec644e);
  border: 1px solid var(--theme-color-red, #ec644e);
  padding: calc(var(--gap) * 1.5);
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--gap);
}

.settings-danger-btn:hover {
  background: var(--theme-color-red, #ec644e);
  color: var(--bg-primary);
}

.settings-hint {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: var(--gap);
  opacity: 0.8;
}

/* ==================== */
/* Rounded Corners Mode */
/* ==================== */
[data-rounded="true"] .grid-stack-item-content {
  border-radius: 8px;
}

[data-rounded="true"] .tool-card {
  border-radius: 8px;
  overflow: hidden;
}

[data-rounded="true"] .card-header {
  border-radius: 0;
}

[data-rounded="true"] .dashboard-controls button {
  border-radius: 6px;
}

[data-rounded="true"] .modal-content {
  border-radius: 12px;
}

[data-rounded="true"] .theme-option {
  border-radius: 8px;
}

[data-rounded="true"] .theme-color-swatch {
  border-radius: 3px;
}

[data-rounded="true"] .tool-item {
  border-radius: 8px;
}

[data-rounded="true"] .tool-add-btn {
  border-radius: 6px;
}

[data-rounded="true"] .settings-toggle {
  border-radius: 8px;
}

[data-rounded="true"] .toggle-switch {
  border-radius: 10px;
}

[data-rounded="true"] .toggle-switch::after {
  border-radius: 50%;
}

[data-rounded="true"] .btn-fullscreen,
[data-rounded="true"] .btn-close {
  border-radius: 4px;
}

[data-rounded="true"] .fullscreen-overlay .btn-exit-fullscreen {
  border-radius: 6px;
}

[data-rounded="true"] .grid-stack-placeholder > .placeholder-content {
  border-radius: 8px;
}

[data-rounded="true"] .tool-count-badge {
  border-radius: 8px;
}

[data-rounded="true"] .settings-danger-btn {
  border-radius: 8px;
}

/* ==================== */
/* Shadow Mode          */
/* ==================== */
[data-shadow="true"] .grid-stack-item-content {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4), 0 2px 4px rgba(0, 0, 0, 0.2);
}

[data-shadow="true"] .grid-stack-item:hover .grid-stack-item-content {
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.5), 0 3px 6px rgba(0, 0, 0, 0.25);
}

[data-shadow="true"][data-theme="pastel"] .grid-stack-item-content {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1), 0 2px 4px rgba(0, 0, 0, 0.05);
}

[data-shadow="true"][data-theme="pastel"] .grid-stack-item:hover .grid-stack-item-content {
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15), 0 3px 6px rgba(0, 0, 0, 0.08);
}

/* ==================== */
/* Responsive Design    */
/* ==================== */
@media (max-width: 768px) {
  .dashboard-header {
    padding: var(--gap);
    flex-direction: column;
    gap: var(--gap);
    align-items: flex-start;
  }

  .dashboard-header h1 {
    font-size: 11px;
  }

  .dashboard-controls {
    width: 100%;
    justify-content: space-between;
  }

  .dashboard-controls button {
    flex: 1;
    font-size: 11px;
    padding: 6px 10px;
  }

  .dashboard-container {
    padding: var(--gap);
  }

  .modal-content {
    max-width: 100%;
    max-height: 90vh;
  }
}

/* ==================== */
/* Scrollbar Styling    */
/* ==================== */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 0;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--accent-dim);
}

* {
  scrollbar-width: thin;
  scrollbar-color: var(--border-color) transparent;
}

/* ==================== */
/* Loading State        */
/* ==================== */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  color: var(--text-secondary);
  font-size: 11px;
  letter-spacing: 0.05em;
}

.loading::after {
  content: "...";
  animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
  0%, 20% { content: "."; }
  40% { content: ".."; }
  60%, 100% { content: "..."; }
}

/* ==================== */
/* Additional i3-gaps polish */
/* ==================== */
::selection {
  background: var(--accent-dim);
  color: var(--bg-primary);
}

button {
  text-transform: lowercase;
}

button:focus,
input:focus {
  outline: none;
}
