/* Widget Store page — loaded only on /widgets */

.no-widgets-message {
  padding: 2rem 1rem;
  text-align: center;
  border-radius: 8px;
  background-color: rgba(255, 255, 255, 0.06);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2);
}

.no-widgets-content i {
  font-size: 3rem;
  opacity: 0.5;
  margin-bottom: 0.5rem;
}

.no-widgets-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  margin-top: 1rem;
  flex-wrap: wrap;
}

.widget-store-page .content {
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
}

.widget-store-intro {
  margin-bottom: 0.5rem;
}

.widget-store-intro .widget-store-lead {
  margin-top: 0.5rem;
}

.widget-store-connection {
  margin: 1.25rem 0 1rem;
}

.widget-store-connection .global-config {
  margin: 0;
}

.widget-store-advanced {
  margin: 0.5rem 0 0;
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.75);
}

.widget-store-advanced summary {
  cursor: pointer;
  user-select: none;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.55);
}

body.dark .widget-store-advanced summary {
  color: rgba(224, 224, 224, 0.55);
}

.widget-store-advanced-body {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.75rem;
  padding: 0.75rem 0 0;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

body.dark .widget-store-advanced-body {
  border-top-color: rgba(255, 255, 255, 0.08);
}

/* Master–detail layout */
.widget-layout {
  display: grid;
  grid-template-columns: minmax(220px, 300px) minmax(0, 1fr);
  gap: 1.5rem;
  margin-top: 1.75rem;
  align-items: stretch;
}

@media (max-width: 900px) {
  .widget-layout {
    grid-template-columns: 1fr;
  }

  .widget-list-panel {
    max-height: 40vh;
  }
}

.widget-list-panel {
  min-height: 0;
}

.widget-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  max-height: min(70vh, 640px);
  overflow-y: auto;
  padding: 0.25rem;
  margin: 0;
  border-radius: 8px;
  background-color: rgba(255, 255, 255, 0.06);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2);
}

body.dark .widget-list {
  background-color: rgba(0, 0, 0, 0.2);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.widget-list-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  text-align: left;
  padding: 0.65rem 0.75rem;
  margin: 0;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font: inherit;
  color: rgba(255, 255, 255, 0.9);
  background: transparent;
  transition: background 0.15s ease, box-shadow 0.15s ease;
}

body.dark .widget-list-item {
  color: rgba(224, 224, 224, 0.95);
}

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

.widget-list-item.is-selected {
  background-color: rgba(255, 255, 255, 0.14);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
}

body.dark .widget-list-item.is-selected {
  background-color: rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.22);
}

/*
 * main.css styles every `button` (and #main button) like a form control.
 * List rows must reset those rules so only .is-selected reads as “active”.
 */
#main .widget-store-page .widget-list button.widget-list-item {
  appearance: none;
  -webkit-appearance: none;
  display: flex;
  align-items: center;
  width: 100%;
  height: auto !important;
  min-height: 0;
  line-height: inherit;
  padding: 0.65rem 0.75rem;
  margin: 0;
  text-align: left;
  white-space: normal;
  font: inherit;
  font-weight: 500;
  border: none !important;
  border-radius: 6px;
  cursor: pointer;
  box-shadow: none !important;
  background: transparent !important;
  color: #636363;
  transition: background 0.15s ease, box-shadow 0.15s ease;
}

#main .widget-store-page .widget-list button.widget-list-item:hover {
  background-color: rgba(0, 0, 0, 0.05) !important;
  box-shadow: none !important;
}

#main .widget-store-page .widget-list button.widget-list-item:active {
  background-color: rgba(0, 0, 0, 0.08) !important;
}

#main .widget-store-page .widget-list button.widget-list-item.is-selected {
  background-color: rgba(0, 0, 0, 0.07) !important;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.2) !important;
}

body.dark #wrapper #main .widget-store-page .widget-list button.widget-list-item {
  color: rgba(224, 224, 224, 0.95);
  background: transparent !important;
  box-shadow: none !important;
}

body.dark #wrapper #main .widget-store-page .widget-list button.widget-list-item:hover {
  background-color: rgba(255, 255, 255, 0.08) !important;
}

body.dark #wrapper #main .widget-store-page .widget-list button.widget-list-item:active {
  background-color: rgba(255, 255, 255, 0.1) !important;
}

