#zen-cmd-settings-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 10000;
  display: flex;
  justify-content: center;
  align-items: center;
  font-family:
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Roboto,
    Oxygen,
    Ubuntu,
    Cantarell,
    "Open Sans",
    "Helvetica Neue",
    sans-serif;

  .command-palette-settings-modal {
    --modal-bg: light-dark(rgb(250, 250, 250), rgb(24, 24, 27));
    --primary-color: var(--zen-primary-color, #8ae3be);
    --primary-bg: light-dark(
      color-mix(in srgb, var(--primary-color) 90%, white 10%),
      color-mix(in srgb, var(--primary-color) 70%, black 30%)
    );
    --primary-text-color: light-dark(
      color-mix(in srgb, var(--primary-color) 50%, black 50%),
      color-mix(in srgb, var(--primary-color) 50%, white 50%)
    );

    width: 600px;
    max-width: 90vw;
    height: 80vh;
    background-color: var(--modal-bg);
    border-radius: 8px;
    border: 1px solid rgba(127, 127, 127, 0.3);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;

    .cmd-settings-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 12px 20px;
      border-bottom: 1px solid rgba(127, 127, 127, 0.3);

      h3 {
        margin: 0;
        font-size: 18px;
        font-weight: 600;
      }

      div {
        display: flex;
        gap: 10px;
      }

      .settings-save-btn {
        background-color: var(--primary-bg) !important;
        border-color: transparent !important;
        color: var(--primary-text-color) !important;
      }
    }

    button {
      cursor: pointer;
      font-weight: 600;
      transition: all 0.2s ease;
      background-color: transparent;
      border: 1px solid rgba(127, 127, 127, 0.3);
      border-radius: 6px;
      padding: 6px 12px;
      font-size: 14px;

      &:hover {
        background-color: rgba(127, 127, 127, 0.1);
        border-color: var(--primary-color);
      }

      &.icon-button {
        padding: 4px !important;
        background: transparent;
        border: none;
        border-radius: 4px;
        display: flex;
        align-items: center;
        justify-content: center;

        img {
          width: 16px;
          height: 16px;
          fill: light-dark(black, white) !important;
          -moz-context-properties: fill !important;
          transition: filter 0.2s ease;
        }

        &:hover {
          background-color: rgba(127, 127, 127, 0.1);

          &.delete-button img {
            filter: invert(25%) sepia(80%) saturate(5000%) hue-rotate(350deg) brightness(100%)
              contrast(100%);
          }
        }
      }
    }

    .cmd-settings-tabs {
      display: flex;
      padding: 10px 20px;
      border-bottom: 1px solid rgba(127, 127, 127, 0.3);
      gap: 10px;

      .cmd-settings-tab {
        border: none;

        border-radius: 999px;
        padding: 6px 16px;

        font-weight: 700;
        text-transform: uppercase;
        font-size: 0.75rem;
        letter-spacing: 0.5px;
        line-height: 1;

        cursor: pointer;
        transition: all 150ms ease-in-out;

        &:hover {
          transform: scale(1.03);
        }

        &.active {
          background-color: var(--zen-primary-color);

          transform: scale(1.05);

          &:hover {
            background-color: var(--zen-primary-color);
            transform: scale(1.1);
          }
        }
      }
    }

    .cmd-settings-content {
      flex-grow: 1;
      overflow-y: auto;
      padding: 20px;
      scrollbar-width: thin;
      scrollbar-color: rgba(127, 127, 127, 0.3) transparent;

      /*
 * ╭─────────────────────────────────────────────────────────╮
 * │                      Commands Tab                       │
 * ╰─────────────────────────────────────────────────────────╯
*/

      #commands-tab-content {
        .search-bar-wrapper {
          position: sticky;
          top: -20px;
          background: var(--modal-bg);
          padding-bottom: 15px;
          margin: -20px -20px 15px -20px;
          padding-left: 20px;
          padding-right: 20px;
          padding-top: 20px;
          z-index: 1;

          #command-search-input {
            width: calc(100% - 24px);
            padding: 8px 12px unset !important;
            font-size: 14px !important;
            border: 1px solid rgba(127, 127, 127, 0.3) !important;
            border-radius: 6px !important;
            background: rgba(0, 0, 0, 0.2) !important;
            color: inherit !important;
            position: relative;

            &:focus {
              outline: none !important;
              border-color: var(--primary-color) !important;
            }
          }
        }

        #commands-list {
          display: flex;
          flex-direction: column;
          gap: 8px;
          .commands-group-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin: 16px 0 8px;
            padding-bottom: 8px;
            border-bottom: 1px solid rgba(127, 127, 127, 0.3);

            h4 {
              margin: 0;
              font-size: 16px;
              font-weight: 600;
              color: var(--primary-text-color);
            }
          }

          .command-item {
            display: grid;
            grid-template-columns: 24px 1fr auto;
            gap: 12px;
            align-items: center;
            padding: 8px;
            border-radius: 6px;
            transition: background-color 0.2s;

            &:hover {
              background-color: rgba(127, 127, 127, 0.05);
            }
          }

          .command-icon {
            width: 16px;
            height: 16px;
            justify-self: center;
            fill: light-dark(black, white) !important;
            -moz-context-properties: fill !important;

            &.editable {
              cursor: pointer;
              border-radius: 4px;
              padding: 4px;

              &:hover {
                background-color: rgba(127, 127, 127, 0.1);
              }
            }
          }

          .command-label {
            font-size: 14px;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
          }

          .command-controls {
            display: flex;
            align-items: center;
            gap: 10px;

            .shortcut-input-wrapper {
              position: relative;
              display: flex;
              flex-direction: column;
            }

            .shortcut-input {
              width: 120px;
              padding: 6px 10px !important;
              font-size: 13px !important;
              text-align: center !important;
              border-radius: 4px !important;
              border: 1px solid rgba(127, 127, 127, 0.3) !important;
              background-color: rgba(0, 0, 0, 0.2) !important;

              &:disabled {
                opacity: 0.5 !important;
                cursor: not-allowed !important;
              }

              &.conflict {
                border-color: #ff6b6b !important;
                outline-color: #ff6b6b !important;
              }
            }

            .shortcut-conflict-warning {
              position: absolute;
              bottom: -16px;
              left: 0;
              width: 100%;
              text-align: center;
              font-size: 10px;
              color: #ff6b6b;
              font-weight: bold;
            }

            .toolbar-button-toggle {
              padding: 0px;
              display: flex;
              align-content: center;
              justify-content: center;
              width: 24px;
              height: 24px;

              svg {
                scale: 0.75;
              }

              &.active {
                opacity: 1;
                background-color: var(--primary-bg);

                img {
                  filter: invert(0.2);
                }
              }
            }

            .visibility-toggle {
              transform: scale(1.2);
            }
          }
        }
      }

      /*
 * ╭─────────────────────────────────────────────────────────╮
 * │                      Settings Tab                       │
 * ╰─────────────────────────────────────────────────────────╯
*/
      #settings-tab-content {
        .settings-section {
          background: rgba(127, 127, 127, 0.05);
          border-radius: 8px;
          padding: 15px;
          border: 1px solid rgba(127, 127, 127, 0.3);
          margin-bottom: 15px;

          h4 {
            margin: 0 0 10px 0;
            font-size: 16px;
            color: var(--primary-text-color);
            border-bottom: 1px solid rgba(127, 127, 127, 0.3);
            padding-bottom: 8px;
          }

          .setting-item {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 8px 0;
            border-bottom: 1px dotted rgba(127, 127, 127, 0.3);

            &:last-child {
              border-bottom: none;
            }

            label {
              font-size: 14px;
              flex-grow: 1;
              margin-right: 10px;
            }

            input {
              &[type="checkbox"] {
                transform: scale(1.2);
                margin-right: 5px;
              }

              &[type="number"] {
                width: 30px !important;
                padding: 6px 10px !important;
                font-size: 14px !important;
                background: rgba(0, 0, 0, 0.2) !important;
                border: 1px solid rgba(127, 127, 127, 0.3) !important;
                border-radius: 4px !important;
                text-align: right !important;
                &::-moz-number-spin-box,
                &::-moz-number-spin-up,
                &::-moz-number-spin-down {
                  display: none !important;
                }
              }
            }
          }
        }
      }

      /*
 * ╭─────────────────────────────────────────────────────────╮
 * │                  Custom Commaands Tab                   │
 * ╰─────────────────────────────────────────────────────────╯
*/
      #custom-commands-tab-content {
        display: flex;
        flex-direction: column;
        gap: 15px;

        .custom-commands-toolbar {
          padding: 10px;
          margin-bottom: 10px;
          background: rgba(127, 127, 127, 0.05);
          border-radius: 6px;
          border: 1px solid rgba(127, 127, 127, 0.3);

          p {
            margin: 0 0 10px 0;
            font-size: 14px;
            opacity: 0.8;
          }
        }

        .custom-commands-actions {
          display: flex;
          gap: 10px;
        }

        #custom-commands-list {
          display: flex;
          flex-direction: column;
          gap: 8px;

          .no-custom-commands {
            text-align: center;
            opacity: 0.7;
            margin-top: 20px;
          }

          .custom-command-item {
            display: grid;
            grid-template-columns: 24px 1fr auto auto;
            gap: 12px;
            align-items: center;
            padding: 8px 12px;
            border-radius: 6px;
            background-color: rgba(127, 127, 127, 0.05);
            border: 1px solid rgba(127, 127, 127, 0.1);

            .custom-command-icon {
              width: 16px;
              height: 16px;
              justify-self: center;
              fill: light-dark(black, white) !important;
              -moz-context-properties: fill !important;
            }

            .custom-command-name {
              font-weight: 600;
            }

            .custom-command-type {
              font-size: 12px;
              font-weight: bold;
              padding: 2px 6px;
              border-radius: 4px;
              background-color: rgba(127, 127, 127, 0.2);
            }

            .custom-command-controls {
              display: flex;
              gap: 8px;

              button {
                padding: 4px 8px;
                font-size: 12px;
              }
            }
          }
        }

        #custom-command-editor {
          display: flex;
          flex-direction: column;
          gap: 15px;

          h3 {
            font-size: 16px !important;
            margin: 0;
            border-bottom: 1px solid rgba(127, 127, 127, 0.3);
            padding-bottom: 8px;
            margin-bottom: 5px;
          }

          textarea {
            width: calc(100% - 20px);
            min-height: 150px;
            padding: 8px 10px !important;
            font-family: monospace !important;
            font-size: 13px !important;
            border: 1px solid rgba(127, 127, 127, 0.3) !important;
            border-radius: 6px !important;
            background: rgba(0, 0, 0, 0.2) !important;
            color: inherit !important;
          }

          .setting-item {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 4px 0;

            label {
              font-size: 15px;
              padding-right: 20px;
            }
            input[type="text"] {
              padding: 8px 12px !important;
              font-size: 14px !important;
              border: 1px solid rgba(127, 127, 127, 0.3) !important;
              border-radius: 6px !important;
              background: rgba(0, 0, 0, 0.2) !important;
              flex-grow: 1;
            }
          }

          .js-warning {
            font-size: 12px;
            padding: 8px;
            border-radius: 4px;
            background-color: light-dark(rgba(255, 230, 150, 0.5), rgba(100, 80, 0, 0.5));
            border: 1px solid light-dark(rgba(255, 200, 0, 0.8), rgba(255, 200, 0, 0.5));
            display: flex;
            align-items: center;
            gap: 8px;

            svg {
              width: 16px;
              height: 16px;
              min-width: 16px;
              min-height: 16px;
              filter: invert(50%) sepia(100%) saturate(2000%) hue-rotate(30deg) brightness(100%)
                contrast(100%);
            }
          }
        }

        .setting-item-vertical {
          display: flex;
          flex-direction: column;
          gap: 8px;

          > label {
            font-weight: 600;
            font-size: 16px !important;
            padding-top: 2px;
          }

          #chain-builder {
            display: flex;
            flex-direction: column;
            gap: 15px;
            padding: 10px;
            background: rgba(127, 127, 127, 0.05);
            border-radius: 6px;

            #chain-command-selector-placeholder,
            #chain-command-selector {
              flex-grow: 1;
              max-width: 450px;
            }

            menulist {
              fill: light-dark(black, white) !important;
              -moz-context-properties: fill !important;
            }

            #chain-command-selector-container {
              display: flex;
              align-content: center;
              justify-content: space-around;
              gap: 10px;

              #chain-command-selector {
                margin: 0 !important;
              }
            }

            .function-actions {
              display: flex;
              gap: 10px;
              align-items: center;
              margin-top: 10px;
              padding: 10px;
              background: rgba(127, 127, 127, 0.05);
              border-radius: 6px;
              label {
                font-weight: 600;
              }
            }
            .function-step {
              display: flex;
              flex-wrap: wrap;
              gap: 10px;
              align-items: center;
              background: rgba(127, 127, 127, 0.1);
              padding: 8px;
              border-radius: 4px;
              flex-grow: 1;
              label {
                font-weight: bold;
                font-size: 12px;
                text-transform: uppercase;
                padding: 2px 6px;
                border-radius: 4px;
                background-color: rgba(127, 127, 127, 0.2);
              }
              .param-item {
                display: contents;
              }
              .param-input {
                padding: 4px 8px !important;
                font-size: 13px !important;
                border-radius: 4px !important;
                border: 1px solid rgba(127, 127, 127, 0.3) !important;
                background-color: rgba(0, 0, 0, 0.2) !important;
                min-width: 100px;
                flex-grow: 1;
              }
            }

            #current-chain-list {
              display: flex;
              flex-direction: column;
              gap: 8px;
              max-height: 250px;
              overflow-y: auto;
              padding: 10px;
              border: 1px solid rgba(127, 127, 127, 0.1);
              border-radius: 6px;
              .chain-item-container {
                display: flex;
                align-items: center;
                gap: 8px;
                .chain-item-selector {
                  flex-grow: 1;
                }
              }
            }
          }
        }

        .custom-command-editor-actions {
          display: flex;
          justify-content: flex-end;
          gap: 10px;
          margin-top: 10px;
        }
      }

      /*
 * ╭─────────────────────────────────────────────────────────╮
 * │                        Help Tab                         │
 * ╰─────────────────────────────────────────────────────────╯
*/
      #help-tab-content {
        .help-buttons-container {
          display: grid;
          grid-template-columns: 1fr;
          gap: 15px;
          padding: 10px;

          .help-button {
            display: grid;
            grid-template-areas: "icon title" "icon description";
            grid-template-columns: auto 1fr;
            gap: 0 15px;
            padding: 20px;
            text-align: left;
            border: 1px solid rgba(127, 127, 127, 0.3);
            border-radius: 8px;
            background-color: rgba(127, 127, 127, 0.05);
            transition: all 0.2s ease;
            &:hover {
              background-color: rgba(127, 127, 127, 0.1);
              border-color: var(--primary-color);
            }
            img {
              grid-area: icon;
              width: 34px;
              height: 34px;
              align-self: center;
              fill: currentColor;
              -moz-context-properties: fill !important;
            }

            span {
              grid-area: title;
              font-size: 18px;
              font-weight: 600;
              color: var(--primary-text-color);
            }

            p {
              grid-area: description;
              font-size: 13px;
              opacity: 0.8;
              margin: 0;
            }
          }
        }
      }
    }
  }
}

#urlbar[zen-cmd-palette-prefix-mode="true"] {
  background: red !important;
}