body.dark #wrapper #main .widget-store-page .widget-list button.widget-list-item.is-selected {
  background-color: rgba(255, 255, 255, 0.1) !important;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.28) !important;
}

.widget-list-icon {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  color: rgba(255, 255, 255, 0.55);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.28);
}

body.dark .widget-list-icon {
  color: rgba(224, 224, 224, 0.5);
}

.widget-list-text {
  flex: 1;
  min-width: 0;
}

.widget-list-name {
  display: block;
  font-size: 0.95rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.widget-list-badges {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}

.widget-list-badges .widget-new-badge {
  margin-left: 0;
  font-size: 0.6rem;
  padding: 0.12rem 0.4rem;
}

.widget-list-badges .premium-badge {
  margin-left: 0;
  font-size: 0.65rem;
  padding: 0.15rem 0.45rem;
}

.widget-list-badges .premium-badge span {
  display: none;
}

.widget-preview-panel {
  display: flex;
  flex-direction: column;
  min-height: 320px;
  border-radius: 8px;
  padding: 1rem;
  background-color: rgba(255, 255, 255, 0.06);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2);
}

body.dark .widget-preview-panel {
  background-color: rgba(0, 0, 0, 0.2);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.widget-preview-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 280px;
  color: rgba(255, 255, 255, 0.5);
  font-size: 1rem;
  border: 2px dashed rgba(255, 255, 255, 0.25);
  border-radius: 8px;
}

body.dark .widget-preview-empty {
  color: rgba(224, 224, 224, 0.5);
  border-color: rgba(255, 255, 255, 0.15);
}

.widget-preview-empty[hidden] {
  display: none !important;
}

.widget-preview-detail {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  flex: 1;
  min-height: 0;
}

.widget-preview-detail[hidden] {
  display: none !important;
}

.widget-preview-detail-header .widget-header {
  align-items: flex-start;
}

.widget-preview-detail-header .widget-title {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.widget-detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.widget-detail-config {
  background-color: rgba(255, 255, 255, 0.075);
  border-radius: 8px;
  padding: 0.75rem 0.85rem;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2);
}

body.dark .widget-detail-config {
  background-color: rgba(255, 255, 255, 0.05);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.widget-detail-config[hidden] {
  display: none !important;
}

.widget-detail-config .config-row {
  display: grid;
  grid-template-columns: minmax(100px, 140px) minmax(10rem, 1fr);
  gap: 0.55rem 0.65rem;
  align-items: center;
  margin-bottom: 0.55rem;
}

.widget-detail-config .config-label-inline {
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.75);
}

body.dark .widget-detail-config .config-label-inline {
  color: rgba(224, 224, 224, 0.75);
}

.widget-detail-config .config-row:last-child {
  margin-bottom: 0;
}

/* Compact grouped toggles — auto-fit avoids half-empty rows + ultra-narrow cells */
.widget-detail-config .config-toggle-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.45rem 0.55rem;
  margin-bottom: 0.55rem;
  align-items: center;
}

.widget-detail-config .config-toggle-grid:last-child {
  margin-bottom: 0;
}

@media (max-width: 480px) {
  .widget-detail-config .config-toggle-grid {
    grid-template-columns: 1fr;
  }
}

.widget-detail-config .config-toggle-cell {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  min-width: 0;
  min-height: 2.25rem;
  padding: 0.45rem 0.6rem;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
  overflow: hidden;
}

body.dark .widget-detail-config .config-toggle-cell {
  background: rgba(0, 0, 0, 0.15);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.widget-detail-config .config-toggle-cell-label {
  display: flex;
  align-items: center;
  font-size: 0.82rem;
  line-height: 1.25;
  color: rgba(255, 255, 255, 0.78);
  flex: 1 1 auto;
  min-width: 0;
  min-height: 22px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  align-self: center;
}

body.dark .widget-detail-config .config-toggle-cell-label {
  color: rgba(224, 224, 224, 0.82);
}

/* In-page color field (no native color input) */
.widget-detail-config .cfg-color-field {
  position: relative;
  justify-self: stretch;
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

.widget-detail-config .cfg-color-inline {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  width: 100%;
}

.widget-detail-config .cfg-color-trigger {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 8px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.25);
}

body.dark .widget-detail-config .cfg-color-trigger {
  border-color: rgba(255, 255, 255, 0.22);
}

.widget-detail-config .cfg-color-trigger:focus-visible {
  outline: 2px solid rgba(59, 130, 246, 0.95);
  outline-offset: 2px;
}

.widget-detail-config .cfg-color-hex {
  flex: 1;
  min-width: 0;
  max-width: 8rem;
  padding: 0 0.65em;
  font-family: ui-monospace, "Cascadia Code", monospace;
  font-size: 0.85rem;
}

.widget-detail-config .cfg-color-popover {
  position: absolute;
  z-index: 50;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  width: 100%;
  max-width: min(288px, calc(100vw - 2rem));
  box-sizing: border-box;
  padding: 0.65rem 0.65rem 0.55rem;
  border-radius: 10px;
  background: rgba(28, 28, 32, 0.98);
  box-shadow:
    0 12px 40px rgba(0, 0, 0, 0.45),
    inset 0 0 0 1px rgba(255, 255, 255, 0.14);
  overflow: hidden;
  isolation: isolate;
}

.widget-detail-config .cfg-color-popover[hidden] {
  display: none !important;
}

/* Fixed-size tiles: an 8×1fr grid collapses into thin vertical stripes when the panel is narrow */
.widget-detail-config .cfg-color-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 0.55rem;
}

.widget-detail-config .cfg-color-swatch {
  width: 26px;
  height: 26px;
  flex: 0 0 auto;
  padding: 0;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2);
}

.widget-detail-config .cfg-color-swatch:focus-visible {
  outline: 2px solid rgba(59, 130, 246, 0.95);
  outline-offset: 1px;
}

.widget-detail-config .cfg-color-preview-live {
  height: 44px;
  width: 100%;
  border-radius: 8px;
  margin-bottom: 0.55rem;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.2),
    0 2px 8px rgba(0, 0, 0, 0.25);
}

.widget-detail-config .cfg-color-slider-label {
  display: block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.45);
  margin-bottom: 0.2rem;
}

.widget-detail-config .cfg-color-slider-label:not(:first-of-type) {
  margin-top: 0.35rem;
}

.widget-detail-config .cfg-color-hue,
.widget-detail-config .cfg-color-sat {
  width: 100%;
  height: 22px;
  margin: 0 0 0.15rem;
  accent-color: #93c5fd;
  cursor: pointer;
}

.widget-detail-config .cfg-toggle.cfg-toggle--compact {
  flex-shrink: 0;
}

.widget-detail-config .cfg-toggle.cfg-toggle--compact .cfg-toggle-track {
  width: 38px;
  height: 22px;
}

.widget-detail-config .cfg-toggle.cfg-toggle--compact .cfg-toggle-thumb {
  width: 16px;
  height: 16px;
  top: 3px;
  left: 3px;
}

.widget-detail-config .cfg-toggle.cfg-toggle--compact input[type="checkbox"]:checked + .cfg-toggle-track .cfg-toggle-thumb {
  transform: translateX(16px);
}

/* In toggle tiles, do not stretch the switch to 100% width (breaks label vs control balance) */
.widget-detail-config .config-toggle-cell .cfg-toggle {
  display: flex;
  width: auto;
  flex-shrink: 0;
  align-self: center;
  align-items: center;
  justify-content: center;
  line-height: 0;
}

/* Toggle switch (avoid theme checkbox styles in main.css) */
/* main.css `label { display:block; margin:0 0 1em 0 }` applies to this <label> — reset margin or the switch looks top-aligned in the row */
.widget-detail-config .cfg-toggle {
  display: inline-flex;
  justify-content: flex-end;
  align-items: center;
  width: 100%;
  margin: 0;
  cursor: pointer;
  user-select: none;
}

#main .widget-detail-config label.cfg-toggle {
  margin: 0;
}

.widget-detail-config .cfg-toggle input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}

.widget-detail-config .cfg-toggle-track {
  width: 44px;
  height: 26px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.22);
  position: relative;
  transition: background 0.15s ease, box-shadow 0.15s ease;
}

body.dark .widget-detail-config .cfg-toggle-track {
  background: rgba(255, 255, 255, 0.12);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.16);
}

.widget-detail-config .cfg-toggle-thumb {
  width: 20px;
  height: 20px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.95);
  position: absolute;
  top: 3px;
  left: 3px;
  transition: transform 0.15s ease;
}

.widget-detail-config .cfg-toggle input[type="checkbox"]:checked + .cfg-toggle-track {
  background: rgba(59, 130, 246, 0.75);
  box-shadow: inset 0 0 0 1px rgba(59, 130, 246, 0.9);
}

.widget-detail-config .cfg-toggle input[type="checkbox"]:checked + .cfg-toggle-track .cfg-toggle-thumb {
  transform: translateX(18px);
}

.widget-detail-config .cfg-toggle input[type="checkbox"]:focus-visible + .cfg-toggle-track {
  outline: 2px solid rgba(59, 130, 246, 0.9);
  outline-offset: 2px;
}

.widget-preview-frame-wrap {
  flex: 1;
  min-height: 260px;
  display: flex;
  flex-direction: column;
}

.widget-preview-frame-host {
  flex: 1;
  min-height: 260px;
  padding: 0.75rem;
  border-radius: 8px;
  border: 2px dashed rgba(255, 255, 255, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.65);
  background-color: rgba(255, 255, 255, 0.04);
  position: relative;
  overflow: hidden;
}

body.dark .widget-preview-frame-host {
  border-color: rgba(255, 255, 255, 0.18);
  color: rgba(224, 224, 224, 0.65);
}

.widget-preview-frame-host.is-live {
  border-style: solid;
  border-color: rgba(255, 255, 255, 0.45);
}

body.dark .widget-preview-frame-host.is-live {
  border-color: rgba(224, 224, 224, 0.35);
}

.widget-preview-frame-host--tall {
  min-height: 30rem;
}

.widget-preview-frame-host iframe {
  width: 100%;
  height: 100%;
  min-height: 240px;
  border: none;
  border-radius: 8px;
  display: block;
}

.preview-error,
.preview-expired {
  text-align: center;
  padding: 1.5rem;
  max-width: 24rem;
}

.preview-error h3,
.preview-expired h3 {
  margin: 0.5rem 0;
  color: #636363;
}

body.dark .preview-error h3,
body.dark .preview-expired h3 {
  color: #e0e0e0;
}

.widget-header {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  min-width: 0;
}

/* Let the title/description column shrink so the icon keeps a fixed width in flex layout */
.widget-header > div:not(.widget-icon) {
  flex: 1;
  min-width: 0;
}

.widget-icon {
  flex: 0 0 48px;
  width: 48px;
  min-width: 48px;
  max-width: 48px;
  height: 48px;
  box-sizing: border-box;
  background-color: transparent;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 1rem;
  color: rgba(255, 255, 255, 0.5);
  font-size: 1.5rem;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
}

.widget-icon > i {
  line-height: 1;
  flex-shrink: 0;
}

body.dark .widget-icon {
  color: rgba(224, 224, 224, 0.5);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2);
}

.widget-title {
  font-size: 1.25rem;
  font-weight: 300;
  margin: 0;
  color: #636363;
  letter-spacing: -0.025em;
}

body.dark .widget-title {
  color: #e0e0e0;
}

.widget-description {
  color: rgba(255, 255, 255, 0.65);
  line-height: 1.65;
  margin: 0.5rem 0 0;
}

body.dark .widget-description {
  color: rgba(224, 224, 224, 0.65);
}

.widget-config {
  background-color: rgba(255, 255, 255, 0.075);
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1rem;
}

body.dark .widget-config {
  background-color: rgba(255, 255, 255, 0.05);
}

.config-group {
  margin-bottom: 1rem;
}

.config-group:last-child {
  margin-bottom: 0;
}

.config-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 400;
  margin-bottom: 0.5rem;
  color: #636363;
  font-size: 0.9em;
}

body.dark .config-label {
  color: #e0e0e0 !important;
}

.help-icon {
  cursor: pointer;
  color: rgba(255, 255, 255, 0.5);
  font-size: 1rem;
  transition: color 0.2s ease;
}

body.dark .help-icon {
  color: rgba(224, 224, 224, 0.5);
}

.help-icon:hover {
  color: rgba(255, 255, 255, 0.75);
}

body.dark .help-icon:hover {
  color: rgba(224, 224, 224, 0.75);
}

.config-input {
  width: 100%;
  padding: 0 1em;
  border: solid 1px rgba(255, 255, 255, 0.35);
  border-radius: 8px;
  background-color: rgba(255, 255, 255, 0.25);
  color: #fff;
  outline: 0;
  text-decoration: none;
}

body.dark .config-input {
  border: solid 1px rgba(255, 255, 255, 0.2);
  background-color: rgba(255, 255, 255, 0.1);
  color: #e0e0e0 !important;
}

.config-input:focus {
  outline: none;
  background-color: rgba(255, 255, 255, 0.35);
}

body.dark .config-input:focus {
  background-color: rgba(255, 255, 255, 0.15);
}

.config-checkbox {
  margin-right: 0.5rem;
}

.widget-actions {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
  flex-wrap: wrap;
}

.btn {
  padding: 0 1em;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 300;
  transition: all 0.2s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background-color: transparent;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
  color: #ffffff;
  height: 2.75em;
  line-height: 2.75em;
  padding: 0 1.5em;
}

body.dark .btn {
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2);
  color: #e0e0e0;
}

.btn:hover {
  background-color: rgba(255, 255, 255, 0.075);
  transform: none;
  box-shadow: none;
}

body.dark .btn:hover {
  background-color: rgba(255, 255, 255, 0.05);
}

.btn-primary {
  background-color: var(--color-btn-primary);
  color: #ffffff !important;
  box-shadow: none;
}

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

.btn-secondary {
  background-color: transparent;
  color: #ffffff;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
}

body.dark .btn-secondary {
  color: #e0e0e0;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2);
}

.btn-secondary:hover {
  background-color: rgba(255, 255, 255, 0.075);
}

body.dark .btn-secondary:hover {
  background-color: rgba(255, 255, 255, 0.05);
}

.connection-status {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 400;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  transition: all 0.2s ease;
  background-color: rgba(255, 255, 255, 0.075);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
}

body.dark .connection-status {
  background-color: rgba(255, 255, 255, 0.05);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2);
}

.connection-status:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

body.dark .connection-status:hover {
  background-color: rgba(255, 255, 255, 0.08);
}

.connection-status.connected {
  background-color: rgba(16, 185, 129, 0.2);
  color: #10b981;
  box-shadow: inset 0 0 0 1px rgba(16, 185, 129, 0.4);
}

.connection-status.disconnected {
  background-color: rgba(239, 68, 68, 0.2);
  color: #ef4444;
  box-shadow: inset 0 0 0 1px rgba(239, 68, 68, 0.4);
}

.connection-status.connecting {
  background-color: rgba(245, 158, 11, 0.2);
  color: #f59e0b;
  box-shadow: inset 0 0 0 1px rgba(245, 158, 11, 0.4);
}

body.dark .connection-status.connected {
  background-color: rgba(16, 185, 129, 0.15);
  color: #34d399;
  box-shadow: inset 0 0 0 1px rgba(16, 185, 129, 0.3);
}

body.dark .connection-status.disconnected {
  background-color: rgba(239, 68, 68, 0.15);
  color: #f87171;
  box-shadow: inset 0 0 0 1px rgba(239, 68, 68, 0.3);
}

body.dark .connection-status.connecting {
  background-color: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  box-shadow: inset 0 0 0 1px rgba(245, 158, 11, 0.3);
}

.connection-notification {
  display: none;
  margin-top: 0.75rem;
  padding: 1rem;
  border-radius: 6px;
  background-color: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: #92400e;
  font-size: 0.9rem;
  line-height: 1.5;
  gap: 0.75rem;
  align-items: flex-start;
}

.connection-notification.warning {
  background-color: rgba(245, 158, 11, 0.1);
  border-color: rgba(245, 158, 11, 0.3);
  color: #92400e;
}

body.dark .connection-notification {
  background-color: rgba(245, 158, 11, 0.15);
  border-color: rgba(245, 158, 11, 0.4);
  color: #fbbf24;
}

.connection-notification i {
  font-size: 1.25rem;
  flex-shrink: 0;
  margin-top: 0.125rem;
}

.connection-notification strong {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
}

.connection-notification p {
  margin: 0;
  line-height: 1.6;
}

.connection-notification code {
  background-color: rgba(0, 0, 0, 0.1);
  padding: 0.125rem 0.375rem;
  border-radius: 3px;
  font-size: 0.85em;
  font-family: "Courier New", monospace;
}

body.dark .connection-notification code {
  background-color: rgba(255, 255, 255, 0.1);
}

.global-config {
  margin: 2rem 0;
  padding: 1.5rem;
  background-color: rgba(255, 255, 255, 0.075);
  border-radius: 8px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
}

body.dark .global-config {
  background-color: rgba(255, 255, 255, 0.05);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2);
}

.config-help {
  display: block;
  margin-top: 0.5rem;
  color: rgba(255, 255, 255, 0.65);
  font-size: 0.9rem;
}

body.dark .config-help {
  color: rgba(224, 224, 224, 0.65);
}

/* WebSocket help modal */
.modal {
  display: none;
  position: fixed;
  z-index: 10000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
}

.modal-content {
  background-color: rgba(255, 255, 255, 0.95);
  margin: 5% auto;
  padding: 0;
  border-radius: 8px;
  width: 90%;
  max-width: 600px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
  animation: widgets-modal-slide-in 0.3s ease-out;
}

body.dark .modal-content {
  background-color: rgba(26, 26, 26, 0.95);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2);
}

@keyframes widgets-modal-slide-in {
  from {
    opacity: 0;
    transform: translateY(-50px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem 2rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.35);
  background-color: transparent;
  border-radius: 8px 8px 0 0;
}

body.dark .modal-header {
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.modal-header h3 {
  margin: 0;
  color: #636363;
  font-size: 1.25rem;
  font-weight: 300;
  letter-spacing: -0.025em;
}

body.dark .modal-header h3 {
  color: #e0e0e0;
}

.modal-close {
  color: rgba(255, 255, 255, 0.5);
  font-size: 2rem;
  font-weight: bold;
  cursor: pointer;
  transition: color 0.2s ease;
  line-height: 1;
}

body.dark .modal-close {
  color: rgba(224, 224, 224, 0.5);
}

.modal-close:hover {
  color: rgba(255, 255, 255, 0.75);
}

body.dark .modal-close:hover {
  color: rgba(224, 224, 224, 0.75);
}

.modal-body {
  padding: 2rem;
}

.help-content {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.help-step {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

.step-icon {
  width: 40px;
  height: 40px;
  background-color: transparent;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.5);
  font-size: 1.2rem;
  flex-shrink: 0;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
}

body.dark .step-icon {
  color: rgba(224, 224, 224, 0.5);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2);
}

.step-content h4 {
  margin: 0 0 0.5rem 0;
  color: #636363;
  font-size: 1.1rem;
  font-weight: 300;
  letter-spacing: -0.025em;
}

body.dark .step-content h4 {
  color: #e0e0e0;
}

.step-content p {
  margin: 0 0 0.75rem 0;
  color: rgba(255, 255, 255, 0.65);
  line-height: 1.65;
}

body.dark .step-content p {
  color: rgba(224, 224, 224, 0.65);
}

.step-content ol,
.step-content ul {
  margin: 0;
  padding-left: 1.5rem;
  color: rgba(255, 255, 255, 0.65);
}

body.dark .step-content ol,
body.dark .step-content ul {
  color: rgba(224, 224, 224, 0.65);
}

.step-content li {
  margin-bottom: 0.5rem;
  line-height: 1.65;
}

.step-content strong {
  color: #636363;
  font-weight: 400;
}

body.dark .step-content strong {
  color: #e0e0e0;
}

.help-note {
  display: flex;
  gap: 0.75rem;
  padding: 1rem;
  background-color: rgba(255, 255, 255, 0.075);
  border-radius: 8px;
  border-left: 4px solid rgba(255, 255, 255, 0.35);
  margin-top: 0.5rem;
}

body.dark .help-note {
  background-color: rgba(255, 255, 255, 0.05);
  border-left: 4px solid rgba(255, 255, 255, 0.2);
}

.help-note i {
  color: rgba(255, 255, 255, 0.5);
  font-size: 1.2rem;
  flex-shrink: 0;
  margin-top: 0.1rem;
}

body.dark .help-note i {
  color: rgba(224, 224, 224, 0.5);
}

.help-note p {
  margin: 0;
  color: rgba(255, 255, 255, 0.65);
  line-height: 1.65;
}

body.dark .help-note p {
  color: rgba(224, 224, 224, 0.65);
}
